Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Opening the Diagram editor from the EMF tree Editor
Opening the Diagram editor from the EMF tree Editor [message #222203] Sat, 21 March 2009 17:26
maatari is currently offline maatariFriend
Messages: 74
Registered: July 2009
Member
> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3320504797_8881613
Content-type: text/plain;
charset="ISO-8859-1"
Content-transfer-encoding: 8bit

Hi all,

I would like to open a Diagram editor by responding to a double click
listener added to the EMF generated tree EDITOR. My Diagram are available
only for certain ITEM of the TREE editor.
I have followed the tutorial integrating EMF and GMF editor for the support
of this combination.

The main difference with the tutorial is that, they create page which are
fixed in time. The Addition of the DiagramPage is done once and for all in
CreatePages() Method of the Multi-page Editor.

From my part, I would Like to to add a new Page using the same addPage()
each time the doubleclick action happen. In the line of the tutorial, in my
created EditorPart (which replace ViewerPane), I create an anonymous double
click listner which is adeed to his TreeViewer.

In the doubleclick Listener, I retreive the Object selected, check which one
it is and then, Call the view service and etc....

if (object instanceof EObject && ((EObject)object).eClass() ==
OMPackage.Literals.SS) { List
affectedFiles = new LinkedList();
AbstractTransactionalCommand command = new AbstractTransactionalCommand (
(TransactionalEditingDomain) getEditingDomain(),
"Diagram Opening", affectedFiles)
{ @Override protected
CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
Diagram diagram = ViewService.createDiagram(
(EObject)object, SSEditPart.MODEL_ID,
OperADiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
((EObject)object).eResource().getContents().add(diagram);
return CommandResult.newOKCommandResult(); }
}; try {
OperationHistoryFactory.getOperationHistory().execute(comman d, new
NullProgressMonitor(), null);
//((EObject)object).eResource().save(OperADiagramEditorUtil. getSaveOptions()
); EList <EObject> list =
((EObject)object).eResource().getContents();
Diagram diagram = (Diagram) list.get(list.size() - 1);
OperADiagramEditor mydiagramEditor = new OperADiagramEditor();
int pageIndex = parentEditor.addPage(mydiagramEditor,
parentEditor.getWrappedInput(new
URIEditorInput(EcoreUtil.getURI(diagram))));
parentEditor.setActiveEditor(mydiagramEditor); }


The problem I have is that, the diagram Tab open and the Tree editor Tab is
hidden: A.K.A No tab view only the diagram Editor is Open.

Also I have putted the following in comment
//((EObject)object).eResource().save(OperADiagramEditorUtil. getSaveOptions()
);

Because it cause the Diagram Editor not to work at all and provoke even a
null pointer when I close the eclipse workbench lauched to test the plugin.


Also I use parentEditor.setActiveEditor(mydiagramEditor); because the method
setActivePage is protected, which is ok in this case but for the pageText, I
don
Previous Topic:Undo problem - undo of node creation causes StackOverflowError
Next Topic:deleteFromModelAction remove="true" Not working [Please Help]
Goto Forum:
  


Current Time: Thu Apr 25 21:50:20 GMT 2024

Powered by FUDForum. Page generated in 0.04279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top