现在的位置: 首页 > 综合 > 正文

Some useful Eclipse hotkey

2013年10月11日 ⁄ 综合 ⁄ 共 1799字 ⁄ 字号 评论关闭
 
  1. Control-Shift-T: Open type. Forget manually navigating through the source tree unless you're procrastinating.
  2. Control-Shift-R: Open resource (looks for more than just Java files).

    A tip to go along with these first two combinations is in the Navigator view, accessed from the yellow double-arrowed Link With Editor icon. This will make the file you open appear in the navigator hierarchy, which is often good orientation information. Turn it off if things get too slow.

  3. Alt-left arrow: Go back in navigation history. Works like a Web browser's back button and comes in handy after jumping around using F3.
  4. Alt-right arrow: Go forward.
  5. Control-Q: Go to last edit location. This key combination is also handy after you've been jumping around the code, especially if you've drilled down too deeply and have forgotten what you were doing.
  6. Control-Shift-G: Find references in workspace. Prerequisite to most refactors. For methods, this key combination is basically the opposite of F3, allowing you to navigate backwards up a method stack to find a method's callers. A feature related to this is turning on occurrence marking. Go to Window, then Preferences, then Java, then Editor, then Mark Occurrences and select a few checkbox options. This highlights all occurrences in the code when you click an element designated for marking. I personally only use Mark Local Variables. Beware: Enabling too many highlights can slow Eclipse.
  7. Control-Shift-F: Reformat code (according to code style settings). Our team agreed on a coding style, and we posted the Eclipse code style-rules files to our wiki. To do that, we sat together in Eclipse and went to Window, then Preferences, then Java, then Code Style, and configured Code Formatter, Code Templates, and Organize Imports. We used the Export function in each of these screens to generate the config files. We put these on the wiki and everyone imported them into their Eclipse.
  8. Control-O: Quick outline. Within the editor, this key combination allows you to jump to a method or attribute by typing a few letters of the name.
  9. Control-/: Comment/uncomment a line. Can also work on many lines at a time.

抱歉!评论已关闭.