开发者

How to quickly navigate between Java class method definitions in a large class without the 'Find' dialog in Eclipse?

开发者 https://www.devze.com 2023-01-22 14:19 出处:网络
I use what I think is a typical layout in Eclipse: my workspace contains the Project Explorer on the left and the Java editor window taking up most of the screen, with the small console window at the

I use what I think is a typical layout in Eclipse: my workspace contains the Project Explorer on the left and the Java editor window taking up most of the screen, with the small console window at the foot of this editor pane.

When I open a ver开发者_JS百科y long Java class, containing a large number of method definitions, in the editor pane, it can take a long time to move between methods. I use CTRL-F to open the Find dialog and then type in the name of the method if I can remember it.

Is there a better way to navigate between method definitions in a large class in Eclipse?


Ctrl+O will open a dialog with the methods (and variables) list. It supports "advanced" :-) searching so you can just type a few letters of the method's name


Use the Outline View.


I use a layout much like yours but I keep the Outline panel open in it beneath the project/package explorer. This makes it easy to see the project's outline as well as the current editor's outline at a glance.

In addition to the Ctrl+O option for a quick outline, one can type (on a Mac) Cmd-Alt-Q then O to focus the Outline view. Once focus is in the Outline view, you can use the arrow keys or letter keys to navigate through the list of methods.

Cmd-Alt-Q is useful for opening many of the views. In my Eclipse Helios right now, a momentary delay after playing the chord presents a quick list of many different views, many of which have their own hot key.

Finally, you can use the "Next/Previous member" chord to jump to the previous or next method definition in the file. Again in my Helios build, the Next member key is Ctrl-Alt-down . Yours may be different.

To find out what the keystrokes are in your Eclipse build, open the eclipse preferences. Use the searcher to search for 'keys'. Open the configuration for Keys . Then in the keys search bar look for "member". There should be an item for "Next member" with a bound shortcut key/chord. Browsing the list of hotkeys is a great way to improve Eclipse productivity in the long run ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消