Form EditorΒΆ

The Text/Form editor is available as a new page on the Xtext-generated editor.

It is implemented in the org.geneauto.emf.blocklibrary.editor project in the blocklibrary.formPage package.

Below is a screenshot of the Text/Form editor

Screenshot

Screenshot of the editor on a BlockMode

Hierarchical structure:

BlocklibrayEditor
+ BlocklibraryFormPage
  + BlocklibraryMasterDetailsBlock
    + BlocklibraryDetailsPageProvider
      + BlocklibraryDetailsPage

UML class diagram

Class diagram

Here is the diff of the modifications needed to integrate the form editor in the generated editor (after Xtext generation):

- import org.eclipse.ui.part.MultiPageEditorPart;
+ import org.eclipse.ui.forms.editor.FormEditor;
+ import blocklibrary.formPage.BlocklibraryFormPage;


- public class BlocklibraryEditor extends MultiPageEditorPart implements
+ public class BlocklibraryEditor extends FormEditor implements


-        public void createPages() {
+        public void addPages() {
                 // Creates the model from the editor input
                 //
                 createModel();

+                // This is the page for the details editor.
+                //
+                {
+                        try {
+
+                                BlocklibraryFormPage page = new BlocklibraryFormPage(this);
+
+                                int pageIndex = addPage(page);
+
+                                setPageText(pageIndex, "Model + Form editor");
+
+                        } catch (PartInitException e) {
+                                e.printStackTrace();
+                        }
+                }
+


         protected boolean showOutlineView() {
                 return true;
         }
+
+        public void pub_createContextMenuFor(TreeViewer viewer) {
+                createContextMenuFor(viewer);
+        }
  }

Previous topic

Embedded languages specification

Next topic

Documentation generation

This Page