Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » programmatically open a related diagram
programmatically open a related diagram [message #205805] Wed, 17 September 2008 15:50 Go to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Hello,

i want to open such a diagram. It is possible for me to open the
"normal" diagram with this code:

Path ist the way to the diagram file.

IPath iPath = new Path(path);

IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(iPath);
FileEditorInput input = new FileEditorInput(file);
String editorID =
PlatformUI.getWorkbench().getEditorRegistry().getDefaultEdit or(file.getName()).getId();
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(input,
testID);
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

This open the diagram, but now i want to open the related diagram, which
has the name xxx.xxx_diagram#2 . Can someone help me or give me a hint
to do this?

Greetings
Jörg
Re: programmatically open a related diagram [message #205822 is a reply to message #205805] Wed, 17 September 2008 15:56 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jörg,

You have to use URIEditorInput instead of FileEditorInput for it.

-----------------
Alex Shatalin
Re: programmatically open a related diagram [message #205831 is a reply to message #205822] Wed, 17 September 2008 16:30 Go to previous messageGo to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Alex Shatalin schrieb:
> Hello Jörg,
>
> You have to use URIEditorInput instead of FileEditorInput for it.
>
> -----------------
> Alex Shatalin
>
>
Thanks for your hint, but this doesn't work actually. I get an error
that the file xxx.xxx_diagram#2 doesn't exist. May be i forgot something.

String path2 = //the path to the xxx.xxx_diagram#2 file

URIEditorInput input2 = new URIEditorInput(URI.createFileURI(path2));
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(input2,
testID2);
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Greetings
Re: programmatically open a related diagram [message #205838 is a reply to message #205831] Wed, 17 September 2008 16:54 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jörg,

Try using URI.createPlatformResourceURI() with appropriate parameters.

-----------------
Alex Shatalin
Re: programmatically open a related diagram [message #205844 is a reply to message #205838] Wed, 17 September 2008 16:57 Go to previous message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Alex Shatalin schrieb:
> Hello Jörg,
>
> Try using URI.createPlatformResourceURI() with appropriate parameters.
>
> -----------------
> Alex Shatalin
>
>
Thanks but i solved it on another way. I have get the editpart over the
"super" diagram and then i used the code from the OpenDiagramEditPolicy
to open the diagram. Anyway thanks again.
Previous Topic:Label positioning
Next Topic:undo redu
Goto Forum:
  


Current Time: Thu Jan 28 06:15:07 GMT 2021

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

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

Back to the top