Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » How to retrieve the current package?
How to retrieve the current package? [message #518604] Thu, 04 March 2010 15:42 Go to next message
Itamar is currently offline ItamarFriend
Messages: 39
Registered: November 2009
Member
Hello !

I am trying to create a new view in Eclipse that - like the Outline view - is sensitive to the current selection, but should analyze elements in a UML class diagram.

I managed to register a new ISelectionListener to catch any SelectionChangeEvent that the UML editor publishes.

I can get the publisher (an instance of org.eclipse.uml2.diagram.clazz.part.UMLDiagramEditor), and the published selection (a StructuredSelection containing instances of org.eclipse.uml2.diagram.clazz.edit.parts.*).

However, I cannot find any way to retrieve the currently-edited package (an instance of org.eclipse.uml2.uml.* ?).

I'd appreciate any help Smile
Re: How to retrieve the current package? [message #523187 is a reply to message #518604] Thu, 25 March 2010 13:13 Go to previous message
Itamar is currently offline ItamarFriend
Messages: 39
Registered: November 2009
Member
Well, I found the answer myself.

In a nutshell - use getAdapter(Element.class) on the selected objects, and then use getNearestPackage() to get their owning package.

In a tutorial - https://svn.cs.bgu.ac.il/trac/benzaita/wiki/HowTo_GetSelecte dUMLElement
Re: How to retrieve the current package? [message #625588 is a reply to message #518604] Thu, 25 March 2010 13:13 Go to previous message
Itamar is currently offline ItamarFriend
Messages: 39
Registered: November 2009
Member
Well, I found the answer myself.

In a nutshell - use getAdapter(Element.class) on the selected objects, and then use getNearestPackage() to get their owning package.

In a tutorial - https://svn.cs.bgu.ac.il/trac/benzaita/wiki/HowTo_GetSelecte dUMLElement
Previous Topic:Stereotype in Sequence diagram not displayed
Next Topic:UML2Tools for EMF 2.6/Eclipse 3.6?
Goto Forum:
  


Current Time: Thu Apr 25 08:57:13 GMT 2024

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

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

Back to the top