I'm trying to add functiontionality to open up a web page using CTRL+Click on certain elements. The idea is to open up a web page instead of opening the declaration.
For example if I CTRL+Click the following specially formatted string literal:
exampleID = "2435$345345";
it will open up an external web browser window with URL:
To do this, my plan was to implement my own PsiReference, and having the resolve() method call BrowserUtil.launchBrowser(). This obviously didn't work since resolve() isn't only called during a CTRL+Click.
What is the proper way to make this happen? I thought of a few possibilities, but I have no idea if they are possible:
1. Create my own PsiElement returned by resolve() that, when accessed, somehow launches the webpage instead of switching to a file
2. Create my own listeners, and not use the PsiReference API at all.
Any help on this would be greatly appreaciated.