Tips and Tricks

The following tips and tricks give some helpful ideas for increasing your productivity.

Workbench

Managing screen real estate with fast views Use fast views to free up screen real estate while keeping views easily accessible. Clicking on the icon for a fast view temporarily reveals it over top of the other views. The fast view retracts as soon you click outside of it. The Fast View command in the view's system menu toggles whether it is a fast view. You can also create a fast view by dragging a view onto the shortcut bar at the left.
Opening editors using drag and drop You can open an editor on an item by dragging the item from a view like the Navigator or Package Explorer and dropping it over the editor area.
Restoring deleted resources Select a container resource and use Restore from Local History to restore deleted files. You can restore more than one file at one time.

Restore from local history dialog

Like to start afresh each session? A setting on the Workbench > Editors preference page closes all open editors automatically whenever you exit. This makes start-up cleaner and a bit faster.
Better UI for editor / view synchronization The 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 Packages Explorer view).
User customizable
key bindings
If you find yourself repeatedly doing some command, you might be able to streamline things by assigning a key sequence to trigger that command. Assigning new key bindings, and viewing existing bindings, is done from the Workbench > Keys preference page.

Key bindings preference dialog

Faster workspace navigation Navigate > Open Resource (Ctrl+Shift+R) brings up a dialog that allows you to quickly locate and open an editor on any file in the workspace. In the same vein, Navigate > Go To > Resource expands and selects the resource in the Navigator view itself, if it has focus.
Tiling the editor work area You can use drag and drop to modify the layout of your editor work area. Grab an editor tab and drag it to the edge of the editor work area. The arrow dock icons (e.g., Left arrow icon) indicate which way the editor work area will split.

Tiled editor work area

Now where was I? Workbench editors keep a navigation history. If  you open a second editor while you're editing away, you can press Navigate > Backward (Alt+Left Arrow, or the Left arrow icon back arrow on the workbench toolbar) to get back. This makes working with lots of open editors a whole lot easier. 
Incrementally find a string Use Edit > Incremental Find Next (Ctrl+J) or Edit > Incremental Find Previous (Ctrl+Shift+J) to enter incremental find mode, and start typing the string to match. Matches are found incrementally as you type. The search string is shown in the status line. Press Ctrl+J or Ctrl+Shift+J to go to the next or previous match. Press Enter or Esc to exit incremental find mode.
Go to last edit location Navigate > Go to Last Edit Location (Ctrl+Q) takes you back to the place where you last made a change. A button marked Go to last edit position icon shows up in the toolbar when the Editor Navigation command is enabled. If this command does not appear in your perspective, you can add it by selecting Window > Customize Perspective > Other > Editor Navigation.
Linking view to current open editor

The resource Navigator view (and similar views) is not 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. Toggling the Link with Editor button in the Navigator view toolbar ties the view to always show the current file being edited.

Package explorer linked with editor

Copying and moving resources You can drag and drop files and folders within the Navigator view to move them around. Hold down the Ctrl key to make copies.
Importing files You can quickly import files and folders into your workspace by dragging them from the file system (e.g., from a Windows Explorer window) and dropping them into the Navigator view. The files and folder are always copied into the project; the originals are not affected. Copy and paste also work.
Exporting files Dragging files and folder from the Navigator view to the file system (e.g., to a Windows Explorer window) exports the files and folders. The files and folder are always copied; workspace resources are not affected. Copy and paste also work.
Global find/replace Use Search > File from the main menu to search for text which should be replaced. In the Search view, select the entries that need to be replaced and choose Replace Selected from the context menu..
Collapsing all open items Use the Collapse All button on the toolbar of the Navigator view (and similar views) to collapse all expanded project and folder items.

Collapse all button on navigator toolbar

Open editors with a single click Use the Open mode setting on the Workbench preference page to activate single click opening for editors. In single click mode, a single click on a file in the Navigator view (and similar views) selects and immediately opens it.
Next / previous navigation You can use Ctrl+. and Ctrl+, to navigate to the next or previous search match, editor error, or compare difference. These are the shortcut keys for Navigate > Next and Navigate > Previous.
Describing your configuration When reporting a problem, it's often important to be able to capture details about your particular setup. The Configuration Details button on the Help > About Product dialog opens a file containing various pieces of information about your setup, including plug-in versions, preference settings, and the contents of the internal log file. You can save this, and attach the file to your problem report.
Workspace project management Use the Project > Close Project command to manage projects within your workspace. When a project is closed, its resources are temporarily "offline" and no longer appear in the Workbench (they are still sitting in the local file system). Closed projects require less memory. Also, since they are not examined during builds, closing a project can improve build times.
Restoring a perspective's layout Rearranging and closing the views in a perspective can sometimes render it unrecognizable and hard to work with. To return it to a familiar state, use Window > Reset Perspective.
Pinning editors When the Close editors automatically preference is active (found on the Workbench > Editors preference page), you can stop an editor from being closed by using the Pin Editor button which appears in the workbench toolbar.

Pin editor button

Importing an existing project If you import an existing project, the resources files for the project are not copied. If you check the properties of the project, you'll see that the project's location in the file system is the location you specified.
Reordering editor tabs You can rearrange the order of open editors by using drag and drop. Grab the editor tab and drag it to the position you want the editor to appear. When positioning editors, the stack icon Stack icon indicates a valid spot to drop.
Deleting completed tasks Use the Delete Completed Tasks command in the Task view context menu to remove all completed tasks from the Tasks view. This is more convenient than individually selecting and deleting completed tasks.
Quick navigation between views, editors and perspectives A look at the Window > Keyboard Shortcuts menu reveals a number of ways to quickly navigate between the various views, editors, perspectives, and menus in the workbench. These commands have keyword accelerators such as Ctrl+F6 for switching between editors, Ctrl+F7 for switching between views, Ctrl+F8 for switching between perspectives, and F12 for activating the editor.

Keyboard shortcuts menu

Maximizing a view or editor You can maximize a view or editor by double-clicking on the view's title bar or the editor's tab. Double-click again to restore it to its usual size.
Viewing resource properties Use the Properties view (Window > Show View > Properties) when viewing the properties for many resources. Using this view is faster than opening the Properties dialog for each resource.

Resource properties dialog

Quickly find a resource Use the Navigate > Go To > Resource command to quickly find a resource. If the Go To > Resource command does not appear in your perspective, you can add it by selecting Window > Customize Perspective > Other > Resource Navigation.
Extra resource information Label decorations are a general mechanism for showing extra information about a resource. Use the Workbench > Label Decorations preference page to select which of the available kinds of decorations you want to see.
Filtering resources The Navigator and Tasks views both support filtering of their items. You control which items are visible by applying filters or working sets. The Filters commands are found on the view menu. The working set is selected using the Select Working Set command in the Navigator view menu. In the Tasks view, a working set can be selected from within the Filters dialog.
Customizing toolbar and menu bar You can customize which items appear on the main toolbar and menu bar using the Window > Customize Perspective command.

Customizing toolbar and menu bar

Quick fix in Tasks view You can use the Quick Fix command in the Tasks view to suggest an automatic fix for the selected item. The Quick Fix command is only enabled when there is a suggested fix.
Creating path variables When creating a linked folder or file, you can specify the target location relative to a path variable. By using path variables, you can share projects containing linked resources without requiring team members to have exactly the same path in the file system. You can define a path variable at the time you create a linked resource, or via the Workbench > Linked Resources preference page.

Path variables dialog

Comparing zip archives with each other or with a folder Select two zip archives or one archive and a folder in the resource Navigator view and choose Compare With > Each Other from the view's popup menu. Any differences between the two inputs are opened in a Compare editor. The top pane shows all the archive entries that differ. Double clicking on an item performs a content compare in the bottom pane.

This works in any context where a file comparison is involved. So if a CVS Synchronize operation lists an archive in the resource tree, you can double click on it in order to drill down into changes within the archive.

Ant

Running Ant targets You can double click on a target in the Ant view to run it (equivalent to selecting the target and choosing the Run command from the context menu).
Terminating Ant builds The Terminate command in the console (or Debug view) can be used to terminate an Ant build running in the background.
Ant output and hyperlinks The output from Ant builds is now written to the Console view in the same hierarchical format seen when running Ant from the command line. Ant tasks (for example "[mkdir]") are hyperlinked to the associated Ant buildfile, and javac error reports are hyperlinked to the associated Java source file and line number.

The Console now supports hyperlinks for javac and jikes as well as the Eclipse Java compiler. All such error reports are hyperlinked to the associated Java source file and line number.

Ant can find it When the Run > External Tools > Run As > Ant Build launch shortcut is used, it searches for the buildfile to execute starting in the folder of the selected resource and working its way upwards (some will recognize this as Ant's "-find" feature). The names of buildfiles to search for are specified in the Ant preference page.

Help

Help bookmarks You can now keep your own list of bookmarks to pages in help books. Create a bookmark with the Bookmark document icon Bookmark Document button on the toolbar of the Help browser. The bookmarks show up in the Bookmarks icon Bookmarks tab.
Help working sets Help working sets allow narrowing searches down as far as a section of a book. Working sets are persisted from one session to the next, and can be used in workbench help searches or from the Help browser.

Help working set dialog

Configuring a custom help browser If you have a favorite web browser, you can configure Help to use it instead of the default browser, via a setting on the Help preference page.

Team - CVS

CVS Watch/Edit The "edit" portion of CVS Watch/Edit is now supported. Through settings on the Team > CVS > Watch/Edit preference page (which must be set before the projects are added to your workspace), you can choose to automatically notify the CVS server whenever you start to edit a file. In turn, the CVS server will notify others on the watch list for that file. When you go to edit a file, you are warned if there are others editing the same file. Team > Show Editors on a file's context menu lists everyone currently working on the file. There are also Team > Edit and Unedit commands.
Working set for imported team projects There is now an option to create a working set for projects imported into the workspace via Import > Team Project Set. This works for all types of repositories.

Team project set import dialog

CVS now supports working sets Users can now define working sets which will limit the number of projects shown in the CVS Repositories view.
Comparing different versions Select any folder or file in the CVS Repositories view and choose Compare With from context menu to compare it against some other version.
Restoring deleted files from CVS Deleted files can now be queried and restored from the CVS repository using the Team > Restore from Repository command, which is available on CVS projects and folders.
CVS Quick Sync A new "quick sync" action has been added to the CVS action set. The action lets you select which CVS projects to synchronize. A new toolbar button shows up in the CVS Repository Exploring perspective, but you can customize other perspectives to place it within easy reach.
More flexible CVS checkouts A new Checkout Into action lets you check out a folder into an existing project. Also, any shared folder in a project can be disconnected from CVS control so that it can be changed in or deleted from a workspace without queuing up outgoing CVS changes. And CVS projects can now be configured to not fetch absent directories on update.
My SSH server only support SSH2 protocol

Eclipse comes with a built-in SSH connection method called 'extssh'. However this method only supports SSH1 servers. If your server is running SSH2 and you want to use Eclipse to connect to that server you have two options:

  1. use a command line SSH client that supports SSH2 with the 'ext' connection method
  2. download a plugin created by JCraft that provides a SSH2 connection method.

To use the 'ext' connection method, download and install an SSH command line client for your operating environment. In the Team > CVS > Ext Connection Method preference page, configure the location of the SSH executable and how the executable is to be called. For the ext method to work the CVS client on your server must support the server mode. You can verify this by running cvs --help-commands and ensure that the server command is supported.

Working with a CVS Synchronize view that contains many conflicts

If your sync view contains many false conflicts (e.g. file that are marked as conflicting but whose contents are actually the same).

  1. From the view's toolbar menu select Compare File Contents.
  2. The synchronization will be refreshed and all false conflicts will be removed.
  3. For any remaining real conflicts you can either accept the remote contents Override and Update or release your file to the server Override and Commit.
Sharing your CVS lineup with others

You can save the list of projects shared with CVS into a team project set. This provides an easy way of re-creating your workspace with shared CVS projects.

  1. Once you have checked out the set of projects from the CVS repository, select File > Export from the main menu.
  2. Select Team Project Set from the list and then select the projects to be exported. The generated file can be shared with your team to allow quick setups of your development environment.
  3. To import the project set select File > Import and select Team Project Set. The projects will be checked out of CVS and a repository location will automatically be created.
Reverting a managed CVS file that was edited, but not committed

There are a two ways of doing this:

  1. Select the file and from the context menu select Replace With > Latest from HEAD.

or

  1. Select the file or a parent folder and from the context menu select Team > Synchronize with Repository.
  2. Next switch to incoming/outgoing mode using the toolbar button in the view.
  3. Select the file and from the context menu select Override and Update.
Show ancestor pane in 3-way compares

Whenever a CVS synchronization results in a conflict, it is helpful to view the common ancestor on which the two conflicting versions are based.

You can show the common ancestor by toggling the Show Ancestor Pane button in the compare viewer's local toolbar.

Show Ancestor Pane button in compare viewer

If you always want to have the ancestor pane open automatically for conflicts, you can check the option Initially show ancestor pane on the Text Compare tab of the Compare/Patch preference page.

 
Copyright IBM Corporation and others 2000, 2003