【问题标题】:Is there any way to add a shortcut key in eclipse from plugin on runtime?有没有办法在运行时从插件中添加 eclipse 中的快捷键?
【发布时间】:2012-07-12 03:44:04
【问题描述】:

我正在 eclipse 中开发一个插件。目前我们正在使用“org.eclipse.ui.bindings”扩展点来提供快捷键。但它是为 action 提供快捷键的静态选项。我们的用户在没有快捷键的情况下使用我的插件会遇到一些困难。是否有任何选项可以通过 eclipse 插件在运行时添加快捷键?

 <extension      
       point="org.eclipse.ui.commands">
       <category
             name="ZMedia Shortcuts Category"
             id="com.zmedia.viewer.commands.category">
       </category>

       <command
             name="Update Zmedia Deployable Instances"
             categoryId="com.zmedia.viewer.commands.category"
             id="com.zmedia.viewer.commands.UpdateZmediaDeployableInstances">
       </command>
 </extension>
 <extension
       point="org.eclipse.ui.handlers">
    <handler
          class="com.zmedia.viewer.handlers.UpdateZmediaDeployableInstances"
          commandId="com.zmedia.viewer.commands.UpdateZmediaDeployableInstances">
    </handler>
 </extension>
 <extension
       point="org.eclipse.ui.bindings">
    <key
        schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
        commandId="com.zmedia.viewer.commands.UpdateZmediaDeployableInstances"
        sequence="M1+M2+ESC">
    </key>      
 </extension> 

【问题讨论】:

    标签: eclipse eclipse-plugin


    【解决方案1】:

    extension point description 明确否认:

    API 信息: 没有用于定义绑定的公共 API。为了尝试为用户实现稳定性,绑定仅通过扩展点定义。如果您是 RCP 应用程序,您应该能够在 WorkbenchAdvisor 中覆盖此行为。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-19
      • 1970-01-01
      • 2020-03-04
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 2020-08-19
      相关资源
      最近更新 更多