<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <meta content="text/html;CHARSET=iso-8859-1" http-equiv="Content-Type"> <title>Software</title> </head> <body> <p> <table border="0"> <tbody> <tr> <td bgcolor="#dddddd" rowspan="3" valign="top" align="left" width="150"> <img alt="Author: Mike Atkinson" src="JRefactory.jpg"> <a href="chissoft.html">Software</a> <br> <ul> <li> <a href="cspretty.html">Pretty Printer</a> <br> </li> <li> <a href="csrefactory.html">JRefactory</a><br> </li> <li> <a href="csprint.html">Printing</a> <br> </li> <li> <a href="cselixirext.html">Elixir Extensions</a> <br> </li> <li> <a href="cslineno.html">Line Numbering</a> <br> </li> <li> <a href="csmetrics.html">Metrics</a> <br> </li> <li> <a href="csstub.html">Stub Generator</a> <br> </li> <li> <a href="csdevutil.html">Dev Utilities</a> <br> </li> <li> <a href="csr-roadmap.html">Roadmap</a> <br> </li> <li> <a href="csrtodo.html">Requested Features</a> <br> </li> </ul> <a href="csr-releasenotes.html">Release Notes</a> <br> <a href="chrisdown.html"><b>Download</b></a> <br> <b><a href="authors.html">Contributors</a></b> <br> </td> <td valign="top" align="left" width="35"> <p><a href="authors.html"><img border="2" alt="Previous Page" align="bottom" height="30" width="30" src="left.gif"></a> </p> </td> <td align="center"> <h1 align="center">Software::IDE::jEdit - JavaStyle</h1> </td> <td valign="top" align="right" width="35"> <p align="right"><a href="cspretty.html"><img border="2" alt="Next Page" align="bottom" height="30" width="30" src="right.gif"></a> </p> </td> </tr> <tr> <td colspan="3"><br> <h3 style="color: rgb(0, 0, 102);">Supported versions:</h3> <ul> <li>jEdit 4.1 - use JRefactory <span style="font-weight: bold;">2.6.40</span> <p>This version is rather old but works well for pretty printing</p> </li> <li>jEdit 4.2 - use JavaStyle-jedit <span style="font-weight: bold;">2.8 final</span> <p>The new version is all-singing-all-dancing including not only an improved pretty printer, but also refactoring, metrics, cut&paste detection, bug finding, coding standards support and an AST viewer. JavaStyle has been tested on jEdit 4.2pre5 with J2SDK1.4.2_01 on Windows XP.</p> </li> </ul> <h3 style="color: rgb(0, 0, 102);">Running JavaStyle in jEdit.</h3> <p>Download JavaStyle from plugin central by using the Plugin Manager.</p> <p>Development versions may be obtained from <a href="http://sourceforge.net/projects/jrefactory/">http://sourceforge.net/projects/jrefactory/</a>. They should be unzipped into the jEdit jars directory (in either the jEdit settings directory or the jEdit application directory). Current versions of JavaStyle use the following library jars:</p> <ul> <li>findbugs.jar </li> <li>findbugsGUI.jar </li> <li>coreplugin.jar </li> <li>saxpath-1.0-fcs.jar </li> <li>jaxen-core-1.0-fcs.jar </li> <li>dom4j-full.jar </li> <li>bcel.jar </li> </ul> <p>care should be taken to ensure that only one version of these jars is present. A future version of JavaStyle will package all these jars in a single jar and compress them to take up less space.</p> <p>After downloading JavaStyle appears as a plugin which may be obtained from the Plugins menu.</p> <div style="margin-left: 40px;"><span style="font-weight: bold;">Plugins</span> <ul style="list-style-type: circle;"> <li><span style="font-weight: bold;">JavaStyle</span> <ul> <li><span style="font-weight: bold;">Reformat buffer</span> <span style="color: rgb(0, 102, 0);">reformats the current buffer using the appropriate pretty printer settings</span> </li> <li><span style="font-weight: bold;">JRefactory...</span> <span style="color: rgb(0, 102, 0);">opens the dockable window to allow refactoring, coding standards checking, cut&paste detection, AST viewer and bug finding.</span> </li> <hr style="height: 2px; width: 100px; margin-left: 0px; margin-right: auto;"> <li><span style="font-weight: bold;">Coding Standards</span> <ul style="list-style-type: circle;"> <li><span style="font-weight: bold;">Check current buffer</span> <span style="color: rgb(0, 102, 0);">If the current buffer (i.e. the one that contains the cursor) contains Java source code then check it. The warnings get shown on the ErrorList plugin and on the margin of the buffer as well as being underlined in the text. If the JavaStyle dockable window is open coding standards breaches are also shown in its <em>Coding Standards</em> tab. </span> </li> <li><span style="font-weight: bold;">Check all open buffers</span> <span style="color: rgb(0, 102, 0);">For all open buffers that contain Java source code check them. The warnings get shown on the ErrorList plugin and on the margin of the visible buffers as well as being underlined in the text. If the JavaStyle dockable window is open coding standards breaches are also shown in its <em>Coding Standards</em> tab.</span> </li> <li><span style="font-weight: bold;">Check files in current directory</span> <span style="color: rgb(0, 102, 0);">Check for coding standards in the current directory and all sub-directories. The warnings get shown on the ErrorList plugin and on the margin of the visible buffers as well as being underlined in the text. If the JavaStyle dockable window is open coding standards breaches are also shown in its <em>Coding Standards</em> tab.</span> </li> <li><span style="font-weight: bold;">Check directory recursively</span> <span style="color: rgb(0, 102, 0);">Check for coding standards in the current directory and all sub-directories. The warnings get shown on the ErrorList plugin and on the margin of the visible buffers as well as being underlined in the text. If the JavaStyle dockable window is open coding standards breaches are also shown in its <em>Coding Standards</em> tab. </span> </li> <li><span style="font-weight: bold;">Clear ErrorList</span> <span style="color: rgb(0, 102, 0);">Clear the warnings/errors from the ErrorList plugin.</span> </li> </ul> </li> <li><span style="font-weight: bold;">Detect Duplicate Code</span> <ul style="list-style-type: circle;"> <li><span style="font-weight: bold;">In current buffer</span></li> <span style="color: rgb(0, 102, 0);">Look for duplicated code in the current buffer. Sections of duplicated code may be seen in the JavaStyle dockable window <em>Cut&Paste detector</em> tab.</span> <li><span style="font-weight: bold;">In Directory</span></li> <span style="color: rgb(0, 102, 0);">Look for duplicated code in the selected directory. Sections of duplicated code may be seen in the JavaStyle dockable window <em>Cut&Paste detector</em> tab.</span> <li><span style="font-weight: bold;">In Directory Recursively</span></li> <span style="color: rgb(0, 102, 0);">Look for duplicated code in the selected directory and all its sub-directories. Sections of duplicated code may be seen in the JavaStyle dockable window <em>Cut&Paste detector</em> tab.</span> </ul> </li> <hr style="height: 2px; width: 100px; margin-left: 0px; margin-right: auto;"> <li><span style="font-weight: bold;">Options...</span> <span style="color: rgb(0, 102, 0);">Open the options selection dialog box (see below)</span> </li> </ul> </li> </ul> </div> <h3 style="color: rgb(0, 0, 102);">Selecting the Options</h3> <p>JavaStyle has many options for pretty printing and others for controlling the coding standards checking. These may be accessed either from the menu <span style="font-weight: bold;">Plugins->JavaStyle->Options..</span>. or from <span style="font-weight: bold;">Plugin->Plugin Options...</span> the second option only allows acces to the default options, whereas the first option allows the options for particular projects to be set seperately. The JavaStyle plugin finds out what projects are available from the ProjectViewer plugin, if its not loaded then you just get the default options.</p> <p>The option system is quite complex, it will allow almost any style of pretty printing you could desire, don't be afraid to experiment, copy a complex Java source file to a temporary location and see the results on that. You will almost certainly need to change the <span style="font-weight: bold;">Author</span> in the <span style="font-weight: bold;">JavaDoc Tags</span> tab (its currently set to me!).</p> <p>Perhaps the two most important options are on the <span style="font-weight: bold;">General</span> tab <span style="font-weight: bold;">Reformat when buffer is saved</span> when ticked causes JavaStyle to reformat the buffer whenever it is saved (i.e just before it is saved) and this could change how your code looks considerably (sorting the methods for example). The other <span style="font-weight: bold;">Perform coding standards check when buffer is saved</span> is very useful on fast machines as it notifies you of problems immediately, it is however quite slow and so most appropriate for fast machines (2GHz Pentium 4 equivalent or faster) </p> <p>Each Project may have its own values of any of the options, they are stored as changes to the default options. Tick the left hand box on a project option pane and then select the desired state of the option for that project.</p> <p>If you need to look at the <span style="font-weight: bold;">pretty.settings</span> options file look in <user.home>/.jedit/javastyle/.JRefactory for the default settings, settings for the projects are contained in subdirectories from here.</p> <br style="color: rgb(153, 0, 0);"> <p><span style="font-style: italic; color: rgb(153, 0, 0);"> <span style="font-weight: bold;">Note</span>: the current version of JavaStyle is not very efficient at creating the Options dialog box. It may take several seconds to load if there are lots of projects.</span></p> <h3 style="color: rgb(0, 0, 102);">Building the JavaStyle plugin yourself</h3> <p>There are three ways of building JavaStyle for jEdit.</p> <p><span style="font-weight: bold;">Its Easiest, </span>to download the JavaStyle-jedit-2.8.x-source.zip and unzip directly into the jEdit jar directory. You should have a directory structure something like this:</p> <div style="margin-left: 40px;">jEdit 4.2/<br> <div style="margin-left: 40px;">jars/<br> </div> </div> <div style="margin-left: 40px;"> <div style="margin-left: 80px;"> ErrorList.jar<br> ProjectViewer.jar<br> JRefactory/<br> <div style="margin-left: 40px;">ant.build/<br> <div style="margin-left: 40px;">classes/<br> </div> <div style="margin-left: 40px;">lib/<br> </div> </div> </div> <div style="margin-left: 80px;"> <div style="margin-left: 40px;">docs/<br> jedit files/<br> rulesets/<br> settings/<br> src/<br> test/<br> build.xml<br> </div> <br/> </div> </div> <p>Open the build.xml with AntFarm and execute the <span style="font-weight: bold;">jEdit.JavaStyle.jar</span> target. The resulting jar file is copied into the ant.build/lib/ directory, use the Plugin Manager to unload the JavaStyle plugin (uncheck it in the manage tab) copy the JavaStyle.jar from ant.build/lib/ to jEdit4.2/jars/ and reload it using the Plugin Manager.</p> <p><span style="font-weight: bold; font-style: italic;">Alternatively</span> download the whole JRefactory-2.8.x-full.zip distribution, unzip it into a clean directory and again execute the <span style="font-weight: bold;">jEdit.JavaStyle.jar</span> target. You will need to copy the jedit.jar, ErrorList.jar and ProjectViewer.jar from the jEdit application into the JRefactory/jar/ directory first.</p> <p><span style="font-weight: bold; font-style: italic;">Alternatively</span> use anonymous CVS to download the current version of JReafactory and build it. It is found on <a href="http://sourceforge.net/cvs/?group_id=13219">sourceforge</a>.</p> <h3 style="color: rgb(0, 0, 102);">About jEdit</h3> <p>The open source <a href="http://jedit.sourceforge.net/">JEdit</a> is an editor first and an IDE second. There are a large number of plugins available for it covering most aspects of development. Version 4.2 has much faster start-up performance and lazy loading of plugins. JavaStyle fully supports jEdit 4.2 features.</p> <h3 style="color: rgb(0, 0, 102);">The tools</h3> <p><font size="4"><a href="cspretty.html">Pretty Printer/Beautifier</a></font> is a tool that allows you to clean up the indenting and formatting of your java source code.</p> <p>This tool has a powerful feature of being able to insert the appropriate javadoc comments so that the javadoc program does not generate error messages for missing fields. To simplify writing javadoc comments, some methods have javadoc comments automatically generated based on the name of the method.</p> <p><font size="4"><a href="csrefactory.html">JRefactory</a></font> is a tool that allows you to perform the following refactorings: </p> <ul> <li> Move class between packages (repackage) </li> <li> Rename class </li> <li> Add abstract parent class </li> <li> Add child class </li> <li> Remove empty class </li> <li> Extract interface </li> <li> Push up field </li> <li> Push down field </li> <li> Rename Field </li> <li> Push up method </li> <li> Push up abstract method </li> <li> Push down method </li> <li> Move method </li> <li> Extract method </li> <li> Rename Parameter </li> </ul> <p>It updates the java source files as appropriate.</p> <p>This tool comes as a command line option with GUI or without, and as a plugin for the JEdit (still under development), JBuilder, NetBeans, and Elixir IDEs.</p> <p>For JBuilder and Elixir you can switch from the UML diagram to the source code.</p> <p><font size="4"><a href="csprint.html">Printing</a></font> provides the ability to print UML diagrams.</p> <p><font size="4"><a href="csfindbugs.html">BugFinding</a></font> uses the findbugs tool to find many common sources of bugs in code.</p> <p><font size="4"><a href="csuml.html">UML Diagrams</a></font> come as part of the Refactoring support, they can be resized are useful for navigating round lots of code.</p> <p><font size="4"><a href="cscutpaste.html">Cut & Paste detection</a></font> looks for similar sections of source code throughout a set of files.</p> <p><font size="4"><a href="csast.html">AST Viewer</a></font> shows the result of the Java parser as an Abstract Syntax Tree. XPath queries may be performed on the tree.</p> <p><font size="4"><a href="csmetrics.html">Metrics</a></font> gathers metrics about your java source code.</p> <p><font size="4"><a href="csstub.html">Stub Generator</a></font> creates a file that allows the refactory tool to display Java JDK library classes (or other applications where you have access to the source code, but you don't intend to change the source code). This facility is used for the refactoring tool to show classes from 3rd party vendors in the refactoring GUI. (This has been tested on JDK 1.4.2_01, but should work with other Java 2 JDKs)</p> </td> </tr> <tr> <td width="35"><a href="authors.html"><img border="2" alt="Previous Page" align="bottom" height="30" width="30" src="left.gif"></a></td> <td align="center"> <p align="center"><font color="#aaaaaa" size="2">Last Modified: October 7, 2003</font> </p> </td> <td align="right" width="35"> <p align="right"><a href="cspretty.html"><img border="2" alt="Previous Page" align="bottom" height="30" width="30" src="right.gif"></a> </p> </td> </tr> </tbody> </table> </p> </body> </html>