Eclipse JIndent Integration

Using Jindent for your code formatter

Description

Provides preferences pages and menu selections to run Jindent inside Eclipse.

License

Jindent is Copyright 1997-2004 by Software & Solutions Andreas, Dangberg, Germany. All Rights Reserved.

JavaDude Eclipse Jindent plugin is Copyright 2004 by Scott Stanchfield, Germantown, Maryland USA. All Rights Reserved.

USE OF THIS CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

NOTE THAT THIS SOFTWARE WILL MODIFY YOUR SOURCE FILES! IT IS CRITICAL THAT YOU VERSION YOUR SOURCE OR STORE A COPY OF YOUR SOURCE BEFORE FORMATTING IT IN CASE THERE ARE BUGS IN THE SOFTWARE. USE OF THIS SOFTWARE IS AT YOUR OWN RISK; I CANNOT BE HELD RESPONSIBLE FOR HARM CAUSED BY USE OF THE SOFTWARE.

This Content is provided to you under the terms and conditions of the Common Public License Version 1.0 ("CPL"). A copy of the CPL is provided with this Content and is also available at http://www.eclipse.org/legal/cpl-v10.html.

Caution!!!

I strongly recommend you version your work (or store a copy of it) prior to running the Jindent integration against your code. I cannot be held responsible for loss of code!

Obligatory Work-In-Progress Note...

First, let me get out out of the way that this is a work in progress. No surprise there, right? Anyway, I worked on this over a year ago and got busy with other things for a while. It's here now, though...

There are a few limitations with this first release...

Limitations

Requirements

This plugin requires Jindent 3.5. You can use the Jindent trial edition (subject to the trial edition limitations), Jindent, or Jindent Gold. You can obtain Jindent from http://www.jindent.com.

This integration only works with Jindent 3.5. It will not work with previous versions of Jindent. As later versions of Jindent are released, I'll update the plugin to support them.

Note on JDK 1.3 vs J2SE 1.4

I recommend you run Eclipse under J2SE 1.4 or later. This does not prevent you from compiling and running applications you're editing under other JDKs, but 1.4 tends to run faster and cleaner than 1.3. For example, if you run this plugin under 1.3, a command-prompt window will appear for each file being formatted by Jindent. I'll be looking into this to see if I can get rid of it, but felt it was just something to note for now.

Download

You can download the integration from

For Eclipse versions 2.x (greater than 2.1)

For Eclipse version 3.0RC1 or later

Basic Usage

The following instructions describe the basic usage of this plugin. I'll try to update this with more details later.

  1. Shutdown Eclipse.
     
  2. If you already have a com.javadude.eclipse.jindent_xxx directory under your eclipse plugins directory, delete it. For example, if you have c:\eclipse\plugins\com.javadude.eclipse.jindent_3.0.0, delete it before proceeding.
     
  3. Install the JavaDude Jindent Eclipse Integration plugin.
    To do this, unzip the file into your directory specified above. For example, if you have Eclipse installed in c:\eclipse, unzip the 2.1 distribution into c:\eclipse\plugins or the 3.0 distribution into c:\eclipse. This will create a directory named c:\eclipse\plugins\com.javadude.eclipse.jindent_1.0.0 or c:\eclipse\plugins\com.javadude.eclipse.jindent_3.0.1 directory.
     
  4. (Re)start Eclipse.
     
  5. Setup your preferences.
    1. Choose the Window->Preferences menu in Eclipse.
    2. Select the Java->Jindent category in the left pane of the preferences dialog.
    3. Select the location of the jindent.jar file for your distribution of Jindent.
    4. Import a jindent properties file (.jin) from the jindent distribution or your own customized .jin file.
    5. Change any other preferences you would like in the rest of the preferences pages.
    6. Close the preferences dialog.
       
  6. Run Jindent against your code
    1. Select projects, packages, and/or classes to run Jindent against. If you select a project, all Java source within the project will be formatted. If you select a package, all Java source within the package will be formatted.
    2. Right click on one of the selected projects/packages/classes
    3. Choose Jindent (Format Code) from the context menu.

While running, the plugin will display a progress dialog.

If you're running the trial version of Jindent, you will see the Jindent trial popup window for each file being formatted. You will need to press the "Ok" button on this dialog for each file being formatted. Because Jindent is run independently for each file being processed, there is no way to prevent this. This dialog will not appear when using a registered version of Jindent.

If there are any problems during processing, a dialog will indicate the problems. In particular, if you are using the trial version of Jindent, and you select a class that has over 200 lines, you will see a dialog listing which classes could not be formatted.

If you have any of the selected classes open for editing, the class will be formatted, but will not be saved. You will need to save any such files yourself. (This is intentional behavior, as I don't like to save changes while someone is editing.)

Bug Reports/Feature Requests

If you would like to contact me about this plugin, feel free to email me at scott@javadude.com. If you have recommendations about changes, new features, and so forth, feel free to either request them or make changes to the source and send them to me.