RSS

Search Engine

Saturday, October 23, 2010

Tips

17.1. Allow drag and drop for your parts in the workbench

Eclipse e4 does not support drag and drop of the parts parts (views and editors) within an application by default.

To make this work add a dependency to the plugin “org.eclipse.e4.ui.workbench.addons.swt” and add the Add-On “org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon” to your “Application.e4xmi”.

Drag and drop will create new container if required. To remove them automatically also register "platform:/plugin/org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.cleanupaddon.CleanupAddon".

17.2. Model access at runtime

The model can be accessed at runtime. To see the current model include the plugin "org.eclipse.e4.tools.emf.liveeditor" and its dependencies into your launch configuration. You should then be able to open the model editor of your running application via the shortcut ALT+Shift+F9 depending on your version.

17.3. Persists user changes

Eclipse e4 application allow via startup parameters if the user changes should be persists and how. A similar behavior exists in Eclipse 3.x via the the setSaveAndRestore(true) setting.

Table 3. Sample Table

ParameterDescription
-persistState false|trueDefault is false, if set to false user changes are not recorded.
-clearPersistedStatewill delete the recorded delta of the last session.
-useDeltaRestore true|falseCurrently not working see https://bugs.eclipse.org/bugs/show_bug.cgi?id=313883, should control how the deltas are stored. a) Store deltas and apply them on startup using the Reconciler. This way new contribution will be shown in your application. b) Serialize the complete model (this is similar to 3.x saveAndRestore(true)) and deserialize from XMI

17.4. Styling the Eclipse 4.0 SDK

You can use the ThemeManager to style the Eclipse 4.0 SDK itself. In the Eclipse 4.0 SDK the active theme is selected via Window -> Preferences -> General -> Appearance. These style sheets are stored in the plugin "org.eclipse.platform". This plugin_contains a folder /css which contains the style sheets for the individual platforms (os based).

You can also contribute a new theme via your own plugin. Create a simple plugin (no activator required) which has a single dependency to the plugin "org.eclipse.e4.ui.css.swt.theme". Add the extension point "org.eclipse.e4.ui.css.swt.theme" and add a theme to this extension point. Create a css file and point the theme to this file. If you export your plugin (including the css file )and put it into your Eclipse installation folder into dropin you should be able to select your new theme after restarting the Eclipse 4.0 SDK.

0 comments:

Post a Comment