|
|
Re: Synchronizing different diagrams to show parts of the same model [message #491930 is a reply to message #491486] |
Fri, 16 October 2009 14:56 |
TL Messages: 22 Registered: July 2009 |
Junior Member |
|
|
Hi,
Alex thank you for the hint in the right direction. In my
???DiagramUpdater I found the method, which is called at the creation of
the diagram and at other events that occur and cause the needed for
updating the diagram (btw. Is there a list when the ???DiagramUpdater
methods are called?)
What I am currently tiring to do is to create an element (both semantic
and notational element and also an EditPart for it so it will show on
the diagram). I tried several ways, which I found in the newsgroups, but
could not get this task done. Could someone please help me?
Here are the paths that I tried:
1. The usual one where you create a CreateViewAndElementRequest or
CreateViewRequest and then try to execute it with a command. The problem
is that I don't know how to get the command, since I cannot get an
EditPart. As you probably know the ???DiagramUpdater methods only get a
View object as parameter (this is actually the instance of a Diagram
class), so there is no EditPart object on which to call the
..getCommand(myRequest) method. Any idea what to do? Can I somehow get
the DiagramEditPart or should I take another way?
2. The other method suggested by some post is to create only the
semantic elements. Supposedly the notational element and the appropriate
EditPart should be created by the CanonicalEditPolicy. Here is the code:
---------------
ProcgraphFactory factory = ProcgraphFactory.eINSTANCE;
State myState = factory.createState();
myState.setName("test 1");
VirtualDependence container = (VirtualDependence) view.getElement();
container.getStates().add(myState);
---------------
This does not work and I get the error "Cannot modify resource set
without a write transaction", which is perfectly logical. Should I try
to do this on the EMF level also with a request and command? I think
this path is not preferable since I have to adjust the diagram location
of programmatically the created element and I don't know how I would to
this when I only create a semantic element.
Hopefully the questions aren’t too trivial. Unfortunately I am still a
beginner in the GMF runtime framework. Thank you for any potential
suggestions.
Tomaz L.
Alex Shatalin:
> Hello T,
>
>> I learned about the possibility to share the EditingDomain, which is
>> described in http://wiki.eclipse.org/GMF_Tips and in some other posts.
>> But this actually only allows to share the semantical information
>> (domain model instances) across diagrams. Since our modeling language
> Right. And you'll have all the diagrams loaded into the same
> ResourceSet, so you'll be able to simply listen for EMF notifications
> and update current diagram state in accordance.
> BTW, if you think some diagram element properties should be shared with
> another diagrams then you can think of moving these properties into the
> domain model and modify generated code in order to use domain model
> properties to store visual attributes of diagram elements..
>
>> easiest one) to listen to the changes at the elements of the
>> notational
>> model in one diagram and then programmatically propagate them to the
>> other diagram (through reading the properties of elements from the
>> first
>> diagram and then setting the properties of the elements from the
>> second
>> diagram). Could anyone comment on this solution? And how to accomplish
> Yes, this is the first way to implement it and I suggest you starting
> with it. The second step as i mentioned above will be to use domain
> model element properties for storing/loading such diagram element
> properties. In this case you'll simply modify generated EditParts to
> load/save/listen domain model element properties.
>
> -----------------
> Alex Shatalin
>
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03574 seconds