Eclipse SHORT GUIDE

JavaLessons.com

Eclipse Tips

  1. Maximize a(n editor) window by double-clicking its tab. Same to restore it.
  2. 'Lost' a window and want it back ? Choose the 'Window' menu and 'Show view'.
  3. Here you can also add a Properties window, which often comes in handy, f.e. with files, to see their actual location, last time changed, etc.
  4. If you haven't got the import for a class yet, you can easily add it by clicking in the class name and pressing ctrl-shift-m.
  5. To rename a variable or method a.o. throughout your code, click in the name and press alt-shift-r.
  6. To add a main method, type main, ctrl-space.
  7. Want a default constructor ? Type the class name and ctrl-space.
  8. Make your own shorthand, like 'sop' for System.out.println() : Window, Preferences, Java, Editor, Templates. Lookup 'sysout', see how it's done and make your own abbreviation accordingly. Now you can use it by typing the abbreviation in the source code, followed by ctrl-space.
  9. To quickly undo actions : ctrl-z.
  10. If you want to rename the source because you typed (or pasted) code with another class name, you can click the error marker in the left margin on the line with the classname and then double-click 'Rename compilation unit etc.'
  11. Close projects that are not in use : right-click the project name, 'Close Project'.
  12. Hide closed projects by clicking the Package Explorer's 'triangle' button, choose 'Filters', check 'Closed projects'.
  13. Format code by selecting code and pressing ctrl-shift-f. ctrl-a to select all code.
  14. Set formatting rules to your liking by choosing : Window, Preferences, Java, Code Style, Formatter, Edit.
  15. By switching on the 'Toggle Mark Occurrences' button you can click, say, a variable name in your source and that name will be highlighted throughout your source. The right margin will show clickable icons indicating the positions in the source.
  16. Right next to the button mentioned there's the 'Show source of selected element only', handy when you have a lengthy source and want to limit the view to just one method.
  17. By rightclicking a variable name you can choose 'Occurrences in file,Identifier' and produce a double-clickable list of where and how the variable is used.
  18. You can drag the 'Outline' window by its tab to the bottom-left, below 'Package explorer', thus giving your editor window more room. Pay close attention to when to release the dragging mouse button, markers indicate where the window will end up.
  19. To see the actual folder/directory-structure, the .class files, in short, see the disk as it is, you can choose 'Window, Show View, Navigator' or 'Window, Open Perspective, Other, Resource'. Now you can easily switch between both views using the window tabs in case of the Navigator or the Perspective buttons at the top-right. This nicely combines with the Properties Window mentioned before.
  20. If you've added 'implements SomeInterface' to a class, you can click the error marker in the left-margin on the line with the classname and doubleclik 'Add unimplemented methods' to get the interface's methods in your source.
  21. Try ctrl-space at different positions, f.i. following 'new ' .



Eclipse SHORT GUIDE

JavaLessons.com

Copyright © 2007- SEMM (NL) All rights reserved. Author : Paul Hamaker
Contents and graphics contained throughout this web site have been registered.
Javatm is a Sun Microsystems, Inc. trademark.