How to imitate "goto declaration"?
Answered
Hi, guys...
I'am writing a java plugin , need to find a way which goto a method declaration by a string literal.
And I can't found the right answer from the SDK document, other posts and Google.
Can you give me some key points? It has takes me two days.
Thanks very much!
Code exmaple:
@MyAnnotation(methodName="bar")
private void foo(){
}
private void bar() {
}
My question list:
1. how to catch shortcut key: ctrl + b and ctrl + left click, highlight when mouse over annotation's "bar"
2. how to goto method's declaration position
By now, I just create a Action into EditorPopupMenu, and can get PisMethod list by method name by com.intellij.psi.PsiClass#findMethodsByName(java.lang.String, boolean)
Please sign in to leave a comment.
This is done via PSI References https://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/psi_references.html see bottom of page for links to sample
Hi,Yann:
Thank you very very much,your answer is helpful, I have solved the problem just now. The sample is very helpful.
It's a hard work for a new one. I got many questions when I wrote my plugin, then you can't find the information via Google, Document,and so on.So I have to read IDEA CE source code, try to find WHAT WHY HOW.
I have some suggestions as a developer:
IDEA is a GREAT system, thank all the developers!
1. There is no such overview, but we're planning on adding more high-level diagrams for different areas of functionality
2. We're working constantly on adding Javadoc where it's missing, unfortunately this is a long-running task and will most likely never be fully complete. If you get stuck on something, maybe try Slack where there's many developers helping each other https://intellij-support.jetbrains.com/hc/en-us/community/posts/360006494439--ANN-JetBrains-Platform-Slack-for-Plugin-Developers
1. It will be fine.I will keep watching.
2. Yes, you're right, adding Javadoc is a long-running task. Slack is cool place, glad to try.
Thank you.