Custom tag navigation again - in IDEA 8.1

Hi,

my plugin is supposed to do something similar as in request IDEADEV-5499.
So in my application component, I register a custom XmlNSDescriptor:

MetaDataRegistrar.getInstance().registerMetaData(
  new ClassFilter(XmlDocument.class),
  MyXmlNSDescriptor.class
);


Similar to the example code attached to IDEADEV-5499, MyXmlNSDescriptor implements every single method of com.intellij.xml.XmlNSDescriptor. If I create some XML file, the no-arg constructor of MyXmlNSDescriptor is called, and then its init() method, but nothing else. In the example code for IDEA 5.1 attached to issue 5499, the init() method also did nothing (except for writing "Hi"), so that cannot be the difference.
Why are MyXmlNSDescriptor methods like getRootElementsDescriptors() and getElementDescriptor() never called? What am I missing here?
Is this still the intended approach in IDEA 8.1, if you want to add custom navigation to certain XML elements?
Btw., in contrast to IDEADEV-5499, the XML files the plugins tries to tweak do have an XML schema, so I am not interested in implementing a custom XmlFileNSInfoProvider.
Any help would be appreciated!

3 comments
Comment actions Permalink

Just wild guess, try register metadata for XmlTag

Frank Wienberg wrote:

Hi,

my plugin is supposed to do something similar as in http://youtrack.jetbrains.net/issue/IDEADEV-5499.
So in my application component, I register a custom XmlNSDescriptor:

MetaDataRegistrar.getInstance().registerMetaData(
  new ClassFilter(XmlDocument.class),
  MyXmlNSDescriptor.class
);

Similar to the example code attached to IDEADEV-5499, MyXmlNSDescriptor implements every single method of com.intellij.xml.XmlNSDescriptor. If I create some XML file, the no-arg constructor of MyXmlNSDescriptor is called, and then its init() method, but nothing else. In the example code for IDEA 5.1 attached to issue 5499, the init() method also did nothing (except for writing "Hi"), so that cannot be the difference.
Why are MyXmlNSDescriptor methods like getRootElementsDescriptors() and getElementDescriptor() never called? What am I missing here?
Is this still the intended approach in IDEA 8.1, if you want to add custom navigation to certain XML elements?
Btw., in contrast to IDEADEV-5499, the XML files the plugins tries to tweak do have an XML schema, so I am not interested in implementing a custom XmlFileNSInfoProvider.
Any help would be appreciated!

---
Original message URL: http://www.jetbrains.net/devnet/message/5251764#5251764



--
Best regards,
   Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Thanks, it seems the problem was that some objects were cached and thus my code was not invoked immediately.
However, I now use another way to register a custom XmlElementDescriptorProvider, namely through plugin.xml.

  <extensions defaultExtensionNs="com.intellij.xml">
    <elementDescriptorProvider implementation="net.jangaroo.ide.idea.exml.ComponentXmlElementDescriptorProvider"/>
  </extensions>


My class then implements the interface com.intellij.psi.impl.source.xml.XmlElementDescriptorProvider. This works fine, but is it official OpenAPI? Or should I go the way mentioned above, using MetaDataRegistrar.getInstance().registerMetaData(...)?

0
Comment actions Permalink

I'd really like to know, is the extension point I am using public API or not?

0

Please sign in to leave a comment.