Search in sources :

Example 1 with AddPVAction

use of org.csstudio.trends.databrowser3.ui.AddPVAction 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 AddPVAction

use of org.csstudio.trends.databrowser3.ui.AddPVAction in project org.csstudio.display.builder by kasemir.

the class DataBrowserPropertySheetPage method createTracesMenuAndToolbarActions.

/**
 * Create context menu and toolbar actions for the traces table
 */
private void createTracesMenuAndToolbarActions() {
    final MenuManager menu = new MenuManager();
    menu.setRemoveAllWhenShown(true);
    final Shell shell = trace_table.getControl().getShell();
    final AddPVAction add_pv = new AddPVAction(operations_manager, shell, model, false);
    final AddPVAction add_formula = new AddPVAction(operations_manager, shell, model, true);
    final EditItemsAction edit_pv = new EditItemsAction(operations_manager, shell, trace_table, model);
    final DeleteItemsAction delete_pv = new DeleteItemsAction(operations_manager, trace_table, model);
    menu.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            final PVItem[] pvs = getSelectedPVs();
            menu.add(add_pv);
            menu.add(add_formula);
            menu.add(edit_pv);
            if (pvs.length == 1)
                menu.add(new MoveItemAction(operations_manager, model, pvs[0], true));
            menu.add(delete_pv);
            if (pvs.length == 1)
                menu.add(new MoveItemAction(operations_manager, model, pvs[0], false));
            menu.add(new RemoveUnusedAxesAction(operations_manager, model));
            if (pvs.length > 0) {
                menu.add(new AddArchiveAction(operations_manager, shell, pvs));
                menu.add(new UseDefaultArchivesAction(operations_manager, pvs));
            }
            menu.add(new Separator());
            menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        }
    });
    final Table table = trace_table.getTable();
    table.setMenu(menu.createContextMenu(table));
    // Allow object contributions based on selected items
    getSite().registerContextMenu(menu.getId(), menu, trace_table);
    // Add to tool bar
    final IToolBarManager toolbar = getSite().getActionBars().getToolBarManager();
    toolbar.add(add_pv);
    toolbar.add(add_formula);
}
Also used : Table(org.eclipse.swt.widgets.Table) IMenuListener(org.eclipse.jface.action.IMenuListener) Shell(org.eclipse.swt.widgets.Shell) IToolBarManager(org.eclipse.jface.action.IToolBarManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) AddPVAction(org.csstudio.trends.databrowser3.ui.AddPVAction) GroupMarker(org.eclipse.jface.action.GroupMarker) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Aggregations

AddPVAction (org.csstudio.trends.databrowser3.ui.AddPVAction)2 GroupMarker (org.eclipse.jface.action.GroupMarker)2 Separator (org.eclipse.jface.action.Separator)2 Shell (org.eclipse.swt.widgets.Shell)2 OpenViewAction (org.csstudio.apputil.ui.workbench.OpenViewAction)1 UndoableActionManager (org.csstudio.display.builder.util.undo.UndoableActionManager)1 Activator (org.csstudio.trends.databrowser3.Activator)1 RemoveUnusedAxesAction (org.csstudio.trends.databrowser3.propsheet.RemoveUnusedAxesAction)1 RefreshAction (org.csstudio.trends.databrowser3.ui.RefreshAction)1 OpenPerspectiveAction (org.csstudio.ui.util.perspective.OpenPerspectiveAction)1 IAction (org.eclipse.jface.action.IAction)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Table (org.eclipse.swt.widgets.Table)1 PartInitException (org.eclipse.ui.PartInitException)1