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.
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 not 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.
The following references were used for this work:
Eclipse 4 (e4) Tutorial by Jonas Helming from EclipseSource - http://eclipsesource.com/blogs/2012/05/10/eclipse-4-final-sprint-part-1-the-e4-application-model/ Eclipse 4 RCP - Tutorial from Lars Vogel - http://www.vogella.com/articles/EclipseRCP/article.html Eclipse 4 RCP/EAS/Workbench services - http://wiki.eclipse.org/Eclipse4/RCP/EAS/Workbench_Services#Part_providing_a_selection Eclipse 4 Tutorial by Tom Schindl - http://tomsondev.bestsolution.at/2010/07/28/eclipse-4-0-and-tutorial-on-writing-e4-rcp-application-released/