Version 14 (modified by sena, 4 years ago) (diff)


This page lists the issues faced and solutions to some of those while migrating Experiment Designer plugin to E4.

For the current status of Experiment Design plugin's migration, see ExperimentDesignerMigrationToDo.

One major issue is that the editor that uses GEF MVC (3.x) could not be converted to GEF4 (E4 is only supported in GEF4) since that would require almost a complete re-write. In the end, the GraphEditor (org.grits.toolbox.editor.experimentdesigner.editors.GraphEditor) and its companion classes are left at the compatibility layer. This required leaving Perspective definition (in addition to editor definition) in plugin.xml and the rest of the components are migrated to E4 and defined in fragment.4xmi

Contributing a new perspective from a plugin (fragment.4xmi)

In order to add a new perspective from a plugin, in the fragment.4xmi you need to create a new model fragment (as a child of the perspective stack defined in Application.4xmi)

An example is shown below:

I have followed the instructions in this link to be able to add a placeholder for the Editor Area. For this approach to work, the shared element (area) defined in Application.4xmi file should have an id such as "org.eclipse.ui.editor.area" and the placeholder added under the perspective stack for this are must have the id "org.eclipse.ui.editorss". However, since the current GRITS system contains both 3.x and E4 plugins, they have to share the same editor area. If we use an id other than "org.eclipse.ui.editorss" for the area defined as a shared element in Application.4xmi file, legacy 3.x editors do not show up at the same "editor area" (they seem to share the same area but the area replaces the previous one - they are not added as tabbed). If we use the id "org.eclipse.ui.editorss" for the area, it solves the problem of 3.x and E4 editors showing up in different areas but then the import of the shared element does not work properly and the perspective definition does not work (editor does not show up under the "editor area" but in some other partStack).

In summary, until we migrate all the plugins and components to E4 we cannot seem to contribute new perspectives from the plugins' fragment.4xmi files. For now, I've added the perspective definition for the experiment designer in "Application.4xmi" file but only defined the partstacks and placeholders and referenced those partstacks from experiment designer's fragment.4xmi file and added the parts as shown below:

Experiment Designer fragment then only references to the partstacks (eg. "org.grits.toolbox.core.partstack.protocolview") to add the actual parts under them as shown below (fragment.4xmi):

There are also other special cases regarding the Experiment Designer's perspective since it needs to have a 3.x part as well as e4 parts. In this case, the plugin.xml also contains a perspective extension and the id of the perspective defined in plugin.xml should be different from the id of the perspective defined in Application.4xmi. The 3.x editor (since it is also in plugin.xml) should be opened by deprecated EditorHandler class since the new GritsUIService only opens E4 parts. EditorHandler opens the editor in the perspective defined in plugin.xml but since the editor area is the same, switching the correct perspective defined in Application.4xmi afterwards do not cause problems and adds the required parts to the perspective. In summary, for this plugin, we have to make two additional switch perspective calls every time the editor is first activated.

    // Switch to the ExperimentDesign perspective defined in fragment.e4xmi 
    PropertyHandler.changePerspective("org.grits.toolbox.editor.experimentdesigner.designPerspective.<Experiment Design>");

Interaction between 3.x editor and E4 parts

For the experiment designer plugin there are several types of interactions required between the "GraphEditor" and the parts (ProtocolView, PaperView and ParameterView).

Attachments (4)

Download all attachments as: .zip