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)

0
4 comments

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:

  1. A whole runtime architecture picture : help pepole understand how it works, maybe it has in somewhere, but I haven't find it :)
  2. More comment in the IDEA CE source code: some code is clear for understanding. But, if some logics are complex, the detail comment will be very helpful.

IDEA is a GREAT system, thank all the developers!

 

0

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

0

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.

 

0

Please sign in to leave a comment.