Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Problem with mutli editors for one meta model
Problem with mutli editors for one meta model [message #211260] Fri, 14 November 2008 10:51 Go to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
Hi !
it's my first post on GMF newsgroup and i'm sorry in advance if my
question has already been posted.

I have a metamodel with some elements containing elements in fact we
modelize software:
with
- applications containing ports and partitions
- a partition is linked to a port
- applications are linked together in a System via ports

to implement this i have a gmf editor that display the System, the
applications and the ports

and i designed another gmfmap to focus on application containment the
goal is to focus on Partitions.

I successed to implement that when i double click on my application I
open another editor to focus on containment and I have only one diagram
file (thanks to opendiagram behaviour in gmfgen)

But i want to design a specific feature :
when i am in sub diagram in my application i want to
- let the user clicking on a port
- display the list of the partitions connected to this ports in other
application in an eclipse view
- if the user selects one partition i want to open the corresponding diagram

And this is the last step that i don't know how to realize.
I tried to use OpenDiagramCommand or myEditorUtil.findView but in all
case i success to open the default editor diagram (top level) and not
the corresponding to partition (sub level)

if anybody can help me ? :(




Re: Problem with mutli editors for one meta model [message #211326 is a reply to message #211260] Fri, 14 November 2008 14:33 Go to previous message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 460
Registered: July 2009
Senior Member
okay i finally did it with this code please tell me if there is
something better

ISelection selection = viewer.getSelection();
EObject obj = (EObject)
((IStructuredSelection)selection).getFirstElement();
obj.eResource().getResourceSet().getResources();
Diagram currentDiagram = null ;
for (Resource r : obj.eResource().getResourceSet().getResources())
{
for (TreeIterator<EObject> i = r.getAllContents() ; i.hasNext() ; )
{
EObject o = i.next();
if (o instanceof Diagram)
{
currentDiagram = (Diagram) o ;
}
else if (o instanceof Node) {
Node node = (Node) o;
if (node.isVisible() && node.getElement() == obj)
{
URI uri = EcoreUtil.getURI(currentDiagram);
String editorName = uri.lastSegment()
+ "#" +
currentDiagram.eResource().getContents().indexOf(currentDiag ram);
//$NON-NLS-1$
IEditorInput editorInput = new URIEditorInput(uri, editorName);
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
try {
IEditorPart part = page.openEditor(editorInput, "id");
}
}
}


Tristan FAURE a écrit :
> Hi !
> it's my first post on GMF newsgroup and i'm sorry in advance if my
> question has already been posted.
>
> I have a metamodel with some elements containing elements in fact we
> modelize software:
> with
> - applications containing ports and partitions
> - a partition is linked to a port
> - applications are linked together in a System via ports
>
> to implement this i have a gmf editor that display the System, the
> applications and the ports
>
> and i designed another gmfmap to focus on application containment the
> goal is to focus on Partitions.
>
> I successed to implement that when i double click on my application I
> open another editor to focus on containment and I have only one diagram
> file (thanks to opendiagram behaviour in gmfgen)
>
> But i want to design a specific feature :
> when i am in sub diagram in my application i want to
> - let the user clicking on a port
> - display the list of the partitions connected to this ports in other
> application in an eclipse view
> - if the user selects one partition i want to open the corresponding
> diagram
>
> And this is the last step that i don't know how to realize.
> I tried to use OpenDiagramCommand or myEditorUtil.findView but in all
> case i success to open the default editor diagram (top level) and not
> the corresponding to partition (sub level)
>
> if anybody can help me ? :(




Previous Topic:button look'n feel like in rcp
Next Topic:How to reroute the connections on collapse without model change? How to ensure edges having bendpoin
Goto Forum:
  


Current Time: Tue Apr 16 20:29:23 GMT 2024

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

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

Back to the top