Eclipse 2.1 - New and Noteworthy

The following are some of the more interesting or significant additions in the Eclipse 2.1 release.

Eclipse Platform
Java Development Tools
     Java Editor
     Java Debugger
     JUnit Integration
Plug-in Development Environment

Eclipse Platform

Tips and tricks For some helpful ideas for increasing your productivity, use Help > Tips and Tricks then chose which page you are interested in.

Tips and tricks selection dialog

User customizable
key bindings
You can now customize key bindings using Workbench > Keys preference page. Emacs users will find a predefined set of key bindings awaiting them.

Key bindings preference dialog

Editor navigation history Workbench editors now keep a navigation history. If you open a second editor while you're editing away, you can use Navigate > Back to get back, or press the back button on the workbench toolbar. The back button on your mouse also does the trick as along as it sends the standard Alt + Left Arrow key sequence.

Editor navigation history

Improved default text editor The default text editor now supports line numbers, cursor-line highlighting, print margin, annotation highlighting, and an overview ruler. All of these can be configured from the Workbench > Editors > Text Editor preference page.

Test editor preference dialog

Improved editor linking behavior The resource Navigator view is no longer tightly linked to the currently open editor by default. This means that closing or switching editors does not change the selection in the Navigator view, which many found disorienting. Toggle the Link with Editor button in the view toolbar to tie the Navigator view (or similar views) to always show the current file being edited.

Package explorer linked with editor

Better UI for editor / view synchronization The new Navigate > Show In command provides a uniform way to navigate from an open editor to a view showing the corresponding file (e.g., in the resource Navigator view), or from a file selected in one view to the same file in a different view (e.g., from the resource Navigator view to the Package Explorer view).

Navigate > Show In menu

Ant view There is a new Ant view (Window > Show View > Ant) that makes it easier to run Ant buildfiles. The Ant view allows you to view your Ant buildfiles in one place and simplifies running a single Ant target. The view includes a search button for finding Ant buildfiles in the workspace to add to the view.

Ant view

Ant editor

There is a new Ant editor that makes it easier to edit Ant buildfiles. The Ant editor provides content assist, syntax highlighting, an outline, and error reporting.

Ant editor

External tools & launch configurations

External tools now use debugger-style launch configurations. The Run > External Tools drop-down menu now appears and works in the same fashion as the run and debug drop-down menus. The output from external tools now appears in the standard Console view. External tools can now be run in the background, by a separate thread. This means that you can let an Ant build run or launch an external program and still continue to work in the Eclipse IDE.

Launch configuration dialog

More flexible project layouts There is now improved support for dealing with externally imposed restrictions on how the files in a workspace project are laid out in the local file system. When creating a folder or file, you can link it to an existing location in the file system outside of the workspace. This is done using the Advanced section on the New Folder and New File wizards. These linked resources are useful for integrating with external libraries or source code directories that cannot readily be copied into an Eclipse workspace.

Linked resource


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.

Java Debugger

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.

Monitors view showing deadlock cycles


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.

Instance filter dialog

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.

Breakpoint properties dialog

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.

Stepping into selection

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.

Word wrap action in Variables 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.

Stack trace with hyperlinks in Console view

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.

Variable filter actions in Variables view drop-down menu

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.

Instruction pointer appears in editor ruler


New Refactorings

Many new refactoring actions are available:

  • Move Instance Method: this refactoring allows you to move the method to the declared class of one of its parameters or fields. This creates a new method and converts the old method into a delegate (passing it a pointer to this if necessary).
  • Push Members Down: this refactoring allows you to move a set of methods and fields from a class to its subclasses.
  • Inline Method: this refactoring inlines calls to a particular Java method, either at a selected call site or everywhere the method is called. It is available polymorphically via the Refactor > Inline menu entry.
  • Inline Constant: this refactoring inlines uses of a particular Java static final field, either at a selected reference site or everywhere the field is referenced. It is available polymorphically via the Refactor > Inline menu entry.
  • Extract Constant: this refactoring creates a static final field from the selected expression and substitutes a field reference, and optionally rewrites other places where the same expression occurs.
  • Convert Local Variable to Field: this refactoring allows you to turn a local variable into a field. If the variable is initialized on creation, then the operation moves the initialization to the new field's declaration or to the class's constructors.
  • Convert Anonymous Class to Nested Class: if an anonymous inner class in your code is too large, this refactoring will help you convert it to a member class.
  • Convert Member Type to Top Level Type: this refactoring creates a new Java compilation unit for the selected member type, updating all references as needed. For non-static member types, a field is added to allow access to the former enclosing instance.
  • Extract Interface: this refactoring creates a new interface with a set of methods and makes the selected class implement the interface, optionally changing references to the class to the new interface wherever possible.
  • Use Supertype Where Possible: this refactoring replaces occurrences of a type with one of its supertypes after identifying all places where this replacement is possible.

Improved Refactorings

Several refactoring actions have been improved:

  • Change Method Signature: this refactoring is a replacement for the Modify Parameters refactoring. It allows you to change a method's visibility and return type, and add, remove, rename and reorder method parameters.
  • Pull Members Up: this refactoring has been improved in several ways
    • you can pull members up more than 1 level in the hierarchy
    • instead of pulling them up, you can declare methods as abstract in the selected supertype
    • you can compute the smallest set of members that need to be pulled up together in order to satisfy visibility constraints
  • Extract Method: you can reorder and rename parameters of the extracted method.
  • Rename and Move Refactorings: when renaming a Java type or package (or when moving a type to a different package), the fully qualified name of the element can now be updated in non-Java files as well.

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.

New lightweight refactoring dialog


More flexible Java source and output paths

The Java build path setup offers improved flexibility:
  • Exclusion filters let you exclude certain source files within a source folder from being compiled.
  • Source folders can now be nested - use an exclusion filter on the parent folder to exclude the sub-folder you wish to add to the build path.
  • The location of generated class files can be set individually for each source folder.
  • You can also use linked folders as source folders, class folders or output folders.

Java Build Path property page

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

  • Java projects that depend on each other can usually be compiled successfully in a single build action. In order for cycles to be allowed, you'll need to lower the severity associated with circular dependencies on the Java > Compiler preference page.
  • The Java compiler can now warn of unused private method, field, or type declarations. This option helps you find dead code and some subtle errors.
  • The Java compiler now gives you a warning when you appear to be assigning a variable with its own value. This helps catch a subtle mistake in setter methods and constructor declarations where the name of a parameter is close to the name of a field. This option can be configured via the Java > Compiler > Style preference page. Here is an example:
Assignment with no effect

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.

Name conventions preference page

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

Code and Comments tab in Code Generation preference page

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.

Task Tags preference page

In the editor you'll see:

Editor with a TODO task

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.

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.

Add Delegate Methods dialog

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.

Non-Java projects in Package Explorer

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:

Hierarchical layout in Package Explorer

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.

Logical packages in Java Packages view

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:

Sort members by the defining type in the type hierarchy

More filters for the Package Explorer and Project views

There are more filters for Package Explorer and Projects views:

Package Explorer filters

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.

Multi-method restore

JUnit integration

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.

JUnit launch configuration

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.


Plug-in Development Environment

Improved way to reference dependent plug-ins The new Plug-in Development / Java Build Path Control preference controls whether new plug-in development projects will use a dynamically computed build classpath entry rather than an explicit list of required plug-in JAR libraries (the default). Turning this preference on makes the Java project build classpath much less fragile, and visually groups together libraries for required plug-ins. It also makes the classpath highly dynamic in that it instantly reacts to the changes in the self-hosting style (external plug-ins versus imported binary projects).

Project using Required plug-in entries container

Exporting deployable plug-ins and features There are new File > Export wizards for exporting plug-in and features. Choose File->Export->Deployable plug-ins and fragments to export selected plug-ins to a ZIP file that can be easily unzipped into any Eclipse-based product. Similarly, choose File > Export > Deployable features to export selected features and their plug-ins.

Importing with linking Importing external plug-ins and fragments can be much faster and would not greatly increase the size of your workspace if you import with linking.  This new option can be used by unchecking the 'copy plug-in content into your workspace area' checkbox in the 'Import External Plug-ins and Fragments' wizard.  'Importing with linking' means that the import operation will not copy the resources being imported into your workspace.  It will simply create links to the files being imported.  You will be able to browse these linked resources, as if they had been copied into your workspace.  However, they are physically not there on your file system, so you will not be able to modify them.  Beware of operations that depend on files being physically in your workspace, as they will not work on linked resources.

Support for creating update sites PDE now supports building and maintaining Update Manager update sites. Use the new project wizard Plug-in Development > Update Site Project to create a dedicated project with all the relevant files including the site map (site.xml) file. The site map editor creates the required entries in the map and also builds the needed feature and plug-in JARs. Once built, the site is operational directly from the workspace and can be tested using Update Manager (Help > Software Updates > Update Manager). And with Eclipse FTP/WebDAV Support installed, you can upload everything to a remote update server.

update site editor

Manifest file validation Manifest (plugin.xml/fragment.xml) files in plug-in projects that have a PDE nature can now be validated to flag semantic errors such as unknown extension points, illegal attributes for extensions, missing required attributes for extensions, etc.  The list of possible problems that PDE can detect are found on the Plug-ins tab of the Plug-in Development > Compilers preference page, where the level for each problem can be set to one of 'Ignore', 'Error', or 'Warning'.

Plug-in search PDE contributes a tab to the Search dialog, where you can search for plug-ins, fragments, extension points and extensions.  Scope of search can extend beyond the workspace to external plug-ins and fragments.

Compute dependency extent PDE can now easily determine the reason why your plug-in depends on plug-in X.  Through the function Compute Dependency Extent found in the context menu of the Dependencies page of the manifest editor, PDE will find and display all the Java types and extension points provided by plug-in X to your plug-in.  This is a good tool to determine the extent to which you need this plug-in, and it might help you refactor your plug-ins.  Also, it would help you check if you are using any internal (non-API) types of plug-in X, which might be undesirable.

Find unused dependencies This function is available through the context menu of the Dependencies page of the manifest editor.  It will find all the plug-ins listed as dependencies for your plug-in, but need to be removed because they are unused by your plug-in.  The removal of such stale dependencies will help minimize your plug-in's list of dependencies and hence improve performance.

Dependencies view PDE now provides a Dependencies view, which can be invoked by selecting a plugin.xml/fragment.xml file and choosing Open dependencies from the context menu.  It will display a tree showing all the plug-ins needed to be activated before you plug-in is activated.

Extending Java search scope Java search scope is limited to workspace projects and the external libraries they reference.  In order to add arbitrary plug-in libraries to the search scope, go to the Plug-ins view.  Select the external projects of choice and choose Add to Java Search from the context menu.

Copyright IBM Corporation and others 2000, 2003