Search in sources :

Example 21 with GroupMarker

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));
}
Also used : Table(org.eclipse.swt.widgets.Table) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IMenuListener(org.eclipse.jface.action.IMenuListener) Separator(org.eclipse.jface.action.Separator)

Example 22 with GroupMarker

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

Example 23 with GroupMarker

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);
}
Also used : GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 24 with GroupMarker

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));
}
Also used : GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 25 with GroupMarker

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);
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) IMenuManager(org.eclipse.jface.action.IMenuManager) MenuManager(org.eclipse.jface.action.MenuManager) OpenWithMenu(org.eclipse.ui.actions.OpenWithMenu) GroupMarker(org.eclipse.jface.action.GroupMarker) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IMenuManager(org.eclipse.jface.action.IMenuManager)

Aggregations

GroupMarker (org.eclipse.jface.action.GroupMarker)117 Separator (org.eclipse.jface.action.Separator)93 IMenuManager (org.eclipse.jface.action.IMenuManager)44 MenuManager (org.eclipse.jface.action.MenuManager)42 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)17 IToolBarManager (org.eclipse.jface.action.IToolBarManager)12 IAction (org.eclipse.jface.action.IAction)10 IMenuListener (org.eclipse.jface.action.IMenuListener)10 Menu (org.eclipse.swt.widgets.Menu)8 Action (org.eclipse.jface.action.Action)7 ISelection (org.eclipse.jface.viewers.ISelection)5 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)4 ToolBarContributionItem (org.eclipse.jface.action.ToolBarContributionItem)4 ToolBarManager (org.eclipse.jface.action.ToolBarManager)4 Iterator (java.util.Iterator)2 AddPVAction (org.csstudio.trends.databrowser3.ui.AddPVAction)2 IFindReplaceTarget (org.eclipse.jface.text.IFindReplaceTarget)2 Point (org.eclipse.swt.graphics.Point)2 Shell (org.eclipse.swt.widgets.Shell)2