Category Archives: Eclipse

Eclipse plug-in & RCP stuff

Confirming cancel in a ProgressMonitorDialog

I’m working on a routine that downloads content from a host to the users desktop.

As the content is being downloaded, a progress dialog is displayed (implemented as ProgressMonitorDialog).

In the progress monitor, the cancel button is enabled.

In the default implementation, if the cancel button is pressed on the ProgressMonitorDialog, the cancel button is disabled.

I wanted to be able to ask the user if they really want to cancel the operation. If they don’t, then continue on with the operation. If they do, then perform the cancellation as usual.

I couldn’t find a straight forward way to implement this with the default operation, so I came up with my own solution…

Continue reading

Related posts ...
In a recent project I had a combo box that I wanted to add additional
Normally, when you view the property pages on Eclipse items, the pages show up in
I'm in the process of updating the help text for my RCP and have found
I had a very frustrating day at work today ... nothing was working right ...

Dynamically populating a Combo based on shift key

In a recent project I had a combo box that I wanted to add additional entries to if they clicked on it with the shift key pressed.

This is to allow to select entries that would not normally be displayed (for example, out dated values that could actually be selected).

To do this, I added key-up & key-down listeners on the Display object and populated the Combo based on the shift key state.
Continue reading

Related posts ...
I'm in the process of updating the help text for my RCP and have found
Normally, when you view the property pages on Eclipse items, the pages show up in
I had a very frustrating day at work today ... nothing was working right ...
It took a bit of experimentation, but I think this routine could be used to

Controlling Property Page Sort Order

Normally, when you view the property pages on Eclipse items, the pages show up in alphabetical order.

Sometimes this isn’t what you want.  While I was working on my RCP project I found the property pages usually didn’t show up in a pleasing order, so had to figure out a way to control the sort order.

Continue reading

Related posts ...
Another item I struggled with ... adding the help icon to various dialogs (wizards, preferences,
I'm in the process of updating the help text for my RCP and have found
I had a very frustrating day at work today ... nothing was working right ...
It took a bit of experimentation, but I think this routine could be used to

Text On Splash Screen

You may have heard a variation of this at some point …

A lazy programmer is not necessarily a good programmer … but a good programmer is a lazy programmer.

I fully subscribe to that statement … good programmers are always looking for ways to make their jobs easier.  Either by automating some repetitive function or making some functionality easier to change in the future.

Recently I had to do some re-branding on one of my eclipse based applications.  One thing that I had to do was update the splash screen that was displayed in the Eclipse RCP to display different text.

We had the basic graphic and all we needed was to have our designer update the text that was displayed on the bottom.  I sent the graphic over and the new text and the designer sent it back to me.

The problem was, I got the text wrong.  I knew I was going to have to go back to the designer and ask her to redo the graphic.  Luckily she’s a very nice person and never had a problem with this.

Continue reading

Related posts ...
In a recent project I had a combo box that I wanted to add additional
Normally, when you view the property pages on Eclipse items, the pages show up in
Here's a problem I just encountered ... and, unfortunately, haven't figured out a solution. A
I'm in the process of updating the help text for my RCP and have found

Modifying the Environment

Here’s a problem I just encountered … and, unfortunately, haven’t figured out a solution.

A customer is trying to run my Eclipse RCP application … but it’s crashing because it can’t find ‘com.mercury.javashared.agentloader.AgentBootstrap’ class (which is apparently part of the HP QuickTest Professional product).

Turns out they had the ‘JAVA_TOOL_OPTIONS’ environment variable set to ‘-agentlib:jvmhook’ at the system level (set in the Windows control panel).

This was causing the boot loader to try and load the class that couldn’t be found.

A temporary work around is to set the JAVA_TOOL_OPTIONS environment variable to blank every time they launch the application … but that’s a major pain in the long term.

I’d like to fix this by finding a way to override the JAVA_TOOL_OPTIONS environment variable in the eclipse.ini file, or possibly providing a different ‘-agentlib’ parameter option that will supersede the existing value.

I guess I could provide a batch file that clears the environment variable before invoking the application … but that’s kind of kludgy (IMO).

Of course, any product that sets a global environment variable such as this is (at least in my opinion) seriously broken.  The only global environment variable that any application should set (or even be allowed to set) is maybe the path.

Related posts ...
I'm working on a routine that downloads content from a host to the users desktop.
In a recent project I had a combo box that I wanted to add additional
Normally, when you view the property pages on Eclipse items, the pages show up in
I'm in the process of updating the help text for my RCP and have found

Adding Help to Dialogs

I’m in the process of updating the help text for my RCP and have found that some of the dialogs that I’m invoking don’t have the ability to directly add help context id’s.

After a bit of digging, I found it’s not that difficult to add help to an object that extends Dialog.

For this example, I’m going to add a help id to the InputDialog class.

Continue reading

Related posts ...
In a recent project I had a combo box that I wanted to add additional
Normally, when you view the property pages on Eclipse items, the pages show up in
I had a very frustrating day at work today ... nothing was working right ...
It took a bit of experimentation, but I think this routine could be used to

Inheritance

One my gripes about the Eclipse framework is the general lack of standardized interfaces & inheritance.

For instance: a TreeColumn & TableColumn both have a lot of attributes in common … width, alignment, movability, sortability, resizeability, etc.

But since they don’t share an interface or a common ancestor, you can’t handle them with common code.

Similarly widgets like the ComboBox and a Text field share a lot of attributes … they can hold text, they can be changed, etc, but you can’t access those attributes with a common interface.

Sadly most Eclipse widgets explicitly forbid subclassing … so I can’t subclass the various types and add my own interfaces. The following is a direct quote from the TableColumn javadocs …

IMPORTANT: This class is not intended to be subclassed.

And, unfortunately, they enforce this in code.

Related posts ...
One of the things I needed to support in my RCP is the ability to
Another item I struggled with ... adding the help icon to various dialogs (wizards, preferences,
I'm in the process of building a new application at work ... this is a
As I mentioned before ... even though I'm participating in Yahoo's Email Complaint Feedback Loop,

Buckminster Interference?

Weird … I just tried to build my RCP application and the ant script blew up.

It seems like there’s some kind of interference caused by the addition to Buckminster to my Eclipse install.

My build should not be referencing any buckminster functionality at all.

Unfortunately I don’t have the time to dig into the problem.

Related posts ...
Recently I was struggling with a problem having to do with the headless build of
There appears to be a known issue in the headless build facility that results in
I was trying to use Eclipse 3.6 to manually export a RPC using on a
I'm in the process of updating the help text for my RCP and have found

Preventing Multiple Instances

One of the things I needed to support in my RCP is the ability to prevent multiple copies (instances) of the application from running at the same time.

The solution is surprisingly easy … although, as with many things, not especially well documented.

In your Application class (that implements IApplication) you need to create a lock file in the application’s instance location.
Continue reading

Related posts ...
At work I'm the process of building a new GUI application using the Eclipse RCP
Another item I struggled with ... adding the help icon to various dialogs (wizards, preferences,
I'm in the process of building a new application at work ... this is a
As I mentioned before ... even though I'm participating in Yahoo's Email Complaint Feedback Loop,

Help Icon on Dialog Pages

Another item I struggled with … adding the help icon to various dialogs (wizards, preferences, properties, about box, etc).

In almost all Eclipse dialogs … there is a question mark icon in the lower left hand corner. You click on this and it invokes the context sensitive help.

The problem was, I couldn’t figure out how to activate this.

I thought it would be controlled by some plug-in or product setting, but I couldn’t determine where.

After a fair bit of digging & debugging of base Eclipse, I determined that this feature is turned on globally for the entire application:

Continue reading

Related posts ...
One of the things I needed to support in my RCP is the ability to
I'm in the process of building a new application at work ... this is a
As I mentioned before ... even though I'm participating in Yahoo's Email Complaint Feedback Loop,
I've always thought that Leonard Nimoy and I had a fair bit in common ...