Eclipse JIndent Integration
Using Jindent for your code formatter
Provides preferences pages and menu selections to run Jindent inside Eclipse.
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.
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...
- There is no configuration of Jindent environment settings. This will be the next thing to add.
- There is no help for the preferences dialog. For now, please refer to the Jindent documentation for a description of all preference settings.
- The Jindent integration does not currently use the Eclipse formatting API. The formatting API was added when I was in the middle of development, and I didn't want to back out for now. The next release should integrate using the formatting API.
- Manually placed markers, such as breakpoints, tasks (not added via // TODO like comments) and bookmarks do not move during a Jindent run. This means that their location in the formatted text may be incorrect. In the future, we'll track their location and move them appropriately. Note that automatic markers, such as error markers and tasks for // TODO like comments will be repositioned, as these are placed when the modified source is saved.
- The Jindent integration assumes the source file has no errors. A check for this needs to be added before Jindent is run against your code.
- There is no "undo all" function at this point in time. If your run the Jindent integration against a project or package, the only way to undo the process is to reload your code from a previously-saved version.
- There is no support for non-English languages in the preferences pages and dialogs. If I can get some help from some folks for translation, I may provide this in the future.
- The preference pages do not conform to the normal Eclipse standards (I will be fixing this when I get a chance).
- The progress dialog should be integrated with the new progress view in 3.0.
- Eclipse 2.1 or later
- JDK/JRE 1.3 or later (used when running Eclipse) -- 1.4 or later recommended
- Jindent 3.5 (trial, standard or gold)
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.
You can download the integration from
For Eclipse versions 2.x (greater than 2.1)
unzip into your eclipse/plugins directory
For Eclipse version 3.0RC1 or later
unzip into your eclipse directory
The following instructions describe the basic usage of this plugin. I'll try to update this with more details later.
- Shutdown Eclipse.
- 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
- 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.
- (Re)start Eclipse.
- Setup your preferences.
- Choose the Window->Preferences menu in Eclipse.
- Select the Java->Jindent category in the left pane of the preferences dialog.
- Select the location of the jindent.jar file for your distribution of Jindent.
- Import a jindent properties file (.jin) from the jindent distribution or your own customized .jin file.
- Change any other preferences you would like in the rest of the preferences pages.
- Close the preferences dialog.
- Run Jindent against your code
- 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.
- Right click on one of the selected projects/packages/classes
- 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 firstname.lastname@example.org. 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.