Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Find UML element in Editor
Find UML element in Editor [message #1289700] Wed, 09 April 2014 15:05 Go to next message
Vinicius Pereira is currently offline Vinicius PereiraFriend
Messages: 50
Registered: March 2014
Member
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 #1289716 is a reply to message #1289700] Wed, 09 April 2014 15:23 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 926
Registered: February 2011
Senior Member
Hi,

The OpenElementService can help (Not tested, but we use that in the Search and a few other components):

IMultiDiagramEditor papyrusEditor = ...;
ServicesRegistry registry = papyrusEditor.getServicesRegistry();
OpenElementService openElement = registry.getService(OpenElementService.class);
openElement.openSemanticElement(myobject);


Not that, if a semantic element is represented in more than one page (diagrams), all these pages will be opened

Regards,
Camille


Camille Letavernier
Re: Find UML element in Editor [message #1290861 is a reply to message #1289716] Thu, 10 April 2014 13:57 Go to previous messageGo to next message
Vinicius Pereira is currently offline Vinicius PereiraFriend
Messages: 50
Registered: March 2014
Member
Thanks!!! Works Smile


I could create another topic... but now that I have the UML element in the Editor, if I want to change its appearance (e.g. color) where are the attributes?

And I see that install View Stylesheets (aditional components), then create and apply CSS... Can I use this to change appearance of one State, then another one... its better?

Thank you
Re: Find UML element in Editor [message #1290876 is a reply to message #1290861] Thu, 10 April 2014 14:14 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 926
Registered: February 2011
Senior Member
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


Camille Letavernier
Previous Topic:Accessing a element in Model Explorer
Next Topic:InstancespecificationLink display Stereotype
Goto Forum:
  


Current Time: Sat Jul 11 06:11:25 GMT 2020

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

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

Back to the top