Menu

Migrating_to_Eclipse_4

Jay Jay Billings Dasha
There is a newer version of this page. You can find it here.

This page describes the migration of NiCE from an Eclipse 3.7.2 RCP application to an Eclipse 4.2.2 application.

NiCE's Eclipse 4 plug-in is called gov.ornl.nice.client.e4.

Changes

There is no distinction between Editors and Views in Eclipse 4. Instead, only "Parts" are considered. (Recall that in Eclipse 3.x a Part was the base class for Editors and Views.) New parts, but not the SWT code that draw the contents of those parts, were created for NiCE's e4 port. PartSashContainers and PartStacks were created to replace the layout configured in the plugin.xml file from the 3.7.2 version. A horizontally split PartSashContainer was used as the base with the left containing a vertically split PartSashContainer with PartStacks to reproduce the vertical stacking of the ItemViewer and TransformationViewer. The same scheme was used on the right-side of the base container to reproduce the vertical stacking of the FormEditor space and the Console view.

It is important to note that fixing the width or height of a PartStack is done by the putting a number in the obsurely named "Container Data" field in the editor and that the weighting is done in thousands. So, to weight two parts that are vertically stacked in a PartSashContainer, one part must have Container Data set to 75000 and the other should have it set to 25000 instead of .75 and .25 or 75 and 25.

Handlers and Commands were added as needed to replace the 3.7.2 commands. The source code for these was directly transferred.

Accessing the workbench was updated to use dependency injection. This was important, for example, at those places where selection services were needed.

Views are now implemented as stand-alone SWT classes that have their parents injected with the @Inject clause. A very important point that is not mentioned in the more common tutorials is that, at least as far as I can tell, @Inject should be used to inject the parent composite on a constructor or init() operation and @PostConstruct should be called after that step to set input or connect to a remote resource. NiCE's ItemViewer is a good reference point for an example.

Tricky Things

When injecting resources with URIs, it is "bundleclass://" and "platform:/" with the first having two forward slashes and the second having only one forward slash after the semicolon.

References

The following references were used for this work:


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.