Chapter 13. NetBeans/Sun ONE Studio module

Describes the installation and usage of the Jalopy NetBeans/Sun ONE Studio Plug-in module.

NetBeans is the original full-featured, free and open source IDE for Java Software Developers to develop cross-platform desktop, mobile and web applications based on industry standards utilizing the latest technologies.

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

13.1. Installation

Explains the steps involved to install the NetBeans Plug-in module.

13.1.1. System requirements

The Plug-in works with NetBeans releases 4.0 - 5.5 or the corresponding Sun ONE Studio or Java Studio Creator versions.

See Section 1.1, "System requirements" for the basic requirements to run Jalopy.

13.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 NetBeans is not running and remove any prior Jalopy Jar files in your NetBeans extension folder. The NetBeans extension folder is located under the root directory of your NetBeans installation, e.g. C:\Program Files\NetBeans\modules. Remove all Jar files starting with "jalopy-" from this folder and the "/ext" subfolder.

Now decompress the contents of the installer Jar file into a temporary directory and copy the file "jalopy-netbeans-1.8.jar" from the temporary directory into the NetBeans modules folder. Place the file "jalopy-1.8.jar" into the "/ext" subfolder.

13.2. Integration

Describes how the Plug-in integrates into NetBeans.

13.2.1. Workspace main menu

The software adds two new menu items into the main menu of the current Workspace to seamlessly integrate with NetBeans:

  • Tools->Jalopy Options

    Displays the Jalopy options dialog.

    Use this item if you want to change your settings to control the layout of any formatted code.

Figure 13.1. Jalopy Options menu bar item

Jalopy Options menu bar item
  • Edit->Format (Ctrl-Shift-F10)

    Formats the currently selected node(s) or editor.

    Only available if there are indeed nodes selected which represents or contains Java source files or an editor is focused.

Figure 13.2. Jalopy Format menu bar item

Jalopy Format menu bar item
13.2.2. Explorer popup-menu

The Format item can be also reached via the popup menu of the Explorer. Note that the item only appears for folder nodes or Java source files.

Figure 13.3. Jalopy Format explorer item

Jalopy Format explorer item

If it happens that a file has an open editor view, this view will be updated, not the actual file. You have to save the view first to see the physical file updated.

13.2.3. Editor popup menu

The software adds a new menu item into the context popup menu of Java code editors:

  • Format

    By selecting the "Format" menu item, the contents of the active code editor view are formatted according to the current Jalopy options.

Figure 13.4. Jalopy editor popup menu item

Jalopy editor popup menu item
13.2.4. Message window

Jalopy displays all runtime messages in its own dockable 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 display 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 13.5. Jalopy dockable window

Jalopy dockable 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 13.6. Jalopy dockable window

Jalopy dockable window

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.

13.2.5. Keyboard shortcuts

You can define keyboard shortcuts for the different Jalopy actions via the NetBeans Keyboard Shortcuts dialog. You can open the dialog via

The "Format" action is available in the "Edit" section. The "Jalopy Options" action in the "Tools" section.

To add a keyboard shortcut, select an action and press the Add... button. A dialog opens that will let you enter the desired shortcut.

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