is it possible to override CTRL + mouse click for specific SpiElement ? Follow
I already wrote a quickNavigateInfo for some specific PsiElement that show me the translation corresponding to the java variable (the same way that I18n works)
Now i'm looking for the CTRL + click to open the file containing the translation. Currently IntelliJ handle this the normal way and propose to open the declaration of the variable, but this is not what i want to open.
Is there something similare to quickNavigateInfo but for goToReference ?
Thanks in advance for your answer.
Please sign in to leave a comment.
You need to provide PsiReference in that place, using resolve() to navigate to target. http://www.jetbrains.org/intellij/sdk/docs/reference_guide/custom_language_support/references_and_resolve.html
Thank you Yann.
I already came to this example and I still don't really know where to start.
The example is for a custom language where I need to define a lot of stuff.
I'm not sure how to proceed here. Indeed I don't plan to use a new language, only to override the reference of some existing psiElement .
I was thinking of overriding the JavaLangClassMemberReference resolve method, but I guess this is not the correct approach.
If you have a bit more details that would be very helpful .
And sorry that I bother you so much.
By the way as the example deals with a properties plugin i have another small question :
my translations are available within a property file.
I currently read and write the file with within the load and store method of the Property object what is working fine, but the "undo" does not seems to detect this changes.
I first wanted to read the PsiElement directly with Intellij, as these Psi elements where shown on PsiViewer.
But somehow I guess I need to tell my plugin that it should compile the properties plugin too.
Indeed I can't access com.intellij.lang.properties.psi....
any idea how to access the psiElement from the properties file ? Or how to make the Undo aware that the property file was change ?
You need to add a dependency on the Properties plugin, see http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html
I managed to add the dependency thanks :)
but i'm still fighting with the CTRL + click
here is what I have done
1: I created a contributor
I registered it within my plugin.xml with following line
and I created the clickProvider class
I added a breakpoint on the contributor and on the provider
I could confirm that the contributor code is indeed done
but it never went in my provider :/
psiViewer told me that what I'm looking is correct, but somehow the Pattern does not seems to match as it never enter the TranslationClickProvider class
If I leave my pattern empty
Then the breakpoint within my Provider is triggered. But of couse I don't want to register the provider for all possible psiElements ...
Any clue of what I'm doing wrong ?
someone has an idea ?
Maybe I should use something else different than PlatformPatterns ?
I have the feeling that my solution is nearly ok, but like said I'm missing something to make it work.
ok I got it :) i was using the wrong approach .
I needed to use gotToDeclaration and implement one class for that :)
Which class the mehtod of gotToDeclaration?
zjbhnay Could you please clarify your question?
Hi Alan, sorry to bother you.
I attempt resolve task like you'r: I need create functional for navigate to definition of annotation (ex. @Something("UNIQUE_TEXT") ) via CTRL+Click from different file with custom extension (like .some_extension)
However, i cannot understand, what you mean
When i search this in JetBrains plugin development documentation, i no found anything relevant. So, may be you can show solution or github?