[Skip to content]

Chapter 8. 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.

8.1. Installation

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

8.1.1. System requirements

The JDeveloper plug-in requires JDeveloper 10g (10.1.3) or later. See Section 1.1, “System requirements” for the basic requirements to run Jalopy.

8.1.2. Setup

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 highly 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 and/or settings folders. To decompress the contents of the installer JAR, you can often use the build-in support of your file manager (e.g. Nautilus) or any other software that can handle the ZIP compression format (e.g. 7Zip, WinZip or Stuffit Expander). If you don’t have access to one of the convenience tools, you might resort to the jar command-line application that ships with your Java distribution.

When 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:\Users\John Doo\.jalopy\1.9 and you’re about to install Jalopy 1.9.4, either copy the directory contents or rename it to C:\Users\John Doo\.jalopy\1.9.4.

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.9.4.jar and jalopy-jdev-1.9.4.jar from the temporary directory into the JDeveloper extension folder.

8.2. 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 provides a configuration tool that lets you interactively craft and customize the code convention settings.

The Jalopy preferences are available through the JDeveloper preferences dialog. In order to configure Jalopy, on Mac OS X you use JDeveloperPreferences... from the global Menubar and select the “Jalopy“ item from the tree view on the left. On other platforms, the dialog is available through ToolsPreferences.. from the application menu.

8.2.1. Profile preferences

The main preferences page lets you manage your Jalopy profiles. A profile stores the actual code convention that defines the formatting style, as well as user-specific data like file and dialog histories. You can edit, add, remove, activate, map and share any number of profiles. For a detailed explanation of the available actions, please refer to Section 2.1.1.1, “Main window” that provides generic information about the configuration dialog that applies to all provided IDE plug-ins.

Figure 8.1. Jalopy Profile Preferences page

Jalopy Profile Preferences page

Jalopy profiles are shared for the local user and not application specific. This allows the settings to be reused across different applications and furthermore enables your team to easily work with different tools while sharing the same source code style.

8.2.2. Synchronize preferences

The Synchronize preference page lets you specify an external settings file with exported code conventions to automatically synchronize with in order to keep your local settings always up-to-date. The Synchronize preferences are workspace specific and not stored as part of a Jalopy profile.

In the text field you can enter the resource path to the settings file you plan to synchronize with. This should usually be the URL of a shared server. To browse for local files, you can press the Browse... button and open a file dialog.

Tip

You can provide the resource path right during installation as described in Section 1.3.6, “Configure plug-in Defaults”. This way individual developers are not required to configure anything at all on their machines

Figure 8.2. Jalopy Synchronize Preferences page

Jalopy Synchronize Preferences page

Enable local cache

By default, Jalopy checks the specified settings file for changes each time it is about to format. This can be prohibitive when the code convention sits on a server without fast network access. In order to avoid long delays in such situations, you can enable local caching. Jalopy then only checks once per day for changes.

8.2.3. Update preferences

The Update preference page lets you configure automatic update checking and notification. Automatic update checks for and informs about new releases. The Update preferences are application specific and not stored as part of a Jalopy profile.

Figure 8.3. Jalopy Update Preferences page

Jalopy Update Preferences page

Automatically find new updates and notify me

To enable automatic update notification, check this option. When disabled, you won’t ever be notified about updates.

Search for updates on each program startup

When selected, update checking is performed only once during each session—on application startup.

Search for updates on the following schedule

When selected, you can specify day and hour when update checking should be performed periodically.

Notify me once about updates

When selected, the update notification appears only once during a session.

Remind me about updates every

When selected, you can define the time interval when update notification should remind you about updates.

Tip

You can define whether the IDE plug-ins should check for updates right during installation as outlined in Section 1.3.6, “Configure plug-in Defaults”

8.2.4. Keyboard Accelerator

The Format with Jalopy action can also be triggered via a keyboard shortcut. The default keyboard accelerator is Ctrl+Shift+F10, but it is recommend to re-configure the shortcut to something more accessible. To change the binding, open the JDeveloper Shortcut Keys preference page via the application menu, ToolsPreferences...Accelerators and enter “Jalopy” in the search field to display the Jalopy related actions. Select the “Jalopy” category and specify your preferred keyboard accelerator for the provided actions. Shift+Alt+F would be a good choice, but is already used with the default scheme and would have to be overridden.

Figure 8.4. JDeveloper accelerator preferences

JDeveloper accelerator preferences

Please be aware that the accelerator works globally, but is mapped to different actions depending on the current context and therefore might yield different results when used in different views, 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 triggers the formatting of all selected nodes in the Navigator. Please make sure that you are in the desired context and have the desired elements selected when pressing the shortcut.

8.3. Usage

Describes how the plug-in integrates into JDeveloper.

8.3.1. Actions

The software naturally adds new menu items to the menu bar and pop-up menus of different editors and views to be able to trigger formatting manually, but also allows automated formatting.

Format on Save

While manual formatting can become quite a habit, it may be best to automatically ensure proper formatting in order to free developers from the burden to keep their code always in compliance with the company rules. Jalopy provides a Format on Save feature to have formatting automatically applied whenever a dirty file is saved. To activate Format on Save, open the Jalopy preferences and enable the corresponding option as described in Section 2.2.3, “Format on Save”.

Editor Pop-up Menu

The software adds a new menu item into the pop-up menu of Java code editors. To format the currently active editor, open the pop-up menu and choose the “Format with Jalopy” item. Alternatively, you can press the configured keyboard accelerator.

Figure 8.5. JDeveloper Editor Pop-up Menu

JDeveloper Editor Pop-up Menu

If there is some text selected in the editor, only this section will be formatted (selective formatting). This can be helpful when editing portions of very large files, as selective formatting can speed up processing considerably. It comes especially handy when you want to limit formatting to a specific file portion in order to avoid unnecessary differences when editing a file that has not (yet) been formatted according to the company code conventions.

Navigator Pop-up Menu

The software also adds a new menu item into the context pop-up menu of the Navigator. Depending on the selected element, the action triggers formatting for whole workspaces, projects, folder and package hierarchies, or only one or several source files.

Figure 8.6. JDeveloper Navigator Pop-up Menu

JDeveloper Navigator Pop-up Menu

8.3.2. Runtime Messages

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 8.7. 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 nominated location.

Figure 8.8. Jalopy Log Window Context Menu

Jalopy Log Window Context Menu

The view 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