Search in sources :

Example 1 with OpenPerspectiveAction

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()));
    }
}
Also used : OpenPerspectiveAction(org.csstudio.ui.util.perspective.OpenPerspectiveAction) IAction(org.eclipse.jface.action.IAction) OpenViewAction(org.csstudio.apputil.ui.workbench.OpenViewAction) PartInitException(org.eclipse.ui.PartInitException) Shell(org.eclipse.swt.widgets.Shell) RemoveUnusedAxesAction(org.csstudio.trends.databrowser3.propsheet.RemoveUnusedAxesAction) RefreshAction(org.csstudio.trends.databrowser3.ui.RefreshAction) Activator(org.csstudio.trends.databrowser3.Activator) UndoableActionManager(org.csstudio.display.builder.util.undo.UndoableActionManager) AddPVAction(org.csstudio.trends.databrowser3.ui.AddPVAction) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 2 with OpenPerspectiveAction

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);
}
Also used : OpenPerspectiveAction(org.csstudio.ui.util.perspective.OpenPerspectiveAction) IAction(org.eclipse.jface.action.IAction) RedoAction(org.csstudio.display.builder.editor.rcp.actions.RedoAction) CutDeleteAction(org.csstudio.display.builder.editor.rcp.actions.CutDeleteAction) PasteAction(org.csstudio.display.builder.editor.rcp.actions.PasteAction) OpenPerspectiveAction(org.csstudio.ui.util.perspective.OpenPerspectiveAction) ReloadDisplayAction(org.csstudio.display.builder.editor.rcp.actions.ReloadDisplayAction) RemoveGroupAction(org.csstudio.display.builder.editor.rcp.actions.RemoveGroupAction) ExecuteDisplayAction(org.csstudio.display.builder.editor.rcp.actions.ExecuteDisplayAction) CreateGroupAction(org.csstudio.display.builder.editor.rcp.actions.CreateGroupAction) SelectAllAction(org.csstudio.display.builder.editor.rcp.actions.SelectAllAction) CopyAction(org.csstudio.display.builder.editor.rcp.actions.CopyAction) Action(org.eclipse.jface.action.Action) ReloadClassesAction(org.csstudio.display.builder.editor.rcp.actions.ReloadClassesAction) UndoAction(org.csstudio.display.builder.editor.rcp.actions.UndoAction) CreateGroupAction(org.csstudio.display.builder.editor.rcp.actions.CreateGroupAction) GroupWidget(org.csstudio.display.builder.model.widgets.GroupWidget) EmbeddedDisplayWidget(org.csstudio.display.builder.model.widgets.EmbeddedDisplayWidget) Widget(org.csstudio.display.builder.model.Widget) ReloadClassesAction(org.csstudio.display.builder.editor.rcp.actions.ReloadClassesAction) ReloadDisplayAction(org.csstudio.display.builder.editor.rcp.actions.ReloadDisplayAction) ExecuteDisplayAction(org.csstudio.display.builder.editor.rcp.actions.ExecuteDisplayAction) DisplayModel(org.csstudio.display.builder.model.DisplayModel) EmbeddedDisplayWidget(org.csstudio.display.builder.model.widgets.EmbeddedDisplayWidget) MenuManager(org.eclipse.jface.action.MenuManager) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) RemoveGroupAction(org.csstudio.display.builder.editor.rcp.actions.RemoveGroupAction) GroupWidget(org.csstudio.display.builder.model.widgets.GroupWidget)

Aggregations

OpenPerspectiveAction (org.csstudio.ui.util.perspective.OpenPerspectiveAction)2 IAction (org.eclipse.jface.action.IAction)2 OpenViewAction (org.csstudio.apputil.ui.workbench.OpenViewAction)1 CopyAction (org.csstudio.display.builder.editor.rcp.actions.CopyAction)1 CreateGroupAction (org.csstudio.display.builder.editor.rcp.actions.CreateGroupAction)1 CutDeleteAction (org.csstudio.display.builder.editor.rcp.actions.CutDeleteAction)1 ExecuteDisplayAction (org.csstudio.display.builder.editor.rcp.actions.ExecuteDisplayAction)1 PasteAction (org.csstudio.display.builder.editor.rcp.actions.PasteAction)1 RedoAction (org.csstudio.display.builder.editor.rcp.actions.RedoAction)1 ReloadClassesAction (org.csstudio.display.builder.editor.rcp.actions.ReloadClassesAction)1 ReloadDisplayAction (org.csstudio.display.builder.editor.rcp.actions.ReloadDisplayAction)1 RemoveGroupAction (org.csstudio.display.builder.editor.rcp.actions.RemoveGroupAction)1 SelectAllAction (org.csstudio.display.builder.editor.rcp.actions.SelectAllAction)1 UndoAction (org.csstudio.display.builder.editor.rcp.actions.UndoAction)1 DisplayModel (org.csstudio.display.builder.model.DisplayModel)1 Widget (org.csstudio.display.builder.model.Widget)1 EmbeddedDisplayWidget (org.csstudio.display.builder.model.widgets.EmbeddedDisplayWidget)1 GroupWidget (org.csstudio.display.builder.model.widgets.GroupWidget)1 UndoableActionManager (org.csstudio.display.builder.util.undo.UndoableActionManager)1 Activator (org.csstudio.trends.databrowser3.Activator)1