Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Opening instance of .ecore in GMF diagram
Opening instance of .ecore in GMF diagram [message #668429] Thu, 05 May 2011 16:27 Go to next message
David Mising name is currently offline David Mising nameFriend
Messages: 9
Registered: December 2010
Location: Aachen
Junior Member

Hey everyone,

I got into a little trouble trying to programmatically open an instance of my ecore model in a gmf-diagram. The instance I would like to display is in a Resource and I try to open it in a rcp application.

I have already tried this:
MyDiagramEditorUtil.openDiagram(myResource);


but this causes this error:
	java.lang.NullPointerException
	at org.eclipse.core.runtime.Path.<init>(Path.java:153)
	at my.diagram.part.MyDiagramEditorUtil.openDiagram(MyDiagramEditorUtil.java:82)


DiagramEditorUtil seems like a good starting point for my approach, e.g. using the runWizard() method worked fine, but I do not want to use this wizard. Or am I totally wrong at this point?

Hope someone could help. Thanks upfront

Best regards,
David
Re: Opening instance of .ecore in GMF diagram [message #669442 is a reply to message #668429] Tue, 10 May 2011 11:12 Go to previous message
Adrian Civil is currently offline Adrian CivilFriend
Messages: 10
Registered: January 2011
Junior Member
URI newURI = URI.createURI("file:/C:/xyz");
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
   page.openEditor(new URIEditorInput(newURI), XYZ.diagram.part.XYZDiagramEditor.ID);
} catch (PartInitException e) {
   e.printStackTrace();
}

Or get the URI from the resource that you have. Not sure if this is the correct way to do it, but you could give it a try...
Previous Topic:Create automatically an edge between two nodes
Next Topic:set Default Color of figures
Goto Forum:
  


Current Time: Tue Apr 16 19:06:29 GMT 2024

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

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

Back to the top