java - Get the selected model element in GMF editor -


i have gmf editor different elements on model. once select particular model element, how in handler ? currently, fetch elements present, using following code fragment:

palladiocomponentmodeldiagrameditor diag = (palladiocomponentmodeldiagrameditor)handlerutil.getactiveeditorchecked(event); final list children = diag.getdiagrameditpart().getchildren(); 

i quite new gmf , hence question.

not 100% sure understand question. if want find element that's selected in diagram editor, can use selectionprovider, example this:

iselectionprovider selprovider = diagrameditor.geteditorsite().getselectionprovider(); if (selprovider.getselection() instanceof istructuredselection) {     istructuredselection selection = (istructuredselection) selprovider.getselection();     object selected = selection.getfirstelement();     if (selected instanceof igraphicaleditpart) {         igraphicaleditpart editpart = (igraphicaleditpart) selected;         eobject eobject = ((view) editpart.getmodel()).getelement();         // stuff selected eobject     } } 

Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -