XML DOM: references and find usages for tag content
Answered
I am creating a plugin in which i need to resolve from part of a tags content to another tags content. in the example below the instances of ‘box_1’ in record 2 and 3 should resolve to its declaration which is the <field name="code">
tag in record 1. And find usages on the tag content of <field name="code">
should show the formula fields in record 2 and 3. 'box_2' should be resolved to another box (not shown in example) similar to ‘box_1’. Can this be achieved using the XML DOM api, if yes how do i do this?
<record id="1">
<field name="code">box_1</field>
</record>
<record id="2">
<field name="formula">box_1.total + box_2.total</field>
</record>
<record id="3">
<field name="formula">box_1.total</field>
</record>
Please sign in to leave a comment.
Use
com.intellij.util.xml.CustomReferenceConverter
which can install custom references for parts of the tag's value. Seeorg.jetbrains.idea.devkit.dom.impl.ExtensionOrderConverter
in bundled Plugin DevKit plugin as sample.