我有以下menuContribution
,将一个命令添加到Tree
的上下文菜单中。有两个技术参数expand
和useSelection
。
<menuContribution
locationURI="popup:com.softmodeler.ui.editors.StructureCompareEditor?after=additions">
<command
commandId="softmodeler.cmd.refreshViewer"
id="softmodeler.cmd.refreshViewer"
style="push">
<parameter
name="expand"
value="1">
</parameter>
<parameter
name="useSelection"
value="true">
</parameter>
</command>
</menuContribution>
知道如何删除标签中的参数名称吗?
我可以在命令
上设置label
属性,但这样我就会有多余的标签(支持四种UI语言,试图防止冗余)。
最佳答案
您需要提供一个标签属性,否则将使用此默认标签。对于本地化,请在属性值中使用 %label
并为每种语言提供 plugin.properties
文件(但我想您已经知道了)。据我所知,这已经是最好的了。
或者,您可以通过编程方式创建菜单贡献,并提供 ExtensionContributionFactory
。在 createContributionItems()
方法中,您应该能够从所需的命令创建贡献项,同时重新使用命令名称作为标签。当然,一旦显示菜单,就会激活您的插件。
关于java - 命令菜单贡献将参数名称添加到标签中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43089811/