Here are some of the more interesting or significant changes made to the Java development tools for the 2.1 release of Eclipse since 2.0:
Java Editor is more customizable |
Java > Editor preference page offers more configuration options:
|
Sticky hovers | You can open a hover in a scrollable and resizable window by pressing F2. You can select and copy content from this window. |
Prominent status indication |
Both the Default Text editor and
the Java editor now display a prominent marker in the upper right corner
to indicate that the file contains errors or warnings.
|
Find in file |
The Search menu group contains a new command (Occurrences in File)
to search for all occurrences of types, fields, methods and local variables
inside the compilation unit or class file in which the element is declared.
Consistent with other search commands, markers are generated and presented
as annotations in the editor. Entries in the Search Results view have different
icons for read and write access. In this example you see the search results
for "fName" in "TestCase.java".
|
More Quick Fixes |
There are now Quick Fixes for additional Java problems. Click the light bulb in the left margin of the Java editor, press Ctrl+1 or select Edit > Quick Fix from the menu to:
Other compiler-detected problems that can be fixed using Quick Fix include:
|
Quick Assist |
The Quick Fix actions are now available even when there are no errors. Position the caret in an identifier and press Ctrl+1 (Edit > Quick Fix) to invoke Quick Assist.
|
Code assist improvements |
|
Improved Java outline view | You can adjust the Java outline to show just the members of the compilation
unit's main type by pressing the
|
Hyper-linked Java code | While hovering over Java code, pressing the Ctrl key and moving the mouse turns class, method, and field identifiers into clickable links to the corresponding declaration. This option can be configured via the Java > Editor > Navigation tab. |
Scroll to the next member | Use Ctrl + Shift + Arrow Down (Navigate > Go To > Next Member) and Ctrl + Shift + Arrow Up (Navigate > Go To > Previous Member) in the Java editor to quickly navigate between member methods, fields, initializers, and types. |
More errors detected on the fly | The Java editor now annotates more error types, including uncaught exceptions and unused variables, which require detailed flow analysis. |
In-place outlines |
Press Ctrl+F3 (Navigate
> Open Structure) in the Java editor to pop up an in-place outline
of the element at the current cursor position. Or press Ctrl+O (Edit
> Open Structure) to pop up an in-place outline of the current source
file.
|
Hover information in editor overview |
The Java editor overview ruler (on the right side of the frame) now shows hover information for problem annotations.
|
Class file editor |
The class file editor has caught up with the compilation unit editor. It now supports cursor-line highlighting, line numbers, annotation highlighting, overview ruler, print margin, semantic selection expansion, and keyboard navigation between the members of the class file. |
Threads and Monitors view | The debugger's new Threads and Monitors view shows which threads are holding locks and which are waiting to acquire locks.
|
Instance breakpoints and watchpoints | You can now set breakpoints &
watch points specific to a particular object instance. In the Variables
view, choose Instance Breakpoints... from the variables context menu.
|
Improved conditional breakpoints | A traditional conditional breakpoint is triggered by a boolean expression
evaluating to "true". It is now possible to declare conditional
breakpoints that are triggered whenever the value of an expression changes.
In addition, code assist is now available when typing the in the conditional
expression.
|
Stepping into selections | The Java debugger now allows you to step into a single method within a series of chained or nested method calls. Simply highlight the method you wish to step into and select Step into Selection from the Java editor context menu. |
Watch items | You can create watch item by selecting an expression in the Java editor and using the Watch action (available in the context menu, and in the Run menu). As well, a watch item can be created by selecting a variable and using the Watch action. |
Step filters | Step filters are more convenient to use now that a Step With Filters action has been added to the debug toolbar and menu. As well, actions have been added to the debug context menu to streamline the creation of step filters for the type or package associated with the selected stack frame. |
Word wrap in Variables view | The details area of the debugger's
Variables and Expressions views now supports word wrap, available
from the view drop-down menu.
|
Stack trace hyperlinks | Java stack traces in the console now appear with hyperlinks. When you place the mouse over a line in a stack trace, the pointer changes to the hand and the stack trace is underlined. Pressing the mouse button opens the associated Java source file and positions the cursor at the corresponding line. |
Console buffer size | The Console view retains only the most recent N characters of output (default is 80K). The console buffer size can be configured via the Debug > Console preference page. |
Filtering constants & statics | Two new actions are available in the pull-down menu of the Variables view - Show Constants & Show Static Variables. These actions toggle the visibility of static final and static variables. |
Faster stepping | The performance of the debugger's Run > Step over (F6) action has been improved. You should notice the difference when holding down the F6 key or rapidly clicking the Step Over button. |
Instruction pointer |
When debugging, the Java editor now indicates the currently executing line with an arrow in the left margin. This arrow is solid for the top stack frame and hollow for non-top stack frames. |
New Refactorings |
Many new refactoring actions are available:
|
Improved Refactorings |
Several refactoring actions have been improved:
|
New lightweight refactoring UI |
Activating any Java refactoring operation now shows a small starting dialog to gather information needed to perform the refactoring. Click OK to execute the refactoring without further ado, or click Preview to see its effects before deciding whether to go ahead. |
More flexible Java source and output paths |
The Java build path setup offers improved flexibility:
|
Project-specific Java compiler settings | In addition to workspace-wide Java compiler preference settings (Java > Compiler), you can now configure these for a specific Java project through the new Java Compiler property page on each Java project. |
More Java compiler options |
![]() |
Improved prefix and suffix configuration for variables |
In addition to configuring the prefix
or suffix for fields, you can now specify the prefix or suffix for
static fields, parameters, and local variables. These settings on the Java
> Code Generation preference page are used in code assist, quick fix,
and refactoring whenever a variable name needs to be computed.
|
Customizable code generation |
The Java > Code Generation
preference page allows you to customize generated code and comments
in a similar way to normal templates. These code templates are
used whenever code is generated. (The comments replace the existing 'filecomment'
and 'typecomment' templates used for code generation.)
|
Configurable task tags |
The Java > Task Tags preference page is used to
configure the workspace-wide presentation of task tags appearing in Java
comments. You can also configure these tags on a per-project basis via the
Java Task Tags property page on each Java project.
In the editor you'll see: |
Sort members |
There is now a Sort Members action on the context menu of Java compilation units and top level types that rearranges the members of a compilation unit according to the category order defined in the Java > Appearance > Member Sort Order preference page. |
Add Delegate Methods dialog |
You can now easily generate delegate methods (methods that delegate to a method provided by an instance variable) by using the Source > Generate Delegate Methods action. The action is available on all types with fields.
|
Package Explorer improvements |
Non-Java projects are now
presented in the Package Explorer view. A filter is provided to filter out
non-Java projects, and the open/close interaction is now consistent with
the resource Navigator view.
Libraries (such as the JRE system library) are now presented as a single node with one or more JARs as children. |
Hierarchical vs. flat layout of packages |
An option on the Java Packages view (and the Package Explorer view) allows you to change the way packages are displayed. Hierarchical displays packages in a tree, with sub-packages below packages; Flat displays them in the standard arrangement, as a flat list where all packages and sub-packages are siblings. Below is an example of the hierarchical layout:
|
Logical packages |
The Java Packages view (Java Browsing perspective) coalesces packages of the same name across source folders within a project. This shows a view of a logical package. |
Type hierarchy view supports grouping by defining type |
The type hierarchy method view lets
you sort the selected type's methods by its defining types. For example,
for AbstractList you can see that it contains methods that were
defined in Object , Collection , and List :
|
More filters for the Package Explorer and Project views |
There are more filters for Package Explorer and Projects views:
|
Multiple method restore |
You can now restore multiple Java
elements from the local history in one operation by selecting Restore
From Local History from the context menu. In the left pane of the dialog,
check the elements you want to restore and for each checked element select
a history entry from the right hand side.
|
Running all unit tests |
The JUnit test runner now gives you an easy way to run all tests in a specified Java project, source folder, or package. |
Finding unit tests | The new JUnit action Navigate > Go To > Referring Tests finds and navigates to tests that reference a particular type or method. |
Run as JUnit test |
Select a JUnit test method in a view and choose Run > Run As > JUnit test. This creates a launch configuration to run the selected test. |