Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » opening a diagram from a resource
opening a diagram from a resource [message #223830] Wed, 01 April 2009 10:32 Go to next message
Eclipse UserFriend
Originally posted by: bmoros.um.es

Hi all,

is it possible to open a diagram editor only by knowing a resource? I will
try to explain the problem ...

In my ecore metamodel the Artifact class is linked to an EObject (element
atribute). It is a general EObject because it could be a Class, Property,
Use Case, etc., that is, it could be any of the UML elements, or any element
which belongs to another DSL. So far, when an ArtifactEditPart is selected,
I can open de model (tree editor) which the linked element belongs to as it
is explained in
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg11197.html,
but I would like to know if it could be possible to open the diagram
editor. Given an EObject I can know the resource it belongs to, but can I
know the editor used to build the model?

Thanks in advance for your time.

Best regards,
Bego
Re: opening a diagram from a resource [message #223876 is a reply to message #223830] Wed, 01 April 2009 11:59 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Begoa,

It is possible to open diagram persisted in any other EMF resource in GMF-generated
editor. If you have a reference to the corresponding domain model element
then you have to locate or create diagram and save it to disk before openning
GMF-generated editor. You can use URIEditorInput to point to any EMF resource
and this editor input will be correctly processed by GMF editor.

-----------------
Alex Shatalin
Re: opening a diagram from a resource [message #224146 is a reply to message #223876] Thu, 02 April 2009 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bmoros.um.es

Hello Alex,
thank you for your answer but I am afraid I still can not figure out how to
do it. At runtime, I only know a generic EObject which is part of a model
(class model, use case model, whatever) and this object could be anything.
In order to open the diagram editor programatically, I guess I should know
the specific diagram used to be able to create it and I don
Re: opening a diagram from a resource [message #224153 is a reply to message #224146] Thu, 02 April 2009 16:01 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Begoa,

If you are looking for a diagram containing this EObject then you have to:
1. load all diagrams you have available
2. traverse all diagram elements (Views) starting from diagram to find if
one of them is referncing this EObject
3. open diagram containing this View.

You can simplify this process by relying on particular diagram structure
orby using EMF CrossReferencer

-----------------
Alex Shatalin
Previous Topic:Label are cut off in export and printing
Next Topic:Reconcile gmfmap from changed ecore file
Goto Forum:
  


Current Time: Sat Apr 27 02:19:57 GMT 2024

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

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

Back to the top