如何在Eclipse中设置默认隐藏的命令? [英] How to set a command to be hidden by default in Eclipse?

查看:206
本文介绍了如何在Eclipse中设置默认隐藏的命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Eclipse插件,可以向工具栏提供命令。我有一个请求默认隐藏(但是应该可以在自定义透视图菜单中启用它)。



我有尝试使用 visibleWhen 属性(通过仅使用不存在的透视图启用它),默认情况下隐藏该命令,但在自定义透视图菜单它是灰色的,不可能启用它。



有没有办法让默认情况下禁用工具栏的命令贡献?

解决方案

最后,我找到了一个解决方案:

 < extension 
point =org.eclipse.ui.perspectiveExtensions>
< perspectiveExtension
targetID =*>
< hiddenToolBarItem
id =command_id>
< / hiddenToolBarItem>
< / perspectiveExtension>
< / extension>


I have an Eclipse plug-in that contributes a command to a toolbar. I got a request to make it hidden by default (but it should be possible to enable it in the Customize Perspective menu).

I have tried to use the visibleWhen attribute (by enabling it only with a non-existing perspective), the command is hidden by default, but in the Customize Perspective menu it is grayed out and it isn't possible to enable it.

Is there any way to have a command contribution to a toolbar disabled by default?

解决方案

Finally, I have found a solution:

<extension
      point="org.eclipse.ui.perspectiveExtensions">
   <perspectiveExtension
         targetID="*">
      <hiddenToolBarItem
            id="command_id">
      </hiddenToolBarItem>
   </perspectiveExtension>
</extension>

这篇关于如何在Eclipse中设置默认隐藏的命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆