我创建了一个新的Eclipse 4应用项目'使用Luna和我使用这个' Application.e4xmi'创建了自定义菜单。文件。此外,我还添加了一个Handler类,当我单击自定义菜单时会触发(所有这些内容都已在Application.e4xmi中指定)。
使用此设置如果我在调试模式下启动我的产品(作为Eclipse产品),我无法看到我的自定义菜单以及如果我尝试导出为产品并尝试启动eclipse产品我遇到了问题。
xmi内容包括:
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_hHQuoFh2EeWNzdEqyCDxmA" elementId="org.eclipse.e4.ide.application" bindingContexts="_hHQuqVh2EeWNzdEqyCDxmA">
<children xsi:type="basic:TrimmedWindow" xmi:id="_hHQuoVh2EeWNzdEqyCDxmA" label="com.ami.test.e4project" width="500" height="400"/>
<handlers xmi:id="_6WD5YFh2EeWNzdEqyCDxmA" elementId="com.ami.test.e4project.handler.0" contributionURI="bundleclass://com.ami.test.e4project/com.ami.test.e4project.HandlerImplementation" command="_3T-ocFh2EeWNzdEqyCDxmA"/>
<rootContext xmi:id="_hHQuqVh2EeWNzdEqyCDxmA" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows">
<children xmi:id="_hHQuqlh2EeWNzdEqyCDxmA" elementId="org.eclipse.ui.contexts.window" name="In Windows"/>
<children xmi:id="_hHQuq1h2EeWNzdEqyCDxmA" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
</rootContext>
<menuContributions xmi:id="_s3SAEFh2EeWNzdEqyCDxmA" elementId="com.ami.test.e4project.menucontribution.0" parentId="org.eclipse.e4.legacy.ide.application">
<children xsi:type="menu:Menu" xmi:id="_z21zMFh2EeWNzdEqyCDxmA" elementId="com.ami.test.e4project.menu.filee" label="Filee">
<children xsi:type="menu:HandledMenuItem" xmi:id="_0PiAAFh2EeWNzdEqyCDxmA" elementId="com.ami.test.e4project.handledmenuitem.new" label="New" command="_3T-ocFh2EeWNzdEqyCDxmA"/>
</children>
</menuContributions>
<commands xmi:id="_3T-ocFh2EeWNzdEqyCDxmA" elementId="com.ami.test.e4project.command.command" commandName="command"/>
<addons xmi:id="_hHQuolh2EeWNzdEqyCDxmA" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
<addons xmi:id="_hHQuo1h2EeWNzdEqyCDxmA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
<addons xmi:id="_hHQupFh2EeWNzdEqyCDxmA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
<addons xmi:id="_hHQupVh2EeWNzdEqyCDxmA" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/>
<addons xmi:id="_hHQuplh2EeWNzdEqyCDxmA" el ementId="org.eclipse.e4.ui.workbench.handler.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
<addons xmi:id="_hHQup1h2EeWNzdEqyCDxmA" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
<addons xmi:id="_hHQuqFh2EeWNzdEqyCDxmA" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
</application:Application>
答案 0 :(得分:0)
您正在使用菜单贡献到不存在的菜单(org.eclipse.e4.legacy.ide.application
)。
使用Application.e4xmi创建e4应用程序时,有否预定义菜单或其他任何内容。您必须定义所需的菜单。添加“主菜单”&#39;孩子到你的修剪窗口&#39;并把菜单项放在那里。