Search in sources :

Example 1 with ActionContext

use of org.eclipse.ui.actions.ActionContext in project tdi-studio-se by Talend.

the class JobHierarchyViewPart method fillJobViewerContextMenu.

private void fillJobViewerContextMenu(JobHierarchyViewer viewer, IMenuManager menu) {
    // viewer entries
    // ISelection selection = viewer.getSelection();
    // if (focusOnSelectionAction.canActionBeAdded())
    // menu.appendToGroup(GROUP_FOCUS, focusOnSelectionAction);
    // menu.appendToGroup(GROUP_FOCUS, fFocusOnTypeAction);
    menu.add(focusOnTypeAction);
    fActionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
    fActionGroups.fillContextMenu(menu);
    fActionGroups.setContext(null);
}
Also used : ActionContext(org.eclipse.ui.actions.ActionContext)

Example 2 with ActionContext

use of org.eclipse.ui.actions.ActionContext in project eclipse.platform.text by eclipse.

the class SearchResultViewer method fillContextMenu.

void fillContextMenu(IMenuManager menu) {
    ISelection selection = getSelection();
    if (fActionGroup != null) {
        ActionContext context = new ActionContext(selection);
        context.setInput(getInput());
        fActionGroup.setContext(context);
        fActionGroup.fillContextMenu(menu);
        fActionGroup.setContext(null);
    }
    if (fContextMenuContributor != null)
        fContextMenuContributor.fill(menu, this);
    if (!selection.isEmpty()) {
        menu.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, fCopyToClipboardAction);
        menu.appendToGroup(IContextMenuConstants.GROUP_GOTO, fGotoMarkerActionProxy);
        if (enableRemoveMatchMenuItem())
            menu.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, new RemoveMatchAction(this));
        menu.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, new RemoveResultAction(this, true));
        if (isPotentialMatchSelected())
            menu.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, new RemovePotentialMatchesAction(fOuterPart.getViewSite()));
    }
    // If we have elements
    if (getItemCount() > 0)
        menu.appendToGroup(IContextMenuConstants.GROUP_REMOVE_MATCHES, new RemoveAllResultsAction());
    menu.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, fSearchAgainAction);
    if (getItemCount() > 0) {
        fSortDropDownAction = fSortDropDownAction.renew();
        if (fSortDropDownAction.getSorterCount() > 1)
            menu.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, fSortDropDownAction);
    }
}
Also used : ISelection(org.eclipse.jface.viewers.ISelection) ActionContext(org.eclipse.ui.actions.ActionContext)

Example 3 with ActionContext

use of org.eclipse.ui.actions.ActionContext in project erlide_eclipse by erlang.

the class ErlangEditor method editorContextMenuAboutToShow.

@Override
protected void editorContextMenuAboutToShow(final IMenuManager menu) {
    super.editorContextMenuAboutToShow(menu);
    if (SystemConfiguration.getInstance().isClearCacheAvailable()) {
        setupClearCacheActions();
        menu.prependToGroup(ITextEditorActionConstants.GROUP_SETTINGS, clearCacheAction);
        menu.prependToGroup(ITextEditorActionConstants.GROUP_SETTINGS, clearAllCachesAction);
    }
    menu.prependToGroup(ITextEditorActionConstants.GROUP_OPEN, compileAction);
    menu.prependToGroup(ITextEditorActionConstants.GROUP_OPEN, fShowOutline);
    addCommonActions(menu);
    menu.appendToGroup(ITextEditorActionConstants.GROUP_FIND, callhierarchy);
    final ActionContext context = new ActionContext(getSelectionProvider().getSelection());
    fContextMenuGroup.setContext(context);
    fContextMenuGroup.fillContextMenu(menu);
    fContextMenuGroup.setContext(null);
}
Also used : ActionContext(org.eclipse.ui.actions.ActionContext)

Example 4 with ActionContext

use of org.eclipse.ui.actions.ActionContext in project erlide_eclipse by erlang.

the class ErlangSearchResultPage method fillContextMenu.

@Override
protected void fillContextMenu(final IMenuManager mgr) {
    super.fillContextMenu(mgr);
    addSortActions(mgr);
    fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
    fActionGroup.fillContextMenu(mgr);
}
Also used : ActionContext(org.eclipse.ui.actions.ActionContext)

Example 5 with ActionContext

use of org.eclipse.ui.actions.ActionContext in project erlide_eclipse by erlang.

the class ImplementorsSearchGroup method addWorkingSetAction.

private void addWorkingSetAction(final IWorkingSet[] workingSets, final IMenuManager manager) {
    FindAction action;
    if (fEditor != null) {
        action = new WorkingSetFindAction(fEditor, new FindReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets));
    } else {
        action = new WorkingSetFindAction(fSite, new FindReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets));
    }
    final ActionContext context = getContext();
    if (context != null) {
        action.update(context.getSelection());
    }
    addAction(action, manager);
}
Also used : ActionContext(org.eclipse.ui.actions.ActionContext)

Aggregations

ActionContext (org.eclipse.ui.actions.ActionContext)22 ISelection (org.eclipse.jface.viewers.ISelection)5 IMenuManager (org.eclipse.jface.action.IMenuManager)4 MenuManager (org.eclipse.jface.action.MenuManager)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 IMenuListener (org.eclipse.jface.action.IMenuListener)3 TreeSelection (org.eclipse.jface.viewers.TreeSelection)3 Separator (org.eclipse.jface.action.Separator)2 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)1 Inject (com.google.inject.Inject)1 Arrays (java.util.Arrays)1 Iterator (java.util.Iterator)1 List (java.util.List)1 IProject (org.eclipse.core.resources.IProject)1 IContextMenuConstants (org.eclipse.jdt.ui.IContextMenuConstants)1 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 ColumnViewer (org.eclipse.jface.viewers.ColumnViewer)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1