Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » get UML2 Element from its EditPart
get UML2 Element from its EditPart [message #704029] Thu, 28 July 2011 07:43 Go to next message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
Hi,

I used to create plug-ins for Papyrus 1. When I wanted to get the UML2 Element pointed by the cursor, I just had to get the current selection from eclipse, a structuredSelection, which was containing an EditPart. Then, to retrieve the highlighted UML2 Element from this EditPart, there was a very comfortable method : getUML2Element().
I'm currently trying to migrate my plug-ins to Papyrus MDT, and I still can get the EditPart from the current Selection (although it is now called OperationForClassEditPart), but I can't find any method to get the corresponding UML2 Element from it.
Is there someone who could help me do that ?

Thanks !

[Updated on: Thu, 28 July 2011 11:18]

Report message to a moderator

Re: EditPart to UML2 Element [message #704190 is a reply to message #704029] Thu, 28 July 2011 11:14 Go to previous messageGo to next message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
Well, I found a solution. Don't know if it's a viable one tho, but it does the job.

On Papyrus 1, with OperationEditPart, we had a getUML2element() method.
On Papyrus MDT, with OperationForClassEditPart, we have a getAdapter(Class key) method. So, to get the UML2 element from its editPart, just call the method with "Element.class" as a key. Works fine.

Re: get UML2 Element from its EditPart [message #705690 is a reply to message #704029] Sat, 30 July 2011 07:11 Go to previous message
A Vernotte is currently offline A VernotteFriend
Messages: 21
Registered: June 2011
Junior Member
It seems it was the correct solution, as it is also recommended in the papyrus developper guide. Sorry for useless posting...
Previous Topic:Papyrus and proprietary metamodel
Next Topic:Papyrus installation bugs.
Goto Forum:
  


Current Time: Thu Apr 25 21:11:55 GMT 2024

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

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

Back to the top