【发布时间】:2012-11-30 06:43:02
【问题描述】:
在 Eclipse 中,我在主按钮工具栏中为按钮定义了命令。我有一个设置为下拉按钮的命令/按钮,我想以编程方式为其添加选项。有点像您如何在 Eclipse 中点击播放按钮上的小下拉按钮并查看不同的运行场景。我希望能够将这样的选项添加到我的下拉菜单中。我无法通过插件编辑器来完成,因为我需要动态生成菜单选项。
假设我在我的 plugin.xml 文件中定义了以下下拉按钮。如何以编程方式向下拉菜单添加选项?
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="com.company.gui.base.toolBarMain">
<command
commandId="com.company.gui.base.command1"
icon="icons/magnifier.png"
id="com.company.gui.base.toolBarMain.monitor"
label="Im a pulldown menu"
style="pulldown">
</command>
</toolbar>
</menuContribution>
【问题讨论】:
标签: java eclipse eclipse-plugin eclipse-rcp