use of org.csstudio.display.builder.editor.rcp.actions.CreateGroupAction in project org.csstudio.display.builder by kasemir.
the class DisplayEditorPart method createContextMenu.
private Menu createContextMenu(final Control parent) {
final MenuManager mm = new MenuManager();
final Action execute = new ExecuteDisplayAction(this);
final MenuManager morph = new MorphWidgetMenuSupport(editor).getMenuManager();
final ImageDescriptor icon = AbstractUIPlugin.imageDescriptorFromPlugin(ModelPlugin.ID, "icons/display.png");
final Action perspective = new OpenPerspectiveAction(icon, Messages.OpenEditorPerspective, EditorPerspective.ID);
final Action reload = new ReloadDisplayAction(this);
mm.setRemoveAllWhenShown(true);
mm.addMenuListener(manager -> {
manager.add(execute);
final List<Widget> selection = editor.getWidgetSelectionHandler().getSelection();
if (!selection.isEmpty()) {
if (selection.size() >= 1)
manager.add(new CreateGroupAction(editor, selection));
if (selection.size() == 1 && selection.get(0) instanceof GroupWidget)
manager.add(new RemoveGroupAction(editor, (GroupWidget) selection.get(0)));
if (selection.size() == 1 && selection.get(0) instanceof EmbeddedDisplayWidget)
manager.add(new EditEmbeddedDisplayAction((EmbeddedDisplayWidget) selection.get(0)));
manager.add(morph);
}
manager.add(reload);
final DisplayModel model = editor.getModel();
if (model != null && !model.isClassModel()) {
manager.add(new ReloadClassesAction(this));
if (selection.isEmpty())
manager.add(new SetDisplaySize(editor));
}
manager.add(perspective);
});
return mm.createContextMenu(parent);
}
Aggregations