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()));
}
}
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);
}
Aggregations