Hi, I've today released the first bits of a generic forward compat layer which allows people to take advantage of the e4-Programming model in 3.x and 4.x world.
The idea is: * 3.x: Set up a DI-Container from Scratch using workbench-services => Do the same the E4Application does when starting up * 4.x: Get access to the DI-Infrastructure of the Compat-Layer The compat-stuff is split into 2 Bundles: * org.eclipse.e4.tools.compat: The DI-Container implementation for 3.x/4.0 * org.eclipse.e4.tools.services: some special services needed to e.g. setting the dirty state in a 3.x/4.0 and e4 world There are currently 2 examples who are using this forward compat-layer: * My Model Editor * My Eclipse Translator View http://code.google.com/a/eclipselabs.org/p/eclipse-translator-view/ The Simple e4 IDE will also make use of this compat stuff so everything written for the Simple e4 IDE would run in 4.0/3.x as well. Now that I've explained the big picture here's how to use it: a) Editors ========== To implement a editor using the DI-Programmingmodel all you need to do is to extend the DIEditorPart look like this: ----------8<---------- public class E4WorkbenchModelEditor extends DIEditorPart<ApplicationModelEditor> { public E4WorkbenchModelEditor() { super(ApplicationModelEditor.class); } @Override public void doSave(IProgressMonitor monitor) { getComponent().doSave(monitor); } @Override public void doSaveAs() { } @Override public boolean isSaveAsAllowed() { return false; } @Override public void setFocus() { getComponent().setFocus(); } } ----------8<---------- b) ViewPart =========== To implement a simple ViewPart you subclass DIViewPart like this: ----------8<---------- public class TranslatorView extends DIViewPart<TranslatorComponent> { public static final String ID = "at.bestsolution.translate.view.views.TranslatorView"; public TranslatorView() { super(TranslatorComponent.class); } /** * Passing the focus request to the viewer's control. */ public void setFocus() { getComponent().setFocus(); } } ----------8<---------- Since @Persist got moved to a new clean bundle the above save methods will be gone in very soon and once we have the @Focus-Annotation I can also provide the implementation of setFocus() in the base classes. The current 3.x DI-Container is not holding all context-services available in a 4.0-World (e.g. currently no Logger is available) but I'll add them step by step. Feedback, criticism is naturally welcome. Tom -- B e s t S o l u t i o n . a t EDV Systemhaus GmbH ------------------------------------------------------------------------ tom schindl geschaeftsfuehrer/CEO ------------------------------------------------------------------------ eduard-bodem-gasse 5/1 A-6020 innsbruck phone ++43 512 935834 _______________________________________________ e4-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/e4-dev
