【问题标题】:Extend an existing Context Menu inside Eclipse Outline View for Xtext在 Xtext 的 Eclipse 大纲视图中扩展现有的上下文菜单
【发布时间】:2018-06-28 12:19:20
【问题描述】:

我们有一个使用 Xtext 创建的 eclipse 插件。现在我想在 Eclipse 的大纲视图中的元素中添加一个上下文菜单。我知道我需要一个 menuContribution 来调用命令。但我不明白的是,我是否必须以某种方式创建(定义)命令。 我的 plugin.xml 包含 "org.eclipse.ui.menus" 的扩展点。

菜单贡献是这样的:

我找到了有关创建菜单贡献的教程,但没有任何内容可以将我的 menuContribution 绑定到我想要定义的命令。

【问题讨论】:

    标签: eclipse xtext outline-view


    【解决方案1】:

    通常您需要三个扩展:

    • org.eclipse.ui.command
    • org.eclipse.ui.handlers
    • org.eclipse.ui.menu

    需要一些技巧才能使它们正确。我建议你看一些开源代码并从那里开始。 介绍文章:http://www.vogella.com/tutorials/EclipseCommands/article.html

    您想贡献的上下文菜单的locationUri 应该是popup:org.eclipse.xtext.ui.outline.OutlinePageContextMenu。在这里找到:https://github.com/eclipse/xtext-eclipse/blob/master/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/outline/impl/OutlinePage.java

    【讨论】:

      猜你喜欢
      • 2013-02-18
      • 2019-12-08
      • 1970-01-01
      • 2017-08-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多