Chapter 7. IDEA Plug-in

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

IDEA is an intelligent Java IDE intensely focused on developer productivity. It provides a robust combination of enhanced development tools, including: refactoring, J2EE support, Ant, JUnit, and CVS integration. Packaged with an intelligent Java editor, coding assistance and advanced code automation tools, IDEA enables Java programmers to boost their productivity while reducing routine time consuming tasks.

The homepage can be reached under http://www.jetbrains.com/idea/

7.1. Installation

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

7.1.1. System requirements

This Plug-in requires IDEA 3.0 or higher. See Section 1.1, "System requirements" for the basic requirements to run Jalopy.

7.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.0.4" and you're about to install Jalopy 1.8, either copy the directory contents or rename it to "C:\Documents and Settings\.jalopy\John Doo\1.8". Wizard installation can perform this step automatically.

Make sure IDEA is not running and remove any present Jalopy files in your IDEA Plugin folder. The IDEA Plugin folder is located in the root directory of your IDEA installation, e.g. C:\Program Files\IDEA\plugins. Check for a jalopy/lib subdirectory. If it exists, delete its contents. Otherwise create it.

Then copy the two Jar files jalopy-1.8.jar and jalopy-idea-1.8.jar into this plugins/jalopy/lib folder.

7.2. Integration

Describes how the Plug-in is integrated with the IDEA IDE.

7.2.1. Main Menu

The software adds a new menu item into the Main Menu of the IDEA user interface.

  • File->Jalopy Settings...

    Displays the Jalopy settings dialog. Use this item if you want to change the settings that control the layout of Jalopy formatted code.

Figure 7.1. Jalopy Preferences menu item

Jalopy Preferences menu item
7.2.2. Code Editor Window Popup Menu

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

  • Format "filename"

    Formats the contents of the editor.

Figure 7.2. Code editor popup menu item

Code editor popup menu item
7.2.3. Tool Windows Popup Menu

The software adds a new menu item to the popup menu of certain Tool Windows. Currently it adds an item to the Project, Structure, Commander and Hierarchy Tool Window.

  • Format "filename"

    Formats the selected files. Depending on the state either all Java source files of the project, the contents of the selected folder(s) (including subfolders) or the currently selected Java source file(s).

Figure 7.3. Tool window popup menu item

Tool window popup menu item
7.1. Tool window

Jalopy displays all runtime messages in its own tool window. Messages are shown in a tree control, with each branch containing the messages for a specific file, and individual messages displayed as leafs. File messages show the number of leaves and the warning and error count.

The message types are differentiated with icons and by color: Errors are red with an error icon, warnings are shown in blue and display a warning sign, informational messages are black and carry a file icon and debugging messages are black and prepended by a bug icon.

Figure 7.4. Jalopy Tool Window

Jalopy Tool Window

Clicking on a file name will open that file, clicking on a message that contains location information will open the file containing the message and move the caret to the nomimated location.

Figure 7.5. Jalopy Tool Window Context Menu

Jalopy Tool Window Context Menu

The window provides a context menu with some useful actions.

  • Copy

    Copies the textual contents of the selected messages into the System clipboard. If a message contains children, the contents of all children are copied as well.

  • Clear

    Removes all selected messages.

  • Clear All

    Removes all messages currently being displayed in the window.

  • Select All

    Selects all messages currently being displayed in the window.

7.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 7.2, "Integration" for information on how to display the configuration tool from within IDEA.