我使用 Luna 创建了一个新的“Eclipse 4 应用程序项目”,并使用这个“Application.e4xmi”文件创建了自定义菜单。我还添加了一个处理程序类,当我的自定义菜单被点击时将触发(所有这些东西都在 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>