gpt4 book ai didi

menu - Eclipse RCP : How to configure the Perspective Menu?

转载 作者:行者123 更新时间:2023-12-02 01:16:49 27 4
gpt4 key购买 nike

我需要完全控制透视菜单。

我已经侵入平台以禁用上下文菜单:

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);
}
}
}
}

但我还需要控制视角菜单的默认内容。有一个始终存在的选项可以访问透视列表外壳。我需要从菜单中删除该选项。

遗憾的是透视菜单完全不受用户控制。我只需要将视角添加到菜单中,仅此而已!

谢谢。

enter image description here

最佳答案

有 3 个潜在选项可以摆脱“其他”:

  1. 设置 org.eclipse.ui.IWorkbenchPreferenceConstants.SHOW_OTHER_IN_PERSPECTIVE_MENU偏好false在您的 RCP 应用程序中。这可以通过包含 plugin_customization.ini 来完成。包含您的产品定义的文件。

  2. 修补 RCP 应用程序中的工作台。看一下 org.eclipse.ui.internal.PerspectiveBarNewContributionItemorg.eclipse.ui.actions.ContributionItemFactory.PERSPECTIVES_SHORTLIST

  3. 不包含默认值RCP 应用程序中的透视栏。相反,创建一个透视栏使用 org.eclipse.ui.menus,工具栏和 openPerspective命令。

关于menu - Eclipse RCP : How to configure the Perspective Menu?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5333391/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com