【问题标题】:Eclipse RCP OS X Preferences/About menu integration works inside Eclipse but not outside?Eclipse RCP OS X Preferences/About 菜单集成在 Eclipse 内部有效,但在外部无效?
【发布时间】:2015-04-09 15:34:31
【问题描述】:

我正在开发一个面向包括 OS X 在内的多个平台的 Eclipse RCP 4 应用程序。

在 OS X 下的 Eclipse 开发环境中测试应用程序时,应用程序菜单集成工作正常。可以从带有粗体应用程序名称的下拉菜单中选择首选项和关于。关于、首选项和退出从下拉文件菜单中正确自动省略,它们应该出现在 Windows 或 Linux 下而不是 OS X 下。

当使用 Eclipse Delta Pack 将应用程序部署到 OS X 时,带有粗体应用程序名称的下拉菜单会显示 About 和 Preferences 条目,但在选择时它们什么也不做。关于、首选项和退出显示在下拉文件菜单上,这是仅当应用程序部署到 Windows 或 Linux(而不是 OS X)时的预期行为。

关于如何在 OS X 下在 Eclipse 之外获得正确菜单行为的任何建议?

这是 Application.e4xmi 文件的内容,其中定义了菜单:

<?xml version="1.0" encoding="UTF-8"?>
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" 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="_1_XycKbsEeSFCpZI3OEurw" elementId="org.eclipse.e4.ide.application" bindingContexts="_1_XyeabsEeSFCpZI3OEurw">
  <children xsi:type="basic:TrimmedWindow" xmi:id="_8rfnILaNEeSTFNGxwQXIhw" elementId="relui.trimmedwindow.rel" label="Rel" iconURI="platform:/plugin/RelUI/icons/RelAppIcon/32x32.png">
    <children xsi:type="advanced:PerspectiveStack" xmi:id="_BV6u4LaOEeSTFNGxwQXIhw" elementId="relui.perspectivestack.0">
      <children xsi:type="advanced:Perspective" xmi:id="_CGugwLaOEeSTFNGxwQXIhw" elementId="relui.perspective.0">
        <children xsi:type="basic:Part" xmi:id="_Gcb8wLaOEeSTFNGxwQXIhw" elementId="relui.part.0" contributionURI="bundleclass://RelUI/org.reldb.relui.parts.Main"/>
      </children>
    </children>
    <mainMenu xmi:id="_36hGILqYEeSSsbhT1QHqRQ" elementId="relui.menu.0">
      <children xsi:type="menu:Menu" xmi:id="_JS68YLqZEeSSsbhT1QHqRQ" elementId="relui.menu.file" label="File" tooltip="" mnemonics="F">
        <children xsi:type="menu:HandledMenuItem" xmi:id="_XU6QcLqZEeSSsbhT1QHqRQ" elementId="relui.handledmenuitem.newDatabase" label="New database" iconURI="platform:/plugin/RelUI/icons/NewDBIcon.png" mnemonics="M1+n" command="_eqs_ALqpEeSSsbhT1QHqRQ"/>
        <children xsi:type="menu:HandledMenuItem" xmi:id="_YysdELqZEeSSsbhT1QHqRQ" elementId="relui.handledmenuitem.openLocalDatabase" label="Open local database" iconURI="platform:/plugin/RelUI/icons/OpenDBLocalIcon.png" mnemonics="M1+l" command="_hYmvsLqpEeSSsbhT1QHqRQ"/>
        <children xsi:type="menu:HandledMenuItem" xmi:id="_aF044LqZEeSSsbhT1QHqRQ" elementId="relui.handledmenuitem.openRemoteDatabase" label="Open remote database" iconURI="platform:/plugin/RelUI/icons/OpenDBRemoteIcon.png" mnemonics="M1+r" command="_mkgz4LqpEeSSsbhT1QHqRQ"/>
        <children xsi:type="menu:MenuSeparator" xmi:id="_4_VjsLqZEeSSsbhT1QHqRQ" elementId="relui.menuseparator.0"/>
        <children xsi:type="menu:HandledMenuItem" xmi:id="_-x_hUMfrEeSqd4GfyFqaAQ" elementId="relui.handledmenuitem.about" label="About" command="_1_YZiqbsEeSFCpZI3OEurw"/>
        <children xsi:type="menu:HandledMenuItem" xmi:id="_58XzsLqZEeSSsbhT1QHqRQ" elementId="relui.handledmenuitem.exit" label="Exit" mnemonics="M1+x" command="_1_YZgKbsEeSFCpZI3OEurw"/>
      </children>
      <children xsi:type="menu:Menu" xmi:id="_V4OQALqZEeSSsbhT1QHqRQ" elementId="relui.menu.tools" label="Tools">
        <children xsi:type="menu:HandledMenuItem" xmi:id="_giqZcLqZEeSSsbhT1QHqRQ" elementId="relui.handledmenuitem.options" label="Preferences" iconURI="platform:/plugin/RelUI/icons/settingsIcon.png" mnemonics="M1+p" command="_85hu4No2EeSw-PA_k-Gusw"/>
        <children xsi:type="menu:HandledMenuItem" xmi:id="_68AVkNiyEeSgZfqMAYQ1XA" elementId="relui.handledmenuitem.viewLog" label="View log" tooltip="View system log" command="_sr9-cNiyEeSgZfqMAYQ1XA"/>
      </children>
    </mainMenu>
  </children>
  <handlers xmi:id="_1_YZgabsEeSFCpZI3OEurw" elementId="RelUI.handler.quitCommand" contributionURI="bundleclass://RelUI/org.reldb.relui.handlers.Quit" command="_1_YZgKbsEeSFCpZI3OEurw"/>
  <handlers xmi:id="_1_YZi6bsEeSFCpZI3OEurw" elementId="RelUI.handler.aboutCommand" contributionURI="bundleclass://RelUI/org.reldb.relui.handlers.About" command="_1_YZiqbsEeSFCpZI3OEurw"/>
  <handlers xmi:id="_Up7doLqpEeSSsbhT1QHqRQ" elementId="relui.handler.newdatabaseCommand" contributionURI="bundleclass://RelUI/org.reldb.relui.handlers.NewDatabase" command="_eqs_ALqpEeSSsbhT1QHqRQ"/>
  <handlers xmi:id="_vSU4kLqpEeSSsbhT1QHqRQ" elementId="relui.handler.openlocaldatabaseCommand" contributionURI="bundleclass://RelUI/org.reldb.relui.handlers.OpenLocalDatabase" command="_hYmvsLqpEeSSsbhT1QHqRQ"/>
  <handlers xmi:id="_4xZbELqpEeSSsbhT1QHqRQ" elementId="relui.handler.openremotedatabaseCommand" contributionURI="bundleclass://RelUI/org.reldb.relui.handlers.OpenRemoteDatabase" command="_mkgz4LqpEeSSsbhT1QHqRQ"/>
  <handlers xmi:id="_G4n_ALqrEeSSsbhT1QHqRQ" elementId="relui.handler.0" contributionURI="bundleclass://RelUI/org.reldb.relui.handlers.Options"/>
  <handlers xmi:id="_ziLoUNiyEeSgZfqMAYQ1XA" elementId="relui.handler.1" contributionURI="bundleclass://RelUI/org.reldb.relui.handlers.ViewLog" command="_sr9-cNiyEeSgZfqMAYQ1XA"/>
  <handlers xmi:id="_CkUugNo3EeSw-PA_k-Gusw" elementId="relui.handler.preferences" contributionURI="bundleclass://RelUI/org.reldb.relui.handlers.OpenPreferences" command="_85hu4No2EeSw-PA_k-Gusw"/>
  <bindingTables xmi:id="_1_YZgqbsEeSFCpZI3OEurw" bindingContext="_1_XyeabsEeSFCpZI3OEurw">
    <bindings xmi:id="_1_YZg6bsEeSFCpZI3OEurw" keySequence="M1+Q" command="_1_YZgKbsEeSFCpZI3OEurw"/>
    <bindings xmi:id="_1_YZhqbsEeSFCpZI3OEurw" keySequence="M1+O" command="_hYmvsLqpEeSSsbhT1QHqRQ"/>
  </bindingTables>
  <rootContext xmi:id="_1_XyeabsEeSFCpZI3OEurw" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows">
    <children xmi:id="_1_XyeqbsEeSFCpZI3OEurw" elementId="org.eclipse.ui.contexts.window" name="In Windows"/>
    <children xmi:id="_1_Xye6bsEeSFCpZI3OEurw" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
  </rootContext>
  <descriptors xmi:id="_mK_5oK1hEeSOtbblMyKyoQ" elementId="relui.partdescriptor.partdescriptor" label="PartDescriptor" tooltip="this is a tooltip" allowMultiple="true" closeable="true" dirtyable="true">
    <toolbar xmi:id="_n82RwK1hEeSOtbblMyKyoQ" elementId="relui.toolbar.0"/>
  </descriptors>
  <descriptors xmi:id="_rH1nEK1hEeSOtbblMyKyoQ" elementId="relui.partdescriptor.anotherPartDescriptor" label="Another part descriptor" tooltip="this is another part descriptor" allowMultiple="true" closeable="true" dirtyable="true">
    <toolbar xmi:id="_tOvCIK1hEeSOtbblMyKyoQ" elementId="relui.toolbar.1"/>
  </descriptors>
  <commands xmi:id="_1_YZgKbsEeSFCpZI3OEurw" elementId="org.eclipse.ui.file.exit" commandName="quitCommand"/>
  <commands xmi:id="_1_YZiqbsEeSFCpZI3OEurw" elementId="org.eclipse.ui.help.aboutAction" commandName="aboutCommand"/>
  <commands xmi:id="_eqs_ALqpEeSSsbhT1QHqRQ" elementId="relui.command.newdatabase" commandName="newdatabaseCommand" description="New database"/>
  <commands xmi:id="_hYmvsLqpEeSSsbhT1QHqRQ" elementId="relui.command.openLocalDatabase" commandName="openlocaldatabaseCommand" description="Open local database"/>
  <commands xmi:id="_mkgz4LqpEeSSsbhT1QHqRQ" elementId="relui.command.openremotedatabase" commandName="openremotedatabaseCommand" description="Open remote database"/>
  <commands xmi:id="_sr9-cNiyEeSgZfqMAYQ1XA" elementId="relui.command.viewlogcommand" commandName="viewLogCommand" description="View system log"/>
  <commands xmi:id="_85hu4No2EeSw-PA_k-Gusw" elementId="org.eclipse.ui.window.preferences" commandName="preferencesCommand" description="Preferences"/>
  <addons xmi:id="_1_XycqbsEeSFCpZI3OEurw" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
  <addons xmi:id="_1_Xyc6bsEeSFCpZI3OEurw" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
  <addons xmi:id="_1_XydKbsEeSFCpZI3OEurw" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
  <addons xmi:id="_1_XydabsEeSFCpZI3OEurw" 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="_1_XydqbsEeSFCpZI3OEurw" elementId="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="_1_Xyd6bsEeSFCpZI3OEurw" 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="_1_XyeKbsEeSFCpZI3OEurw" 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>

【问题讨论】:

  • 我认为您需要向我们展示设置这些菜单项的代码。
  • 我已经包含了 Application.e4xmi 的内容。
  • 这看起来不错。你是如何为 OS X 构建这个的?
  • 还可以尝试使用 -clearPersistedState 选项启动应用程序以清除任何可能造成混淆的旧状态(或删除工作区 .metadata/.plugins/org.eclipse.e4 中的 workbench.xmi 文件.workbench 目录)
  • 我正在通过将 Eclipse Delta Pack 4.4 安装到 Eclipse、创建 Product.product 文件并使用“Eclipse 产品导出向导”来构建 OS X。

标签: java eclipse macos rcp e4


【解决方案1】:

片段 .jar 文件 org.eclipse.e4.ui.workbench.renderers.swt.cocoa_0.11.200.v20140417-0906.jar(在 Eclipse 目标平台插件目录中找到)不是.product“Eclipse产品导出向导”自动复制到macosx(Cocoa/X86_64)平台部署。

自动复制到macosx(Cocoa/X86)平台部署。

我创建了一个 shell 脚本来根据需要手动复制文件,等待发现更好的解决方案。

【讨论】:

  • 您找到问题的根源还是找到更好的解决方案了吗?
  • 看起来这是 Eclipse Delta Pack 中的一个错误,我不再使用它。我目前使用wiki.eclipse.org/Building 并按照“进行多平台构建的首选方式”下的说明进行操作。它工作正常。
猜你喜欢
  • 1970-01-01
  • 2021-01-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-17
  • 2011-11-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多