本文整理匯總了Java中org.eclipse.jface.action.IMenuManager.getItems方法的典型用法代碼示例。如果您正苦於以下問題:Java IMenuManager.getItems方法的具體用法?Java IMenuManager.getItems怎麽用?Java IMenuManager.getItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.action.IMenuManager
的用法示例。
在下文中一共展示了IMenuManager.getItems方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testTopLevelElementsEntryNoDuplicates
import org.eclipse.jface.action.IMenuManager; //導入方法依賴的package包/類
/**
* Tests that the Top Level Elements
*/
@Test
public void testTopLevelElementsEntryNoDuplicates() {
IActionBars actionBars = projectExplorer.getViewSite().getActionBars();
IMenuManager menuManager = actionBars.getMenuManager();
int topLevelElementsEntriesFound = 0;
for (IContributionItem item : menuManager.getItems()) {
if (item instanceof MenuManager) {
String escapedMenuText = LegacyActionTools.removeMnemonics(((MenuManager) item).getMenuText());
if (escapedMenuText.equals("Top Level Elements")) {
topLevelElementsEntriesFound++;
}
}
}
assertEquals("There was more than one 'Top Level Elements' entry in the navigator action bar.",
topLevelElementsEntriesFound, 1);
}
示例2: editorContextMenuAboutToShow
import org.eclipse.jface.action.IMenuManager; //導入方法依賴的package包/類
@Override
protected void editorContextMenuAboutToShow(final IMenuManager menu) {
super.editorContextMenuAboutToShow(menu);
final IContributionItem[] items = menu.getItems();
for (int i = 0; i < items.length; i++) {
if (items[i] instanceof IMenuManager) {
final IMenuManager subMenu = (IMenuManager) items[i];
final IContributionItem testShowIn = subMenu.find(ContributionItemFactory.VIEWS_SHOW_IN.getId());
if (null != testShowIn) {
menu.remove(subMenu);
}
}
}
}