
STAGE 2.0 USER MANUAL Overview ChangeStyle is a style formatter extension for the BlueJ Java IDE. Oftentimes a programmer has difficulty conforming to different style rules at the expense of development time. ChangeStyle provides a way for any programmer working with BlueJ to convert their code to any coding style in seconds, thus increasing efficiency. This extension reduces the time spent manually reformatting code. ChangeStyle formats code depending on the options the user specifies. It formats the specified file on demand by using the Style Conventions, that can be modified. Some key features include setting the format settings to preset Style Conventions such as K&R Style and Sun Style, formatting braces, whitespace, and indentation. For more features look in 5.0 Features. 1.0 Requirements The following requirements should be met to ensure proper working conditions: J2SE 1.6.0 (Java 2 SDK version 1.6.0) or newer must be installed. BlueJ 2.2 or newer must be installed Must Run: Minimum: 64Mb main memory, Pentium II processor or equivalent Recommended: 128Mb main memory, 400MHz Pentium III processor or above Extensions are installed by placing the extension jar file into an extension directory. BlueJ has three separate locations for extensions, each giving the extension a different scope. The locations are: Verify Extension Installed To verify extension installed go to Help > Installed Extensions. Click on the ? to find more information about ChangeStyle . If ChangeStyle is not there, for more information go to. [BlueJ Extension Installation Help] 3.0 Usage 3.1 Format the Code 3.1.1 Format one Class. Start BlueJ. Open a project. Optionally open editor. Right click the Class of choice. Click on ChangeStyle > Format to format the selected class using the current style conventions.(If editor window is open the changes will be immediately visible. Otherwise you must open the editor to see the changes.) The editor window, if open shows the 'formatted' code. 3.1.2 Format All Files Start BlueJ. Open a project. Optionally open editor. Click on Tools > ChangeStyle > Format Entire Project to format all the classes in the current package using the current style conventions.(If editor window is open for any class, the changes will be immediately visible for that class. Otherwise you must open the editor to see the changes.) The editor window, if open shows the 'formatted' code. When not all of the classes in the package are compiled an error window will pop-up and ChangeStyle will not format the classes. 3.2 Undo Formatting NOTE: Only works immediately after formatting code (the code cannot be altered since the last format). 3.2.1 Undo Class Right click on the class and click on ChangeStyle > Undo. The original code appears in the editor window. 3.2.2 Multiple File Undo Click on Tools > ChangeStyle > Undo Formatting. A window will open that ask what files the user wants to undo. Check the checkbox of the files to undo and click Undo 4.0 Edit Style Conventions To edit the Style Conventions used to format your code or to Export / Import those Style Conventions the ChangeStyle Editor is used. To access the Editor go to Tools > Preferences. In the window that pops up go to the Extensions tab and if necessary scroll down to the ChangeStyle section. 4.1 Import and Export Conventions 4.1.1 Edit Edit lets you change the current conventions. The name of the convention will be called Custom... until it has been exported or saved. The user may also edit saved conventions. The Settings Dialog panel is opened so that the Style Convention Configuration Files can be edited and customized. 4.1.2 Import Import lets the user import a predefined convention from any where in their directory. It opens a browser window for the user to locate the file. 4.1.3 Save Save will save the convention to ChangeStyle's directory for storing conventions Type in the Convention Name that it will be saved under. Click Ok 4.1.4 Export Export will open a browse that will let the user save the conventions any where they may want. 4.1.5 Remove Remove will remove the Style Convention that is currently showing. It will not remove the predefined conventions.
4.2 Predefined Conventions To import predefined Style Conventions click on the drop down box and click the one you want. Once a Style Convention is selected you may change the conventions but they will not be saved over the predefined one. 4.2.1 ANSI C Braces are opened and closed at the beginning of a new line for functions or right under the keyword for commands A closing brace is always on a line of its own Function names are never indented TABs are 4 spaces wide In an if-else statement the if and else should be vertically aligned Null statements should be placed on their own line and commented Spaces should be placed around all assignment and binary operators, and no spaces should follow unary operators Only one statement should appear on each line Line length should be limited to 80 characters 4.2.2 Kernighan and Ritchie (K & R) Braces are always opening attached to the pre-block code, and closing right under the keyword Fucntion names are never indented TABs are two spaces wide An else is attached to the closing brace Unrelated declarations, even of the same type, should be on separate lines. Lines may be broken: After a comma Before an operator Align the new line with the beginning of the expression at the same level in the previous line Just indent 8 spaces. For a more in depth explanation of K & R look at [The C Programming Language, Second Edition] 4.2.3 Sun Convention 4.2.4 Dalbey Style Dalbey Style is Sun Conventions with five different rules.
Open-close braces are aligned vertically One character varaibles are not allowed No ternary expressions There are no Beginning Comments In an if-else statement the if and else should be vertically aligned. [More detailed Dalbey Style Rules] 4.3 Printer The most important part of the Custom Settings is the Printer section. Here is where the specific Style Rules are defined. As each Style Rule is defined, the window to the right shows the original and formatted sample source code. Click Ok or Apply if you want to approve this Convention and move on or Cancel to exit the Editor without saving these changes.
4.3.1 Header and Footer ChangeStyle allows for the user to specify a header or footer comment to insert into their code if the option is selected for formatting. ChangeStyle allows the user to specify if they want to use their specified header or footer by providing a “Use Header/Footer” check box. ChangeStyle's Smart Mode option allows for the user to specify the number of single-line comments before the first/last node (either a package/import statement or a class/interface declaration) that should be recognized as part of a header/footer and therefore be removed. A size equal to zero, means Smart Mode is disabled. To avoid header/footer duplication, when the user specifies the comment they desire to insert into their code, ChangeStyle creates a key so that if the header already exists in the file, a duplicate will not be inserted upon another format. To separate the header/footer from the rest of the source code, you may want to specify the blank lines before and after the header/footer with the Blank Lines options. The text box in the bottom of the Header/Footer page is where the user types their unique multi-line header/footer comment.ChangeStyle requires the comments specified by the user to be in multiline format. For example:
4.4 Help For more information about what each Style Convention does click on For more information about what each Custom Settings does click on The objective of ChangeStyle is to properly format code to a specified format.ChangeStyle provides many features which can be specified by the user. ChangeStyle allows the formatting preferences to be specified by the graphical interface. ChangeStyle checks and formats the following style: [Brace] [Wrapping] [Comments] [Import] [Header] [Footer] [Sorting] 6.0 Credits
2.0 Installation
Location
Extensions installed here are available:
<BLUEJ_HOME>/lib/extensions (Unix), or <BLUEJ_HOME>\lib\extensions (Windows), or <BLUEJ_HOME>/BlueJ.app/Contents/Resources/Java/extensions (Mac, Control-click BlueJ.app and choose Show Package Contents)
For all users of this system in all projects.
<USER_HOME>/.bluej/extensions (Unix), or <USER_HOME>\bluej\extensions (Windows), or <USER_HOME>/Library/Preferences/org.bluej/extensions (Mac)
For a single user for all projects.
<BLUEJ_PROJECT>/extensions





















/*
* example header/footer comment
*/

located before each box. For general help click the main
button, located at the bottom of the window.5. 0 Specific Style Conventions
Section
Author
Overview
Stephanie
Features
Stephanie
Credit Page
Stephanie
Usage: Formatting
Tracy
Usage: Editing
Mark
Requirements
Paul
Installation
Paul
<compiling the parts>
Mark
<Took overcompiling the parts>
Tracy
Final Revisions (QA)
Paul
Stage 0.1 Pictures;
Mark
Stage 0.1 Rework
Tracy
Stage 1.0 Pictures;
Mark
Stage 1.0 Rework
Tracy
Stage 2.0 Pictures;
Tracy
Stage 2.0 Footer/Header
Stephanie
Stage 2.0 Rework
Tracy