USER MANUAL

Overview

Today's ever changing software world requires programmers to abide by specific style rules for their code. ChangeStyle goes beyond a style checker and correctly formats the user's code. ChangeStyle is an extension of BlueJ and is intended for java programmers to use at their discretion. After ChangeStyle is downloaded and added to the BlueJ library, a user can format their code to their desire.

 

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  
 

[reference]

 

3.0 Usage

3.1   Format
  3.1.1 Format one class
  3.1.2 Format multiple classes
  3.1.3 Format all files in a project
3.2   Undo Formatting
  3.2.1 Undo one class
  3.2.2 Undo multiple classes
  3.2.3 Undo all files in a project
4.0   Edit preferences
5.0   Change Settings (Style conventions)

3.1 Format the Code

NOTE: The code must compile with no errors or warnings.

3.1.1 Format one Class.

fig 11

Right click the Class of choice. Click on ChangeStyle > Format to format the selected class using the current default conventions.

 

fig 60

A double panel Confirm window shows up. On the right side is the 'original' and on the left is the 'formatted' code. Click "Do not show again" to skip this step in the future.

Click "Accept" if the code is formatted the way you want. Click "cancel" if you do not want to approve these changes and return to BlueJ's Project View. Click "Edit" if you want to edit the current Style Convention.

All backups will be stored in /<PROJECT_HOME>/.csbackups/.

 

3.1.2 Format multiple classes at a time.

Select the classes you want to format by clicking and dragging your mouse around classes.

fig 70

 

Click on Tools > ChangeStyle > Format Selected.

fig 15

 

fig 61

A double panel Confirm window shows up. On the right side is the 'original' and on the left is the 'formatted' code. Click "Do not show again" to skip this step in the future. Click "Apply to all" to apply your "Accept" or "Cancel" choice to the remainder of file that need to be confirmed. Otherwise each file must be confirmed separately. Once "Accept" or "Cancel" are clicked the next formatted code pops up to be confirmed.

Click "Accept" if the code is formatted the way you want. Click "cancel" if you do not want to approve these changes and return to BlueJ's Project View. Click "Edit" if you want to edit the current Style Convention.

ChangeStyle stores backups in /<PROJECT_HOME>/.csbackups/.

 

3.1.3 Format all files in a project at once.

Click on Tools > ChangeStyle > Format All.

fig 15

 

fig 61

A double panel Confirm window shows up. On the right side is the 'original' and on the left is the 'formatted' code. Click "Do not show again" to skip this step in the future. Click "Apply to all" to apply your "Accept" or "Cancel" choice to the remainder of file that need to be confirmed. Otherwise each file must be confirmed separately. Once "Accept" or "Cancel" are clicked the next formatted code pops up to be confirmed.

Click "Accept" if the code is formatted the way you want. Click "cancel" if you do not want to approve these changes and return to BlueJ's Project View. Click "Edit" if you want to edit the current Style Convention.

ChangeStyle stores backups in /<PROJECT_HOME>/.csbackups/.

3.2 Undo Formatting

NOTE: Only works immediately after formatting code (the code cannot be altered since the last format).

3.2.1 Undo one class

Right click on the class and click on ChangeStyle > Undo.

fig 11

 

3.2.2 Undo Multiple Classes

Select the classes you want to format by clicking and dragging your mouse over the classes.

fig 70

 

Click on Tools > ChangeStyle > Undo Selected.

fig 15

 

3.2.3 Undo All Files in a Project at Once

Click on Tools > ChangeStyle > Undo Package.

fig 15

 

4.0 Edit Preferences

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 1

 

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

fig 2

Here you can Format the code, choose whether the Confirm Step happens or not, and select one of the Predefined Style Conventions. To open up the ChangeStyle Editor press Custom Settings.

 

5.0 Change Settings (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 1

 

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

fig 2

Here you can Format the code, choose whether the Confirm Step happens or not, and select one of the Predefined Style Conventions. To open up the ChangeStyle Editor press Custom Settings.

 

This opens up the Custom Settings panel which is where the Style Convention Configuration Files can be edited and customized fully.

fig 3

The first section, General, is where Style Conventions can be Imported or Exported.

 

fig 4.1 fig 4.1

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. 0 Features

The objective of ChangeStyle is to properly format code to a specified format.ChangeStyle provides many features which can be specified by the user to fit the style rules they face.

ChangeStyle allows the your formatting preferences to be specified either through the provided xml file or the graphical interface. By default, ChangeStyle uses the provided xml file, but you can modify this to your preferences.

ChangeStyle checks and formats the following style preferences:

Array Type Definitions

Line Wrapping

Curly Brace Placement

Adding Padding to definitions, calls, lists

Case Statement Default

Variable Declarations

Inserting Braces for Loop Bodies and If/Else Branches

Surrounding White Space

New Line at End of File

Redundant Import Calls

Block Indentation

Fix Javadoc headings

Try-Check Formatting

Assignment White Space

 

[additional features]

 

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