Luna_Soft_Logo

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:

 


2.0 Installation

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:

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  
 

Verify Extension Installed

To verify extension installed go to Help > Installed Extensions.

fig 1

 

Click on the ? to find more information about ChangeStyle .

fig 2

fig 3

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.

fig_22

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.)

 

fig_23

The editor window, if open shows the 'formatted' code.

3.1.2 Format All Files

Start BlueJ. Open a project. Optionally open editor.

fig 4

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.)

 

fig_24

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.

fig_5

 

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.

fig 8

The original code appears in the editor window.

3.2.2 Multiple File Undo

Click on Tools > ChangeStyle > Undo Formatting.

fig 25

A window will open that ask what files the user wants to undo. Check the checkbox of the files to undo and click Undo

fig 16

 

 

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.

fig 9

 

In the window that pops up go to the Extensions tab and if necessary scroll down to the ChangeStyle section.

fig_10

4.1 Import and Export Conventions

4.1.1 Edit

Edit lets you change the current conventions.

fig_10

The name of the convention will be called Custom... until it has been exported or saved. The user may also edit saved conventions.

fig 11

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.

fig_12

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

fig_13

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.

fig_12

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

fig_14

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

4.2.2 Kernighan and Ritchie (K & R)

For a more in depth explanation of K & R look at [The C Programming Language, Second Edition]

4.2.3 Sun Convention

[Sun Convention Rules]

4.2.4 Dalbey Style

Dalbey Style is Sun Conventions with five different rules.

[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.

fig 11

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.

fig_17

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:

/*
* example header/footer comment
*/

4.4 Help

fig_14

For more information about what each Style Convention does click on helppic

fig_18

For more information about what each Custom Settings does click on helppic located before each box. For general help click the main helppic button, located at the bottom of the window.

 

[Jalopy Manual]

 

5. 0 Specific Style Conventions

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]

[White Space]

[Indentation]

[Wrapping]

[Blank Lines]

[Comments]

[Import]

[Environment]

[Fix Javadoc headings]

[Header]

[Footer]

[Sorting]

 

[Additional features]

 

6.0 Credits

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