Eclipse 2.1 - New and Noteworthy

Java Development Tools

Java Editor

Java editor is more customizable

Java > Editor preference page offers more configuration options:

  • you can configure the hover help in the Java editor via the Hovers tab
  • you can use the Typing tab to control automatic closing of parentheses, brackets, strings, and comments, for smart wrapping of strings, and other helpful Java-specific editor behavior
  • you can use the Annotations tab to customize the visual appearance of errors, warning, tasks, etc.

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.

Resizable hover help 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.

Editor with error indication marker in the upper right corner

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 "".

Editor and Search view showing occurrences of a field in a file

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:

  • Create missing constructors
  • Remove unused private methods, fields or types
  • Fix ambiguous imports (also suggests Organize Imports)
  • Create method in outer type (for methods in anonymous classes)
  • Add stubs for unimplemented methods
  • Add either a catch clause or a throws declaration to deal with an uncaught exception
  • Remove a catch clause to deal with an exception no longer thrown
  • Add unimplemented abstract methods

Other compiler-detected problems that can be fixed using Quick Fix include:

  • Instance fields used in a static context
  • Static methods or fields accessed via in a non-static way
  • Declaration of an abstract method in a non-abstract type
  • Non-visible method, field, type, or import
  • Non-externalized strings

Quick Fix window

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.

  • Linked rename is available on all identifiers.

    Linked rename Quick Assist

    Linked rename activates linked mode editing (as in templates), where changing the identifier changes all occurrences of that name within the source file.

  • You can replace catch clause with throws clause (available on the catch clauses).
  • You can assign expression statements to a new local variable or field (available on all expression statements). For example, vector.iterator(); will be transformed to
    Iterator iterator= vector.iterator();
    Variable name suggestions are provided by Quick Assist.
  • You can remove if/while/for/do statements or blocks and the indentation of the content will be automatically corrected.
  • You can surround multi-line selections with templates.

Code assist improvements
  • The Java compiler has improved the rating of the relevance of a proposal based on the type expected in the context. For instance, for StringBuffer sb= new [code assist], StringBuffer now appears first on the list.
  • Code assist in the Java editor now provides completion on keywords.

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 Go Into Top Level Type icon button (Go Into Top Level Type) in the Outline view toolbar.

Java Outline view toolbar

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.

Hyper-links in Java code

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.

Editor showing an error detected on typing

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.

Inplace outline

Hover information in editor overview

The Java editor overview ruler (on the right side of the frame) now shows hover information for problem annotations.

Overview ruler hover

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.


Previous Index Next

Copyright IBM Corporation and others 2000, 2003