Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » How to get an element with a click event on Papyrus
How to get an element with a click event on Papyrus [message #1833237] Wed, 07 October 2020 12:23 Go to next message
Yasin Gül is currently offline Yasin GülFriend
Messages: 10
Registered: September 2020
Junior Member
Hi guys,

I need the method that pass me the element with an click event in the diagram. I cannot find it in the source code of Papyrus. Anyone an idea?

[Updated on: Wed, 07 October 2020 12:24]

Report message to a moderator

Re: How to get an element with a click event on Papyrus [message #1833270 is a reply to message #1833237] Thu, 08 October 2020 09:30 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 281
Registered: March 2011
Location: Paris Saclay, France
Senior Member
What is quite often used in Papyrus is a context menu entry that performs an action with the currently selected element. The class EMFHelper (in oep.infra.emf.utils) is used to convert a selection either in the model explorer or in a diagram to an EObject. The selection itself can be obtained via the selection service, see below.

Ansgar

IStructuredSelection selection = (IStructuredSelection) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();

if (selection != null) {
    selectedEObject = EMFHelper.getEObject(selection.getFirstElement());
}
Re: How to get an element with a click event on Papyrus [message #1833320 is a reply to message #1833270] Fri, 09 October 2020 06:17 Go to previous message
Yasin Gül is currently offline Yasin GülFriend
Messages: 10
Registered: September 2020
Junior Member
Thank you Ansgar!
Previous Topic:Attributes on a stereotype
Next Topic:New major Release Papyrus 5.0 for 2020.12 release train
Goto Forum:
  


Current Time: Thu Jan 21 08:41:35 GMT 2021

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

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

Back to the top