Integrating EMF and GMF Generated Editors Advanced

In the article “Integrating EMF and GMF Generated Editors” Volker Wegert and Alex Shatalin describe, how you add your GMF Editor to the multipage EMF Editor. Their tutorial demand that you use the same file for your diagram and model, because it is easier. Nevertheless it is possible. All you have to modify is step 7 from the tutorial.

If you have separate files for diagram and model for your GMF generated editor you must just change your code from

// This is the page for the graphical diagram viewer.
//
diagramEditor = new TopicMapDiagramEditor();
pageIndex = addPage(diagramEditor, getEditorInput());
setPageText(pageIndex, "Diagram");

to

// This is the page for the graphical diagram viewer.
//
IFile diagram1File = null;
IFile diagram2File = null;
FileEditorInput input2 = null;
diagramEditor = new TopicMapDiagramEditor();
diagram1File = ((FileEditorInput) getEditorInput()).getFile();

diagram2File = diagram1File.getProject().getFile(
                 diagram1File.getProjectRelativePath().
                 removeFileExtension().addFileExtension("topicmap_diagram"));


input2 = new FileEditorInput(diagram2File);
pageIndex = addPage(diagramEditor, input2);
setPageText(pageIndex, "Diagram");

This is only a hint how you get your integrated editors working. A better way is to extend your “getWrappedInput()” method and use it for your diagramEditor too.
(via)

Diesem Beitrag wurden folgende Tags zugewiesen:
, ,

2 Kommentare zu “Integrating EMF and GMF Generated Editors Advanced”

  1. Martin Jansen

    I suggest adding a comment about this on https://bugs.eclipse.org/bugs/show_bug.cgi?id=189399.

  2. Thommy

    Done! :-)

Einen Kommentar schreiben: