[Skip to content]

Chapter 6. Eclipse Plug-in

Describes the installation and usage of the Jalopy Eclipse Plug-in.

Eclipse is an open platform for tool integration built by an open community of tool providers. Operating under an open source paradigm, with a common public license that provides royalty free source code and world wide redistribution rights, the eclipse platform provides tool developers with ultimate flexibility and control over their software technology.

The homepage can be reached under http://www.eclipse.org/

Please note that the Plug-in also supports other Eclipse based products, like IBM Websphere Application Developer (WSAD), IBM Rational Application Developer (RAD), JBoss Developer Studio, CodeGear JBuilder etc.

6.1. Installation

Explains the steps involved to install the Eclipse Plug-in.

6.1.1. System requirements

The Plug-in requires Eclipse 2.1 or later. See Section 1.1, “System requirements” for the basic requirements to run Jalopy.

6.1.2. Installation

The Plug-in comes as an executable Jar Archive (Jar) that contains a graphical setup wizard to let you easily install the software. Wizard installation is recommended and explained in detail in Section 1.3, “Wizard Installation”.

If you would rather install the Plug-in manually, you have to decompress and copy the appropriate files into the different application folders. To decompress the contents of the installer Jar, you can either use the Jar tool that ships with your Java distribution or any other software that can handle the ZIP compression format (e.g. 7Zip or WinZip).

If you're upgrading from a prior version and want to keep your settings, first copy or rename the current Jalopy settings directory to match the version number of the new release. For instance, if your current settings directory is "C:\Documents and Settings\John Doo\.jalopy\1.9" and you're about to install Jalopy 1.9.1, either copy the directory contents or rename it to "C:\Documents and Settings\.jalopy\John Doo\1.9.1". Wizard installation can perform this step automatically.

Make sure Eclipse is not running and remove any present "com.triemax.jalopy_1.9.1" directory in your Eclipse plugin folder. This folder is usually located in the root directory of your Eclipse installation, e.g. "C:\Program Files\Eclipse\plugins\".

Copy the Jalopy Plug-in folder "com_triemax.jalopy_1.9.1" from the temporary directory into the Eclipse plugin folder. Then place the two Jar files "jalopy-1.9.1.jar" and "jalopy-eclipse-1.9.1.jar" from the temporary directory into the Jalopy Plug-in folder.

If you are running Eclipse 2.1, as a final step delete the file "plugin.xml" from the Jalopy Plug-in folder and rename the file "plugin.xml-2.x.xml" to "plugin.xml".

6.2. Integration

Describes how the Plug-in integrates into the Eclipse IDE.

6.2.1. Preferences

The Jalopy preferences are available through the Eclipse preferences dialog. In order to access the preferences, on Mac OS X you use EclipsePreferences... and select the Jalopy item on the left pane. On other platforms the dialog is available through WindowPreferences.... In order to quickly locate the item, you might want to type "Jalopy" in the filter field at the top of the left pane.

Figure 6.1. Main Jalopy Preferences page

Main Jalopy Preferences page

The main preferences page lets you manage your Jalopy profiles. A profile stores the actual code convention to define formatting output, as well as user-specific data like file and dialog histories. You can add, remove, activate, map and configure any number of profiles.

For a detailed explantation of the available options, please refer to the section called “Main window”.

Please note that due to technical reasons it is currently not possible to configure profiles from within Eclipse when running on Mac OS X. When using Mac OS X you need to invoke the Jalopy preferences dialog from outside Eclipse. Simply install the Console Plug-in and invoke the dialog as described in Section 5.2, “Configuration”. Configure your code convention and afterwards export them to a file. From within Eclipse you can then import this configuration.

6.2.2. Java Editor popup menu

The software adds a new menu item to the popup menu of Java editors.

  • Format with Jalopy

    Formats the contents of the editor.

Figure 6.2. Editor popup menu

Editor popup menu

The default keyboard shortcut for this action is Ctrl+Shift+F10. To configure the shortcut, open the Eclipse Keys preference page via WindowPreferencesWorkbenchKeys. Open the Source category and select the Format with Jalopy item.

Figure 6.3. Keyboard shortcut

Keyboard shortcut

6.2.3. Project, Folder, File popup menus

The software adds a new menu item to the popup menu of projects, folders, packages and Java source files in the Navigator and Package Explorer view of the Java perspective.

Figure 6.4. Project popup menu

Project popup menu

  • Format with Jalopy

    Formats the selected item(s). Depending on the object type (working set, project, folder, file) formats either all Java source files of the project, the contents of the selected folder(s), including subfolders, or the currently selected source file(s).

6.3. Configuration

Although Jalopy ships with sensible default settings (mimicking the Sun Java coding convention), you most likely want to configure the formatter to match your needs (adding copyright headers, tune Javadoc handling and the like). For such, Jalopy comes with a graphical configuration tool that lets you interactively customize the settings. See Chapter 2, Configuration for an in-depth discussion of the available options.

Please refer to Section 6.2.1, “Preferences” for information on how to display the configuration tool from within Eclipse.