Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9158217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:11:47+00:00 2026-06-17T13:11:47+00:00

I have a custom XML format that links to Java resources. For the sake

  • 0

I have a custom XML format that links to Java resources. For the sake of simplicity let’s assume my XML file would look like this:

<root>
  <java-class>my.fully.qualified.class.name</java-class>
</root>

Eventually my references will be somewhat more complicated. It will not contain the fully qualified class name directly and I will need some logic to resolve the correct class, but I want to keep the example as simple as possible here.

Now I want it to be possible to Strg+Click on the element’s text and want IntelliJ to carry me to the .java file, just like it is possible in Spring-XML files. In the IDEA Plugin Development FAQ there is a link called “How do I add custom references to Java elements in XML files?” which so much sounds like exactly what I need. Unfortunately it links to a discussion where someone is more or less done implementing something like this, having some minor problems. Nevertheless I understood that I probably need to write an implementation of the interface com.intellij.psi.PsiReference. Googling for “PsiReference” and “IntelliJ” or “IDEA” unfortunately did not bring up any tutorials on how to use it, but I found the class XmlValueReference which sounds useful. Yet again googling for “XmlValueReference” did not turn up anything useful on how to use the class. At least the PSI Cookbook tells me that I can find the Java class by using JavaPsiFacade.findClass(). I’d be thankful for any tutorials, hints and the like, that tell the correct usage.

The above linked discussion mentions that I need to call registry.registerReferenceProvider(XmlTag.class, provider) in order to register my provider once I eventually managed to implement it, but of which type is “registry” and where do I get it from?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:11:48+00:00Added an answer on June 17, 2026 at 1:11 pm

    First of all, here’s a nice tutorial that came up a few days ago, which explains the basics of IntelliJ plugin development (you should take a look at the section Reference Contributor).

    You will likely have to define your own PsiReferenceContributor, which will be referenced in your plugin.xml like this:

    <psi.referenceContributor implementation="com.yourplugin.YourReferenceContributor"/>
    

    In your reference contributor, there’s a method registerReferenceProviders(PsiReferenceRegistrar) where you will be able to call registry.registerReferenceProvider(XmlTag.class, provider).

    Finally, in your instance of PsiReferenceProvider, you will have to test the tag name to filter out tags which don’t contain class references, then find the right Java class using JavaPsiFacade.findClass().

    From my experience, the best place to get help regarding IntelliJ plugin development is JetBrains’ forums.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have custom component that I can place in my layout file (XML) for
Good day I have a custom TextBox that has a IndicatorTextBox.ui.xml file as well
Let's say I have a custom file archive format similar to Zip or Rar,
I have a ListView that has a custom ArrayAdapter with a custom XML row.
I have a custom EditText MomentumEditText that I have in a layout in xml
I am currently watching an XML file from log4j output. I have a custom
friends, i have created custom title bar using following titlebar.xml file with code <?xml
We have a bog-standard javax.xml.* parser that slurps up a big XML file and
I've come across a dilemma. My C# app uses a custom file format that
I'm writing a game in Android that uses a custom XML format to describe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.