Basic tips
This section includes tips for using the Java development environment more
efficiently.
-
You can run code with compile errors.
-
You can recover the previously saved versions of an individual method or
field as follows:
Select a method or a field in the Outline or Hierarchy view and execute Replace With > Local history from the pop-up menu.
This will show you the history of this particular method or field and you can select which version should replace the one in the workspace.
-
You can use a File search to do a global Find and Replace within all
files. Choose a File search (the File tab in the
search dialog). Then right-click on an entry in the Search view
and use the Replace or Replace Selected
command in the pop-up menu.
-
You can add Javadoc comments to a set of members by selecting them and choosing Add Javadoc Comment from the pop-up menu.
-
You can create method stubs by dragging and dropping methods from one class to another with Ctrl+Shift (Windows) held down (to create a 'link').
-
Similarly, you can add a deleted method or field by using the local history.
Select a type in the Outline view and execute Restore from Local History from the pop-up menu.
-
You can organize imports by selecting a set of packages and choosing Organize Imports from pop-up menu or Source > Organize Imports
from the menu bar.
-
You can change the behavior of Organize Imports in Window > Preferences > Java > Organize Imports. Using 0 in the number field creates all
imports with
*
(i.e. imports-on-demand).
See also these sections for tips in specific areas.
Hierarchy view
Search
Java Editor
Code Assist
Templates
Refactoring and restructuring
Java Project Classpath
Debugging
JUnit