Jump to declaration for custom xml

I have component based application. All of the components are defined in XML. The components may be defined in different xml files.

<!-- 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>


Right now I'm trying to write a plugin so that I can jump from the child components to parent component. In the example above, the component type 'x' and name 'z' extends component type 'x' and name 'y'.
Going throughs some of the source from different plugins, I was able to add a menu item and grab content under the caret.

Say, if my caret is under "x:y" in second component, I can garb x and y so at least I can know the component type and component name to look for.
But I want to underline the contents under extends i.e. "x:y" when I press ctrl and search for the component and jump to the declaration of the component when ctrl+click like we jump to declaration of class.

I want guidance like which class should I look, how should I go or similar implementation.
Thanks

1 comment
Comment actions Permalink

The easiest way to model XML-based plugins is using DOM API
http://confluence.jetbrains.com/display/IDEADEV/Accessing+XML+through+IntelliJ+IDEA+DOM

There's some links to other plugins sources as reference on the bottom.

0

Please sign in to leave a comment.