Java IntelliJ IDEA插件:跳转到自定义xml的声明

Java IntelliJ IDEA插件:跳转到自定义xml的声明,java,xml,intellij-idea,intellij-plugin,Java,Xml,Intellij Idea,Intellij Plugin,我有基于组件的应用程序。所有组件都是用XML定义的。这些组件可以在不同的xml文件中定义 <!-- filename: components.xml --> <components> <component type="x" name="y"> <property1 attribute="attr"/> <property2 attribute="attr"/> </component>

我有基于组件的应用程序。所有组件都是用XML定义的。这些组件可以在不同的xml文件中定义

<!-- filename: components.xml -->

<components>
   <component type="x" name="y">
      <property1 attribute="attr"/>
      <property2 attribute="attr"/>
   </component>
   <component type="a" name="b">
      <property1 attribute="attr"/>
      …
   </component>
 </components>


<!-- filename: extra-components.xml -->
<components>
    <component type="x" name="z" extends="x:y">  <!-- this extends component x:y -->
        <property3 attribute="attr"/>
    </component>
</components>
现在我正在尝试编写一个插件,这样我就可以从子组件跳到父组件。在上面的示例中,组件类型“x”和名称“z”扩展了组件类型“x”和名称“y”

通过浏览来自不同插件的一些源代码,我能够添加一个菜单项并在插入符号下获取内容

比如说,如果我的插入符号在第二个组件中的“x:y”下,我可以对x和y进行修饰,这样至少我可以知道要查找的组件类型和组件名称

但是当我按下ctrl键搜索组件时,我想在extends下的内容下加下划线,即“x:y”,当ctrl+单击时,跳转到组件的声明,就像跳转到类的声明一样

我需要指导,比如我应该看哪门课,我应该怎么做,或者类似的实现


谢谢

我想你要找的是一份工作

有关如何设置参与者的详细信息,请参阅。一旦创建了这个贡献者,我认为您将有两种方法来查找哪个XML元素
x:y
引用:

  • 解析每个可能的XML文件并尝试找到具有正确属性的标记,然后返回相应的元素
  • 为每个
    组件
    标记创建一个索引,并在此索引中查找
    x:y
    (需要更多的工作)