gpt4 book ai didi

eclipse - 是否可以在 Eclipse 中隐藏/删除任意上下文菜单项(3.6)

转载 作者:行者123 更新时间:2023-12-02 09:04:57 26 4
gpt4 key购买 nike

我的问题可以分为三个:

是否可以通过...隐藏/删除 Eclipse (3.6) 中的任意上下文菜单项

  1. 标准用户界面?
  2. 一些现有的插件?
  3. 自定义插件?

我没能找到通过方法 1 和 2 来做到这一点的方法。如果唯一的选择是创建自定义插件,任何人都可以将我推向正确的方向(我在 Java 方面有一些经验,但在 Java 方面没有经验) Eclipse 插件)。

最佳答案

您可以通过标准 GUI 隐藏菜单或菜单项:see help

To hide a menu item or toolbar button:

  • Switch to the perspective that you want to configure.
  • Select Window > Customize Perspective....
  • Open the Menu Visibility or Tool Bar Visibility tab.
  • Find the item you want to hide.
  • Uncheck the check box next to the item. Uncheck a menu to hide all its children.
  • Click OK to cause the changes to take effect.

但这会在所有存在该条目的菜单(上下文或非上下文)中隐藏该条目。
因此,它可能不会像您通过 GUI 想要的那样细粒度。

<小时/>

你也可以试试through a plugin (另请参阅Menu contribution)

The first steps are pretty standard for using extensions in Eclipse.

  • Open the plugin.xml file and add the org.eclipse.ui.activities extension.
  • Then create an activity node and give it a unique ID.
  • Then create an activityPatternBinding node and use the unique ID for the activity to find the pattern node to the activity node.
    The activityPatternBinding node requires that you supply a regular expression for the ID string of the UI element that you wish to hide.

The problem is that there appears to be at least 3 ways that menu items and toolbar buttons are added to the UI.

  • 第一种方法是通过较新的命令/菜单扩展。
  • 第二种方法是通过旧的 ActionSets 扩展。
  • 还有其他 UI 元素似乎被硬编码到工作台中,并且没有 ID 字符串,并且无法使用事件扩展来隐藏。幸运的是,第三种类型的 UI 元素很少。

考虑到您正在谈论最新的 Eclipse,我将仅复制第一种方式:

1/ Use the Plug-In Spy

The first way is to use the Plug-In Spy.
Press alt-shift-F2 and click on a menu item or toolbar button that you want to be hidden.
If there is an ID string under the heading "active action definition identifier" then you are in luck.
This item has been added using the Command Extension and you can use this ID as the pattern argument for the Activities Extension.
But not all items that have been added using the Command Extension present their ID string to the plug-in spy.

As a side note, the ID strings are period separated.
For instance the ID for a button might be "org.eclipse.ui.navigate.backwardHistory".
Regular expressions use the period to stand for any character. Luckily the period used as a wild card matches with actual period characters so you don't need to escape them if you don't want to. I find it makes it a bit easier to read if they are not escaped and it is highly unlikely it will cause any ambiguous matches.

关于eclipse - 是否可以在 Eclipse 中隐藏/删除任意上下文菜单项(3.6),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3482312/

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