Find UML element in Editor [message #1289700] |
Wed, 09 April 2014 11:05  |
Eclipse User |
|
|
|
Hi everyone,
If in my editor I have N tabs (e.g. one with class diagram, two with one sequence diagram each and two with one state diagram each) and I need to find a UML element by its ID (XMI ID) how I can search and find between the tabs?
For example, the first ID is a State, the second a Transition, the third a class, forth a lifeline... and go on.
I can access the active tab, but I don't know how search between the active and the others.
thanks
|
|
|
|
|
Re: Find UML element in Editor [message #1290876 is a reply to message #1290861] |
Thu, 10 April 2014 10:14  |
Eclipse User |
|
|
|
Hi,
It depends on what you need. If the color needs to be changed "forever" (Stored, and still recolored next time you open the model), then you need to modify the FillStyle of the graphical element (e.g. Shape#setFillColor)
If you prefer dynamic colors (Volatile), then you should look at stylesheets (And maybe "events", aka pseudo-states).
The pseudostate/event framework is not really supported yet, so that's mostly internal classes (GMFElementAdapter#addStates(Set<String>), GMFElementAdapter#removeStates(Set<String>))
There's also an extension point for providing your own implementation of the ElementAdapter in Papyrus, but there's no guarantee of API stability on it: org.eclipse.papyrus.infra.gmfdiag.css.domElementAdapter. Especially, I'm planning to provide a contribution-based implementation of the DOM Adapter, which would allow an heterogeneous extension.
So, you currently have two options for the CSS:
1) Retrieve the DOM ElementAdapter associated to the element, and use addStates()
2) Override the DOM ElementAdapter, and override the isPseudoInstanceOf() method
For 1), have a look at the EventListenerEditPolicy in oep.infra.gmfdiag.css (Experimental)
For 2), have a look at GMFUMLElementAdapter in oep.uml.diagram.css (It doesn't override isPseudoInstanceOf(), but it could)
Regards,
Camille
|
|
|
Powered by
FUDForum. Page generated in 0.03796 seconds