org.eclipse.ui.actions.OpenWithMenu#org.eclipse.search.ui.IContextMenuConstants源码实例Demo

下面列出了org.eclipse.ui.actions.OpenWithMenu#org.eclipse.search.ui.IContextMenuConstants 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: xds-ide   文件: DeclarationsSearchGroup.java
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);
	
	IMenuManager incomingMenu = menu;

	IMenuManager declarationsMenu = new MenuManager(Messages.DeclarationsSearchGroup_Declarations, IContextMenuConstants.GROUP_SEARCH); 
	
	if (editor != null){
		menu.appendToGroup(ITextEditorActionConstants.GROUP_FIND, declarationsMenu);	
	} else {
		incomingMenu.appendToGroup(IContextMenuConstants.GROUP_SEARCH, declarationsMenu);
	}
	incomingMenu = declarationsMenu;
	
	incomingMenu.add(findDeclarationsAction);
	incomingMenu.add(findDeclarationsProjectAction);
}
 
源代码2 项目: xds-ide   文件: ReferencesSearchGroup.java
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);
	
	IMenuManager incomingMenu = menu;

	IMenuManager declarationsMenu = new MenuManager(Messages.ReferencesSearchGroup_References, IContextMenuConstants.GROUP_SEARCH); 
	
	if (editor != null){
		menu.appendToGroup(ITextEditorActionConstants.GROUP_FIND, declarationsMenu);	
	} else {
		incomingMenu.appendToGroup(IContextMenuConstants.GROUP_SEARCH, declarationsMenu);
	}
	incomingMenu = declarationsMenu;
	
	incomingMenu.add(findReferencesAction);
	incomingMenu.add(findReferencesProjectAction);
}
 
源代码3 项目: xds-ide   文件: OpenEditorActionGroup.java
private void addOpenWithMenu(IMenuManager menu) {
	ISelection selection= getContext().getSelection();
	if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
		return;
	IStructuredSelection ss= (IStructuredSelection)selection;
	if (ss.size() != 1)
		return;

	Object o= ss.getFirstElement();
	if (!(o instanceof IAdaptable))
		return;

	IAdaptable element= (IAdaptable)o;
	Object resource= element.getAdapter(IResource.class);
	if (!(resource instanceof IFile))
		return;

	// Create a menu.
	IMenuManager submenu= new MenuManager("Open With");
	submenu.add(new OpenWithMenu(fSite.getPage(), (IFile) resource));

	// Add the submenu.
	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
 
@Override
public void init(IPageSite site) {
	super.init(site);
	IMenuManager menuManager = site.getActionBars().getMenuManager();
	menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator(GROUP_FILTERING));
	fActionGroup.fillActionBars(site.getActionBars());
	menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action(SearchMessages.JavaSearchResultPage_preferences_label) {
		@Override
		public void run() {
			String pageId= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$
			String[] displayedPages= { pageId,
					"org.eclipse.ui.editors.preferencePages.Annotations", //$NON-NLS-1$
					"org.eclipse.ui.preferencePages.ColorsAndFonts" //$NON-NLS-1$
			};
			PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), pageId, displayedPages, null).open();
		}
	});
}
 
源代码5 项目: Pydev   文件: NewTextSearchActionGroup.java
private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
    if (selection == null) {
        return;
    }

    fOpenAction.selectionChanged(selection);
    if (fOpenAction.isEnabled()) {
        menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fOpenAction);
    }

    if (selection.size() != 1) {
        return;
    }

    Object o = selection.getFirstElement();
    if (!(o instanceof IAdaptable)) {
        return;
    }

    // Create menu
    IMenuManager submenu = new MenuManager("Open Wit&h");
    submenu.add(new OpenWithMenu(fPage, (IAdaptable) o));

    // Add the submenu.
    menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
 
源代码6 项目: Pydev   文件: FileSearchPage.java
@Override
protected void fillContextMenu(IMenuManager mgr) {
    super.fillContextMenu(mgr);
    addSortActions(mgr);
    fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
    fActionGroup.fillContextMenu(mgr);
    AbstractPythonSearchQuery query = (AbstractPythonSearchQuery) getInput().getQuery();
    if (query.getSearchString().length() > 0) {
        IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
        if (!selection.isEmpty()) {
            ReplaceAction replaceSelection = new ReplaceAction(getSite().getShell(),
                    getInput(), selection.toArray(), true);
            replaceSelection.setText(SearchMessages.ReplaceAction_label_selected);
            mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelection);

        }
        ReplaceAction replaceAll = new ReplaceAction(getSite().getShell(), getInput(),
                null, true);
        replaceAll.setText(SearchMessages.ReplaceAction_label_all);
        mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll);
    }
}
 
源代码7 项目: Pydev   文件: NewTextSearchActionGroup.java
private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
    if (selection == null) {
        return;
    }

    fOpenAction.selectionChanged(selection);
    if (fOpenAction.isEnabled()) {
        menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fOpenAction);
    }

    if (selection.size() != 1) {
        return;
    }

    Object o = selection.getFirstElement();
    if (!(o instanceof IAdaptable)) {
        return;
    }

    // Create menu
    IMenuManager submenu = new MenuManager(SearchMessages.OpenWithMenu_label);
    submenu.add(new OpenWithMenu(fPage, (IAdaptable) o));

    // Add the submenu.
    menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
 
源代码8 项目: xtext-eclipse   文件: ReferenceSearchViewPage.java
protected void fillToolbar(IToolBarManager tbm) {
	tbm.appendToGroup(IContextMenuConstants.GROUP_SHOW, showNextAction);
	tbm.appendToGroup(IContextMenuConstants.GROUP_SHOW, showPreviousAction);
	IActionBars actionBars = getSite().getActionBars();
	if (actionBars != null) {
		actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), showNextAction);
		actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), showPreviousAction);
	}
	tbm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, expandAllAction);
	tbm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, collapseAllAction);
}
 
private void addSortActions(IMenuManager mgr) {
	if (getLayout() != FLAG_LAYOUT_FLAT)
		return;
	MenuManager sortMenu= new MenuManager(SearchMessages.FileSearchPage_sort_by_label);
	sortMenu.add(fSortByNameAction);
	sortMenu.add(fSortByPathAction);

	fSortByNameAction.setChecked(fCurrentSortOrder == fSortByNameAction.getSortOrder());
	fSortByPathAction.setChecked(fCurrentSortOrder == fSortByPathAction.getSortOrder());

	mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
}
 
@Override
protected void fillContextMenu(IMenuManager mgr) {
	super.fillContextMenu(mgr);
	addSortActions(mgr);

	mgr.appendToGroup(IContextMenuConstants.GROUP_EDIT, getCopyQualifiedNameAction());

	fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
	fActionGroup.fillContextMenu(mgr);
}
 
private void addSortActions(IMenuManager mgr) {
	if (getLayout() != FLAG_LAYOUT_FLAT)
		return;
	MenuManager sortMenu= new MenuManager(SearchMessages.JavaSearchResultPage_sortBylabel);
	sortMenu.add(fSortByNameAction);
	sortMenu.add(fSortByPathAction);
	sortMenu.add(fSortByParentName);

	fSortByNameAction.setChecked(fCurrentSortOrder == fSortByNameAction.getSortOrder());
	fSortByPathAction.setChecked(fCurrentSortOrder == fSortByPathAction.getSortOrder());
	fSortByParentName.setChecked(fCurrentSortOrder == fSortByParentName.getSortOrder());

	mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
}
 
private void addGroupActions(IToolBarManager mgr) {
	mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, new Separator(GROUP_GROUPING));
	mgr.appendToGroup(GROUP_GROUPING, fGroupProjectAction);
	mgr.appendToGroup(GROUP_GROUPING, fGroupPackageAction);
	mgr.appendToGroup(GROUP_GROUPING, fGroupFileAction);
	mgr.appendToGroup(GROUP_GROUPING, fGroupTypeAction);

	updateGroupingActions();
}
 
源代码13 项目: Pydev   文件: NewTextSearchActionGroup.java
@Override
public void fillContextMenu(IMenuManager menu) {
    // view must exist if we create a context menu for it.

    ISelection selection = getContext().getSelection();
    if (selection instanceof IStructuredSelection) {
        addOpenWithMenu(menu, (IStructuredSelection) selection);
        if (fOpenPropertiesDialog != null && fOpenPropertiesDialog.isEnabled()
                && fOpenPropertiesDialog.isApplicableForSelection((IStructuredSelection) selection)) {
            menu.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, fOpenPropertiesDialog);
        }
    }

}
 
源代码14 项目: Pydev   文件: AbstractSearchIndexResultPage.java
@Override
protected void fillContextMenu(IMenuManager mgr) {
    super.fillContextMenu(mgr);
    fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
    fActionGroup.fillContextMenu(mgr);
    AbstractSearchIndexQuery query = (AbstractSearchIndexQuery) getInput().getQuery();
    if (query.getSearchString().length() > 0) {
        IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
        if (!selection.isEmpty()) {
            ReplaceAction replaceSelection = new ReplaceAction(getSite().getShell(), getInput(),
                    selection.toArray(), true);
            replaceSelection.setText(SearchMessages.ReplaceAction_label_selected);
            mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelection);

        }
        ICallback<Boolean, Match> skipMatch = new ICallback<Boolean, Match>() {

            @Override
            public Boolean call(Match match) {
                StructuredViewer viewer = getViewer();
                ViewerFilter[] filters = viewer.getFilters();
                if (filters == null || filters.length == 0) {
                    return false;
                }
                for (ViewerFilter viewerFilter : filters) {
                    if (viewerFilter instanceof AbstractSearchResultsViewerFilter) {
                        AbstractSearchResultsViewerFilter searchResultsViewerFilter = (AbstractSearchResultsViewerFilter) viewerFilter;
                        if (searchResultsViewerFilter.isLeafMatch(viewer, match)) {
                            return false;
                        }
                    }
                }
                return true;
            }
        };
        ReplaceAction replaceAll = new ReplaceAction(getSite().getShell(), getInput(), null, true, skipMatch);
        replaceAll.setText(SearchMessages.ReplaceAction_label_all);
        mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll);
    }
}
 
源代码15 项目: Pydev   文件: AbstractSearchIndexResultPage.java
@Override
protected void fillToolbar(IToolBarManager tbm) {
    super.fillToolbar(tbm);
    for (Action a : fGroupByActions) {
        String id = IContextMenuConstants.GROUP_PROPERTIES + "." + a.hashCode();
        a.setId(id);
        tbm.add(a);
    }
}
 
源代码16 项目: Pydev   文件: FileSearchPage.java
private void addSortActions(IMenuManager mgr) {
    if (getLayout() != FLAG_LAYOUT_FLAT) {
        return;
    }
    MenuManager sortMenu = new MenuManager(SearchMessages.FileSearchPage_sort_by_label);
    sortMenu.add(fSortByNameAction);
    sortMenu.add(fSortByPathAction);

    fSortByNameAction.setChecked(fCurrentSortOrder == fSortByNameAction.getSortOrder());
    fSortByPathAction.setChecked(fCurrentSortOrder == fSortByPathAction.getSortOrder());

    mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
}
 
源代码17 项目: Pydev   文件: NewTextSearchActionGroup.java
@Override
public void fillContextMenu(IMenuManager menu) {
    // view must exist if we create a context menu for it.

    ISelection selection = getContext().getSelection();
    if (selection instanceof IStructuredSelection) {
        addOpenWithMenu(menu, (IStructuredSelection) selection);
        if (fOpenPropertiesDialog != null && fOpenPropertiesDialog.isEnabled()
                && fOpenPropertiesDialog.isApplicableForSelection((IStructuredSelection) selection)) {
            menu.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, fOpenPropertiesDialog);
        }
    }

}
 
源代码18 项目: xds-ide   文件: OpenEditorActionGroup.java
private void appendToGroup(IMenuManager menu, IAction action) {
	if (action.isEnabled())
		menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
}
 
public void init(IPageSite site) {
	super.init(site);
	IMenuManager menuManager = site.getActionBars().getMenuManager();
	menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new OpenSearchPreferencesAction());
}
 
源代码20 项目: Pydev   文件: FileSearchPage.java
@Override
public void init(IPageSite site) {
    super.init(site);
    IMenuManager menuManager = site.getActionBars().getMenuManager();
    menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new OpenSearchPreferencesAction());
}