Migrating plug-ins from Eclipse 3.x to Eclipse 4 – getting ready for Eclipse 4

To migrate your Views and Editors to Eclipse 4 you can choice to use org.eclipse.e4.tools.compat plug-in from the e4 tooling projects. This bridge was developed by Tom Schindl a while ago.

To use this bridge in Eclipse 4.2 or Eclipse 3.8 install the org.eclipse.e4.tools.e3x.bridge feature into your Eclipse IDE.

Afterwards add the following plug-ins to your MANIFEST.MF.


You can now develop your Parts as Pojos:

[code type=”java”]
package example.compat.parts;

import javax.annotation.PostConstruct;

import org.eclipse.e4.ui.di.Focus;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;

public class View {
public static final String ID = "example.compat.view";

private TableViewer viewer;

public void createPartControl(Composite parent) {
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
column.setLabelProvider(new ColumnLabelProvider(){
public String getText(Object element) {
return element.toString();

// Provide the input to the ContentProvider
viewer.setInput(new String[] { "One", "Two", "Three" });

public void setFocus() {

You only have to wrap them into an instance of DIViewPart:

[code type=”java”]
package example.compat;

import org.eclipse.e4.tools.compat.parts.DIViewPart;

import example.compat.parts.View;

public class ViewWrapper extends DIViewPart<View> {

public ViewWrapper() {


In your plugin.xml you use ViewWrapper to define your Views.

This way you can use the dependency injection already in your Eclipse 3.x plugin, have a better possibility to test your user interface components in plain JUnit test (they are just POJO) and get ready for for a full Eclipse 4 migration.

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of vogella.com. With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Eclipse and tagged , . Bookmark the permalink.