How do I register an additional handler/action/command for "Open Declaration" (aka F3) in a plugin?
I want to use F3 on String literals in Java code to navigate to the files declaring resource bundle keys. I already have a context menu action ready that does the job. All that's missing is a way to bind it to the key that users are used to.
Extra credit for a complete annotated list of extension points. I'm getting tired of having to spend half a day to find the extension point I have to use for a feature. And by "annotated" I mean more than
Identifier: org.eclipse.ui.workbench.texteditor.quickdiffReferenceProvider
Description: Allows contributors to add reference providers for the quick diff display.
When your cursor is on the method press F3 , eclipse will take you to the declaration . By default it's bound to F3 , but you can rebind it to a different key, go to Windows >> Preferences >> Keys, and change the Open Declaration binding... Elye M. Elye M.
f3 — jumps to include file or variable declaration/definition. if you want to use the mouse for this, press the ctrl key and hover over the source with the mouse. shortcut for navigate > open declaration .
Open declaration will attempt to navigate to the exact definition of the selected element if the selected element is a reference or a declaration. Otherwise, it will attempt to navigate to a declaration of the selected element.
Press Alt + Left Arrow and Alt + Right Arrow like you would in a web browser.
See section on keybindings in Eclipse Commands tutorial for detailed instructions how to implement command handlers and bind them to keys, menus and toolbars.
There is a full list of extension points provided in Eclipse help, though you have to drill down to get the full description and code samples. There is also an "Add extension point" wizard in plugin editor, which shows a brief description, link to the full help and for some extension points even have predefined templates.
Perhaps you know this, but although the F3 keyboard shortcut won't take you to the declaring resource bundle key, there are two similar things that do work:
Obviously, these both require use of the mouse; if you are a keyboard-only kind of person, you might not be happy with these.
This doesn't directly answer your question, but I hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With