Menu EclipseRCP:如何配置透视菜单?
我需要完全控制透视菜单 我已经侵入该平台以禁用上下文菜单:Menu EclipseRCP:如何配置透视菜单?,menu,eclipse-rcp,options,perspective,Menu,Eclipse Rcp,Options,Perspective,我需要完全控制透视菜单 我已经侵入该平台以禁用上下文菜单: private void disablePerspectiveToolbarMenu() { PerspectiveBarManager perspectiveBarManager = ((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getPerspectiveBar(); if (perspectiveBa
private void disablePerspectiveToolbarMenu() {
PerspectiveBarManager perspectiveBarManager =
((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getPerspectiveBar();
if (perspectiveBarManager!=null){
ToolBar toolBar = perspectiveBarManager.getControl();
Listener[] listeners = toolBar.getListeners(SWT.MenuDetect);
if (listeners != null){
for (Listener listener : listeners){
toolBar.removeListener(SWT.MenuDetect, listener);
}
}
}
}
但我还需要控制透视菜单的默认内容。有一个始终存在的选项可以访问透视列表外壳。我需要从菜单中删除该选项
令人遗憾的是,透视菜单完全脱离了用户的控制。我只需要将透视图添加到菜单中,就行了
谢谢
有3种可能的方法可以消除其他问题:
org.eclipse.ui.iWorkbenchReferenceConstants.SHOW\u OTHER\u IN_PERSPECTIVE\u菜单
在RCP应用程序中首选false
。这可以通过在产品定义中包含plugin\u customization.ini
文件来实现org.eclipse.ui.internal.PerspectiveBarNewContributionItem
和
org.eclipse.ui.actions.ContributionItemFactory.PERSPECTIVES\u短名单
我做了一些研究,但解决方案并没有像我预期的那样有效。最后我发现了我的错误 要在plugin_customization.ini中设置属性,我尝试了:
org.eclipse.ui.IWorkbenchPreferenceConstants.SHOW_OTHER_IN_PERSPECTIVE_MENU=false
但这不是正确的符号!!!请查看我最后添加到plugin_customization.xml的正确解决方案
org.eclipse.ui/SHOW_OTHER_IN_PERSPECTIVE_MENU=false
因此指定属性的接口或类的名称不是表示法的一部分谢谢!我无法通过plugin_customization.ini使其工作。但将其添加到我的其他初始化中:PlatformUI.getPreferenceStore().setValue(iWorkbenchReferenceConstants.SHOW_other_IN_PERSPECTIVE_MENU,false);几周前,我在eclipse站点上打开了一个“功能请求”,原因是透视栏缺乏控制。