|Re: Find UML element in Editor [message #1290876 is a reply to message #1290861]
||Thu, 10 April 2014 14:14
| Camille Letavernier
Registered: February 2011
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)
Powered by FUDForum
. Page generated in 0.02021 seconds