Previous Page
Next Page

1.3. Setting Up Your Environment

The previous section briefly touched on customizing the current perspective, while this section goes into more detail on how to customize your Eclipse environment by changing various preferences. To customize Eclipse preferences, select the Window > Preferences... command, which opens the Preferences dialog (see Figure 1-13). Dozens of individual preference pages are grouped together in the hierarchy pane on the left side of the dialog. General workbench preferences are in the General group, while Java preferences are in the Java group. At the top of the dialog, a convenient filter field makes it easy to quickly find specific preference pages.

Figure 1-13. Preferences dialog.

Many hundreds of individual preferences can be accessed from the Preferences dialog. Changing a value and clicking the Apply button locks in changes and allows you to continue setting other preferences. Clicking the OK button locks in changes and closes the dialog. The Restore Defaults button resets the preferences on the current page to the system's default values.

1.3.1. Workbench preferences

Most general Eclipse preferences can be found in the General category. Some highlights include:

  • The General page determines whether opening a resource requires single- or double-clicking.

  • The Appearance page determines whether view and editor tabs appear on the top or bottom.

  • The Appearance > Colors and Fonts page provides options for customizing colors and fonts for many different workspace elements such as standard text font, dialog font, header font, error colors, and many others.

  • The Appearance > Label Decorations page provides access to options that can enhance an item's icon and label. The CVS label decorator, for example, prepends a ">" character to all changed resources.

  • The Capabilities page contains options for enabling and disabling various capabilities. Capabilities allow you to enable and disable various product features as a group.

  • The Compare/Patch page allows you to control the behavior of the text comparison views.

  • The Content Types page contains options for associating various content types with various file types.

  • The Editors page contains a variety of options controlling how editors are opened and closed and how many can be open at one time.

  • The Editors > File Associations page associates different editor types (both internal and external) with different file types. For example, if you wanted to associate Microsoft FrontPage with HTML files, you would do that here.

  • The Editors > Text Editors page contains options controlling the appearance of editors such as the visibility of line numbers, current line highlighting, various item colors, and annotations.

  • The Keys page provides options for customizing the key bindings for many commands in the system. It includes a predefined standard set of key bindings as well as a set of Emacs key bindings.

  • The Perspectives page allows you to control which perspective is your default perspective and whether new perspectives are opened in the current window or in a new window.

  • The Search page allows you to control the behavior of the Search view.

  • The Startup and Shutdown page shows a list of any plug-ins requiring early activation. Most plug-ins are activated on first use, but some need to be activated on startup. This page provides the option of preventing those plug-ins from starting up early.

  • The Web Browser page allows you to configure which Web browser is used when you open a Web page.

  • The Workspace page contains various build and save options.

  • The Workspace > Build Order page controls the order in which projects in your workspace are built.

  • The Workspace > Linked Resources page allows you to define path variables used to provide relative references to linked resources.

  • The Workspace > Local History page (see Figure 1-51) controls how many local changes are maintained. The default values are fairly small, so you should consider increasing them quite a bit. The more local history you keep, the more type and method versions you will be able to roll back to easily (see Section 1.7.4, Local history, on page 44 for tips on how to best use this feature).

1.3.2. Java preferences

Preferences specific to the Java development tools included in Eclipse can be found in the Java category of preferences. Some of the highlights include:

  • The Java page provides options controlling the behavior of various Java views and editors.

  • The Appearance page controls the appearance of Java elements in the various Java views.

  • The Build Path > Classpath Variables page (see Figure 1-14) provides a place to define new classpath variables that can be added to a project's classpath.

    Figure 1-14. Classpath Variables preference page.

  • The Code Style > Formatter page (see Figure 1-39) controls the options the Eclipse Java code formatter uses to format Java code. It includes options for controlling brace position, new lines, line length, and white space usage.

  • The Code Style > Code Templates page defines the naming conventions and default comments used in generated code for types, methods, fields, variables, and parameters.

  • The Compiler page provides options for controlling the severity levels of various compilation and build path problems as well as various Java Development Kit (JDK) compliance options.

  • The Editor page controls numerous options dealing with the appearance of elements within the Java editor (such as bracket matching, print margin, and current line highlighting), color highlighting of Java syntax (see Figure 1-38), the behavior and appearance of code assistance (see Figure 1-42), and problem annotations.

  • The Editor > Templates page provides a place to define and edit various Javadoc and Java code templates (templates are common source code patterns that appear frequently in user-written code).

  • The Installed JREs page provides options for specifying which JREs should be used with the workbench.

1.3.3. Importing and exporting preferences

Setting up multiple Eclipse workspaces or migrating from one Eclipse version to another can be inconvenient due to the difficulty of moving workspace preferences from one version to another. Likewise, configuring multiple users' workspaces with common settings, such as code formatting preferences and classpath variable settings, can also be very difficult.

The Eclipse Export and Import wizards include Preferences options that are intended to help solve this problem. Selecting File > Export... and then Preferences opens a wizard that prompts for the name of a preference export file (an .epf file) and records any non-default preference settings in it. Selecting File > Import... and then Preferences opens a wizard that is used to import a preference file. Options are provided to export your preferences at various levels of granularity. You can export all workspace preferences or specific ones.

This mechanism for exporting and importing preferences is less than ideal, however, because of problems handling various types of preferences such as classpath variables (which are exported using hard-coded paths rather than workspace-relative paths) and code templates (which are not exported at all).

Previous Page
Next Page