use of org.eclipse.jface.action.GroupMarker in project org.csstudio.display.builder by kasemir.
the class DataBrowserPropertySheetPage method createArchiveMenu.
/**
* Create context menu for the archive table,
* which depends on the currently selected PVs
*/
private void createArchiveMenu() {
// Create dynamic context menu, content changes depending on selections
final MenuManager menu = new MenuManager();
menu.setRemoveAllWhenShown(true);
menu.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
// Determine selected PV Items
final PVItem[] pvs = getSelectedPVs();
if (pvs.length <= 0)
return;
menu.add(new AddArchiveAction(operations_manager, control.getShell(), pvs));
menu.add(new UseDefaultArchivesAction(operations_manager, pvs));
// Only allow removal of archives from single PV
if (pvs.length == 1) {
// Determine selected archives
final IStructuredSelection arch_sel = (IStructuredSelection) archive_table.getSelection();
if (!arch_sel.isEmpty()) {
final Object[] objects = arch_sel.toArray();
final ArchiveDataSource[] archives = new ArchiveDataSource[objects.length];
for (int i = 0; i < archives.length; i++) archives[i] = (ArchiveDataSource) objects[i];
menu.add(new DeleteArchiveAction(operations_manager, pvs[0], archives));
}
}
menu.add(new Separator());
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}
});
final Table table = archive_table.getTable();
table.setMenu(menu.createContextMenu(table));
}
use of org.eclipse.jface.action.GroupMarker 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);
}
use of org.eclipse.jface.action.GroupMarker in project mylyn.docs by eclipse.
the class MarkupEditorOutline method contextMenuAboutToShow.
protected void contextMenuAboutToShow(IMenuManager menuManager) {
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_UNDO));
menuManager.add(new GroupMarker(ITextEditorActionConstants.GROUP_SAVE));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_COPY));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_PRINT));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_FIND));
menuManager.add(new Separator(IWorkbenchActionConstants.GROUP_ADD));
menuManager.add(new Separator(IWorkbenchActionConstants.GROUP_SHOW_IN));
menuManager.add(new Separator(IWorkbenchActionConstants.GROUP_REORGANIZE));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_REST));
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
addAction(menuManager, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.UNDO);
addAction(menuManager, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.REDO);
addAction(menuManager, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.REVERT);
addAction(menuManager, ITextEditorActionConstants.GROUP_SAVE, ITextEditorActionConstants.SAVE);
addAction(menuManager, ITextEditorActionConstants.GROUP_FIND, ITextEditorActionConstants.FIND);
addAction(menuManager, ITextEditorActionConstants.GROUP_PRINT, ITextEditorActionConstants.PRINT);
}
use of org.eclipse.jface.action.GroupMarker in project mylyn.docs by eclipse.
the class DefaultWikiTextSourceEditorOutline method contextMenuAboutToShow.
private void contextMenuAboutToShow(IMenuManager menuManager) {
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_UNDO));
menuManager.add(new GroupMarker(ITextEditorActionConstants.GROUP_SAVE));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_COPY));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_PRINT));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_FIND));
menuManager.add(new Separator(IWorkbenchActionConstants.GROUP_ADD));
menuManager.add(new Separator(IWorkbenchActionConstants.GROUP_SHOW_IN));
menuManager.add(new Separator(IWorkbenchActionConstants.GROUP_REORGANIZE));
menuManager.add(new Separator(ITextEditorActionConstants.GROUP_REST));
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
use of org.eclipse.jface.action.GroupMarker in project titan.EclipsePlug-ins by eclipse.
the class LogFileActionProvider method addOpenWithMenu.
private void addOpenWithMenu(final IMenuManager aMenu) {
final IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
if (selection == null || selection.size() != 1 || !(selection.getFirstElement() instanceof IFile)) {
return;
}
final IFile file = (IFile) selection.getFirstElement();
IMenuManager submenu = new MenuManager("Open with", ICommonMenuConstants.GROUP_OPEN_WITH);
submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_TOP));
submenu.add(new OpenWithMenu(viewSite.getPage(), file));
submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_ADDITIONS));
if (submenu.getItems().length > 2 && submenu.isEnabled()) {
aMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN_WITH, submenu);
}
}
Aggregations