use of org.csstudio.ui.util.perspective.OpenPerspectiveAction in project org.csstudio.display.builder by kasemir.
the class DataBrowserEditor method fillContextMenu.
/**
* Dynamically fill context menu
* @param manager
*/
private void fillContextMenu(final IMenuManager manager) {
final Activator activator = Activator.getDefault();
final Shell shell = getSite().getShell();
final UndoableActionManager op_manager = plot.getPlot().getUndoableActionManager();
manager.add(toggle_toolbar);
manager.add(toggle_legend);
manager.add(new Separator());
manager.add(new AddPVAction(op_manager, shell, model, false));
manager.add(new AddPVAction(op_manager, shell, model, true));
final boolean is_rcp = SingleSourcePlugin.getUIHelper().getUI() == UI.RCP;
if (is_rcp) {
try {
for (IAction imp : SampleImporters.createImportActions(op_manager, shell, model)) manager.add(imp);
} catch (Exception ex) {
ExceptionDetailsErrorDialog.openError(shell, Messages.Error, ex);
}
}
manager.add(new RemoveUnusedAxesAction(op_manager, model));
manager.add(new RefreshAction(controller));
manager.add(new Separator());
manager.add(new OpenPropertiesAction());
manager.add(new OpenViewAction(SearchView.ID, Messages.OpenSearchView, activator.getImageDescriptor("icons/search.gif")));
if (is_rcp)
manager.add(new OpenViewAction(ExportView.ID, Messages.OpenExportView, activator.getImageDescriptor("icons/export.png")));
manager.add(new OpenViewAction(SampleView.ID, Messages.InspectSamples, activator.getImageDescriptor("icons/inspect.gif")));
manager.add(new OpenPerspectiveAction(activator.getImageDescriptor("icons/databrowser.png"), Messages.OpenDataBrowserPerspective, Perspective.ID));
manager.add(new OpenViewAction(WaveformView.ID, Messages.OpenWaveformView, activator.getImageDescriptor("icons/wavesample.gif")));
manager.add(new Separator());
manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
if (is_rcp) {
manager.add(new Separator());
manager.add(snapshot);
if (EMailSender.isEmailSupported())
manager.add(new SendEMailAction(shell, plot.getPlot()));
manager.add(new PrintAction(shell, plot.getPlot()));
if (SendToElogAction.isElogAvailable())
manager.add(new SendToElogAction(shell, plot.getPlot()));
}
}
use of org.csstudio.ui.util.perspective.OpenPerspectiveAction 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