本文整理匯總了Java中org.eclipse.jface.action.IMenuManager.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java IMenuManager.remove方法的具體用法?Java IMenuManager.remove怎麽用?Java IMenuManager.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.action.IMenuManager
的用法示例。
在下文中一共展示了IMenuManager.remove方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
}
}
示例2: fillContextMenu
import org.eclipse.jface.action.IMenuManager; //導入方法依賴的package包/類
@SuppressWarnings("restriction")
@Override
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
ActionContributionItem pasteContribution = getPasteContribution(menu.getItems());
menu.remove(pasteContribution);
IAction pasteAction = new Action(PASTE_ACTION_TEXT) {
@Override
public void run() {
IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
.getService(IHandlerService.class);
try {
JobCopyParticipant.setCopiedFileList(new ArrayList<>());
handlerService.executeCommand(PASTE_COMMAND_ID, null);
} catch (Exception exception) {
logger.warn("Error while pasting job files :: {}",exception.getMessage());
}
}
};
pasteAction.setAccelerator(SWT.MOD1 | 'v');
Bundle bundle = Platform.getBundle(MENU_PLUGIN_NAME);
URL imagePath = BundleUtility.find(bundle,ImagePathConstant.PASTE_IMAGE_PATH.getValue());
ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imagePath);
pasteAction.setImageDescriptor(imageDescriptor);
menu.insertAfter(COPY_ACTION_ID, pasteAction);
}