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

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

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