use of org.csstudio.opibuilder.editparts.DisplayEditpart in project yamcs-studio by yamcs.
the class SelectParentHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
GraphicalViewer viewer = HandlerUtil.getActivePart(event).getAdapter(GraphicalViewer.class);
if (viewer == null)
return null;
ISelection currentSelection = viewer.getSelection();
if (currentSelection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection) currentSelection).getFirstElement();
if (element instanceof AbstractBaseEditPart && !(element instanceof DisplayEditpart)) {
if (((AbstractBaseEditPart) element).getParent().isSelectable())
((AbstractBaseEditPart) element).getViewer().select(((AbstractBaseEditPart) element).getParent());
else
ConsoleUtil.writeWarning("Parent of the selected widget is unselectable. Its grandparent may be locked.");
}
}
return null;
}
Aggregations