Search in sources :

Example 6 with OpenWithMenu

use of org.eclipse.ui.actions.OpenWithMenu in project egit by eclipse.

the class RepositoriesViewActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    ISelection s = getContext().getSelection();
    if (s.isEmpty() || !(s instanceof IStructuredSelection))
        return;
    IStructuredSelection selection = (IStructuredSelection) s;
    ICommonViewerWorkbenchSite site = (ICommonViewerWorkbenchSite) getActionSite().getViewSite();
    if (shouldAddShowInMenu(selection)) {
        MenuManager showInSubMenu = UIUtils.createShowInMenu(site.getWorkbenchWindow());
        menu.appendToGroup(ICommonMenuConstants.GROUP_SHOW, showInSubMenu);
    }
    IFile file = getSelectedFile(selection);
    if (file != null) {
        MenuManager openWithSubMenu = new MenuManager(UIText.RepositoriesViewActionProvider_OpenWithMenu);
        openWithSubMenu.add(new OpenWithMenu(site.getPage(), file));
        menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openWithSubMenu);
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) ISelection(org.eclipse.jface.viewers.ISelection) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) OpenWithMenu(org.eclipse.ui.actions.OpenWithMenu) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICommonViewerWorkbenchSite(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)

Aggregations

MenuManager (org.eclipse.jface.action.MenuManager)6 OpenWithMenu (org.eclipse.ui.actions.OpenWithMenu)6 IFile (org.eclipse.core.resources.IFile)5 IMenuManager (org.eclipse.jface.action.IMenuManager)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 ISelection (org.eclipse.jface.viewers.ISelection)3 IAdaptable (org.eclipse.core.runtime.IAdaptable)2 Separator (org.eclipse.jface.action.Separator)2 File (java.io.File)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 GroupMarker (org.eclipse.jface.action.GroupMarker)1 IAction (org.eclipse.jface.action.IAction)1 ITextSelection (org.eclipse.jface.text.ITextSelection)1 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 CellEditor (org.eclipse.jface.viewers.CellEditor)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1