I have quite a load of plugins installed in my Eclipse installation and not sure which one caused this error. But it was interesting enough to add it here:
Jan 27, 2008
Interesting error message
Posted by
Prakash G.R.
at
9:50 PM
1 comments
How to add TrayItem in Eclipse RCP application?
In an application like Yahoo Messenger or Skype, you don't want to quit the application when the main window is closed. Most of these applications will move themselves to System Tray when the main window is closed and clicking on the Tray icon would bring back the window. Lets try to see how to do it in an Eclipse RCP Application.
When the window is closed, the WorkbenchWindowAdvisor.preWindowShellClose() method is called. If this returns false, then the close request will not be honored. So all we need to do is to override this method; create a TrayItem; hide the window and return false.
trayItem = new TrayItem(Display.getDefault().getSystemTray(), SWT.NONE);
trayItem.setText("My RCP App");
trayItem.setImage(getAppIcon());
trayItem.addSelectionListener(getSelectionListener());
getWindowConfigurer().getWindow().getShell().setVisible(false);
return false;
In the SelectionListener, we can add code to bring up the window:
Shell workbenchWindowShell = getWindowConfigurer().getWindow().getShell();
workbenchWindowShell.setVisible(true);
workbenchWindowShell.setActive();
workbenchWindowShell.setFocus();
workbenchWindowShell.setMinimized(false);
trayItem.dispose();
Simple :-)
Jan 18, 2008
How to add a status bar in an RCP app?
If you are writing an RCP application, you may want to add a status message in the status bar. Adding it is very simple.
By all chance, you already have a class extending org.eclipse.ui.application.ActionBarAdvisor in your RCP app (If not, Google around to find out how to add one to your RCP app). Just override the fillStatusLine method.
private StatusLineContributionItem statusItem;
@Override
protected void fillStatusLine(IStatusLineManager statusLine) {
statusItem = new StatusLineContributionItem("LoggedInStatus");
statusItem.setText("Logged in");
statusLine.add(statusItem);
}
Thats it :-)
Note 1: You can add any number of status items
Note 2: In Eclipse 3.3, the class StatusLineContributionItem is in org.eclipse.ui.internal.util package. This has been moved to org.eclipse.jface.action package in Eclipse 3.4
Posted by
Prakash G.R.
at
10:45 PM
0
comments
Jan 10, 2008
Deploying RCP along with JRE
When you distribute your RCP application you never know whether the end user will have a JVM installed in his machine or not. Even if he has a JVM, there are a good number of possibilities that it will be an older version. A simple solution to this problem is to bundle and ship a JRE along with your product and make the product to use that JRE. Eclipse provides a easier way to do it. In the Launching tab of your product editor, select the JRE you want to bundle. Save the file and export the product.
You are done :-)
Its good to have an installer without the JRE as well, because for those who have the required JRE, it will help in the download size
Posted by
Prakash G.R.
at
4:45 PM
0
comments
Exporting Jar - the easy way
There might be times where you want to create the same Jar file again and again. You don't have to run the Jar Export wizard every time you run the wizard. You can save the description of the Jar Export in the workspace and just right click to create the Jar. Here is what you need to do:
- In the first page, check the Overwrite existing files without warning (This is optional, but if you are frequently creating the jar, this helps you saving from the little annoying dialog)

- In the second page of Jar Export Wizard, check "Save the description of this JAR" and give the location to save

- The next time you want to create the jar, just right click the *.jardesc file and select "Create Jar"
Posted by
Prakash G.R.
at
9:14 AM
0
comments

