Chapter 9. JDeveloper Extension

Describes the installation and usage of the Jalopy JDeveloper Plug-in Extension.

Oracle JDeveloper is an award-winning, comprehensive Java and Web services IDE. Optimized to run with Oracle Application Server and Oracle Database, JDeveloper is committed to open standards and platforms, supporting all major J2EE application servers and databases, and providing pure implementations for Struts, CVS, Ant and JUnit.

The homepage can be reached unter http://www.oracle.com/tools/jdev_home.html

9.1. Installation

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

9.1.1. System requirements

The JDeveloper Plug-in requires JDeveloper 10g (9.0.5.1 - 10.1.2). See Section 1.1, "System requirements" for the basic requirements to run Jalopy.

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

Now decompress the contents of the installer Jar file into a temporary directory and copy the two Jar files "jalopy-1.8.jar" and "jalopy-jdev-1.8.jar" from the temporary directory into the JDeveloper extension folder.

9.2. Integration

Describes how the Plug-in integrates into JDeveloper.

9.2.1. Navigator context menu

The software adds a new menu item into the context popup menu of the Navigator:

  • Format <Application|Workspace|Project|Folder|Package|File>

    By selecting the "Format" menu item, all Java sources of the selected node are formatted according to the current Jalopy preferences.

    The item appears in the popup menu if the user clicks the right mouse button on a Java source node or any other parent node that may contain Java sources (such as Workspace, Project, Directory, EJB or BC4J nodes).

Figure 9.1. JDeveloper Navigator context menu

JDeveloper Navigator context menu
9.2.2. Editor context menu

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

  • Format <File>

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

Figure 9.2. JDeveloper Editor context menu

JDeveloper Editor context menu
9.2.3. Preferences

The Jalopy preferences dialog to configure your Jalopy code convention preferences can be invoked from the Menu Bar and is reachable through the Tools->Jalopy Preferences... menu item.

Please note that Jalopy does not store its preferences within the IDE configuration files, but uses its own provisions to store preferences in order to allow the resuse of Jalopy preferences between different IDEs. You find the Jalopy settings system and preferences dialog described in detail in Chapter 2, Configuration.

9.2.4. Log window

Jalopy displays all runtime messages in its own log 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 displays 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 9.3. Jalopy Log Window

Jalopy Log 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 9.4. Jalopy Log Window Context Menu

Jalopy Log 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.

9.2.5. Keyboard Accelerator

The software adds a new category to the JDeveloper accelerator preferences:

  • Tools->Preferences...->Accelerators

    Select the "Jalopy" category and specify your preferred keyboard accelerator for the provided actions. The "Format" action is by default associated with Strg+Shift+F10.

Figure 9.5. JDeveloper accelerator preferences

JDeveloper accelerator preferences

Please note that the accelerators are global and the "Format" action considers the current application context, i.e. if the editor view has the focus, the accelerator triggers the formatting of the active editor. If the System Navigator contains the focus, the accelerator trigges the formatting of all selected nodes in the Navigator.

9.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 to configure formatting output.

Please refer to Section 9.2.3, "Preferences" for information on how to display the configuration tool from within JDeveloper.