Workbench
Overview
Peter Komisar © Conestoga
College version 1.1 Fall / 2007
Reference:
Third Draft Document for Review, Sept. 17,2007,
SG24-7501-00 'Rational Application Developer V7 Programming
Guide'.
This is a synopsis
of information found in the latter part
of the third chapter, 'Workbench setup and preferences'
found in the third draft Document for Review, dated September
17, SG24-7501-00 Rational Application Developer V7
Programming Guide. It has been prepared for private
academic purposes and is not an effort to publish the
contained material.
Anonymous
quotes are assumed to be from the
above
noted reference.
On opening the application you see a single
window, the welcome window. It has the
following icons.
Welcome Window
Icons
- Overview
- What’s New
- new features and highlights
- Tutorials
- Application
Developer
- links to TutorialsGallery
- Samples
- First Steps
- Step-by-step guidance for first-timers
- Web Resources
- links to tips, articles, industry standards etc.
Customize the Welcome Page with themes via the
customize page option.
Default
Perspective
Close the Welcome page and the Default Perspective
is presented.
Workbench,
Perspective, View & Editors
The term Workbench refers to
the desktop development
environment. Each
Workbench window of Application
Developer contains one or more perspectives. Perspectives
contain views and editors and control what appears in
certain menus and toolbars.
GUI Containment
Workbench { Perspective(s){Views, editors} }
Workspace
Starting up Application Developer you are prompted
to provide a workspace to start up. Developers may
have many workplaces.
Example Workspace Path at
Startup
c:\Documents and Settings\<user>\IBM\rationalsdp7.0\workspace
//
where <user> is the Windows user ID you used to login.
The Application Developer 'workspace' is a place
that the individual developer uses to holding various
project files.
//
it is not recommended that meta data such as
// configuration files be moved
between workspaces
Multiple
Workbenches
You can open more than one workbench on a
project to supply different perspectives. Changes
made on one bench will reflect in the other. You
cannot make a change in one workbench while a
wizard is active in another working on the same
project.
Opening Another Workbench
Window -> New Window // same perspective
By default, new perspectives are opened in the
current window. This default behavior can be
configured using:
Preference Path
Window → Preferences → General → Perspectives
The default workspace can be started on first startup
of Application Developer by specifying the workspace
location on the local machine and selecting the check
box "Use this as the default and do not ask again".
//
also via command line specifier using -data flag
Specifying Startup
Workplace Via the Command Line
c:\Program Files\IBM\SDP70\eclipse.exe -data c:\MyWorkspace
Startup parameters
List of Startup
Parameters
- -configuration configurationFileURL
- specifies config file as a URL, which
- indicates where platform is located
- what plug-ins are available
- the primary feature
- // relative URLs not allowed
- -consolelog
- mirrors Eclipse error log to console
- handy in combo with -debug
- -data <workspace directory>
- specifies startup workplace
- -debug [optionsFile]
- puts platform in debug mode
- loads debug options from optionsFile
- if not specified, looks for .options file
- -refresh
- 'global fresh' of workspace
- reconciles any changes on file system
- -showLocation [workspaceName]
- shows location of workspace
- -vm vmPath
- shows location of JRE //runtime
- relative paths to Eclipse home
- -vmargs -Xmx512M
Application
Logging
Log files help in troubleshooting when unexpected
program behavior occurs. "Application Developer
Log and Trace Analyzer implements common logging,
which enables plug-ins to log events in a common
logging log file and logging agent." There is a preference
window to configure the logging level for each of the
plug-ins. You can also set the number of days after
which archived log files will be deleted. The default
is 7 days.
Screenshot
The logging preference window set to
7 days.
"Logging is turned off by default unless plug-ins
explicitly define a logging level in their plugin.xml file.
Changing the message level from NONE to any
other level will enable logging."
Log Files
The are two primary log files. They reside in the
.metadata directory of the
workspace folder.
Primary Log Files
- CommonBaseEvents.xml
- of interest to plug-in developers
- newly created every time you
start the workbench
- the previous CommonBaseEvents.xml file is archived.
- archive file name form: CommonBaseEventstimestamp.xml
- where timestamp is the standard
Java timestamp.
//
viewable in the 'Log and Trace Analyzer'
// to do analysis, sorting, filtering
and correlation.
- .log
- captures
errors & uncaught exceptions from plug-ins.
- cumulative, each new session appends messages
- each session log starts with !SESSION string.
- .log is an ASCII file viewable in a text editor.
Preferences
The workbench preferences can be modified via
Window → Preferences. Each preference has a
page, where initial options can be changed. Help
and dialog pages provide complete descriptions.
Automatic Builds
Builds in Application Developer are compilation of
Java code. They are done automatically when a
resource has been modified and saved.
The automatic build feature can be disabled, for
instance in the circumstance where a build is of no
value until a large number of changes have been
made.
Preference Path
select Windows→ Preferences→
General→
Workspace→ clear Build
automatically
//
use restore defaults button to undo a change
Manual
Builds // aka a 'clean build'
Automatic build may slow down development.
In some cases forcing a build of a project or all
projects will help resolve build errors and dependency
issues.
Manual Build Steps ( since last
build )
- Select the desired project in the Project Explorer view.
- Select Project → clear the
build Automatically checkbox
- Select Project → Build Project
- alternatively, select Project → Build All //
builds all projects
//
only builds resources that have changed since the last build.
Manual Build Steps ( build all
resources, even those not changed )
- Select the desired project in the Project Explorer
- Select Project → Clean
- In Clean dialog select one options & click OK:
- Clean all projects // performs a build of all projects.
- Clean selected projects: <project>
//
The previously selected project selected by default,
// otherwise pick from list
Capabilities
Rational describe what you can do with Application
Developer as 'capabilities'. These can be enabled
or disabled.
Examples of Capabilities Not Enabled
by Default
- team support for Rational ClearCase
- Web services development
- Profiling
- Logging.
Capabilities are enabled in the
following ways:
- Welcome page
- mouse over human figure to enable roles
- click mouse and select capability
- Windows
preferences, Select
- Window → Preferences → General → Capabilities
- click Advanced, Select Team checkbox
- click Apply then OK // team capability is enabled
- Opening a
perspective
- Select Window → Open Perspective → Other
- elect Show all, select Profiling and Logging
- Click OK
The above briefly describes two ways to enable team
support and one way to enable profiling and logging.
Screenshot 2:
Show the team capability being enabled
via the human icon on the welcome page.
File Associations
The File Associations preferences page enables
adding or removing file types recognized by the
Workbench. Editors or external programs can also
be associated with file types.
Adding a File Association
- Select Window → Preferences →
- General → Editors → File Associations
- top right pane→add / remove file types
- bottom right pane→ add / remove editors
Example
IE is added to open .dll files // database definition language
- Select *.ddl from the file types list
- browse to find iexplore.exe
- i.e. C:\Program Files\Internet Explorer
- click Open, & OK
Local History
A local history of files is maintained. When a file
is created or modified previous editions are saved
allowing an older version to be retrieved. Each
edition is uniquely identified by date and time. Only
files have local history. Projects and folders do not.
Preference Path
Select Window → Preferences → General →
Workspace → Local History
History Settings
- Days to keep
files
- how many days to maintain in local history.
- history state older than this value is lost
- Maximum
Entries per file
- # history states per resource
- exceeding value loses oldest value
- Maximum file
size (MB)
- history states maximum size
- size exceeded --> not saved in history
//
skipped instructions to compare, replace, and restore local history
Perspectives
Preferences
The Perspectives preferences page governs how
perspectives are presented.
Preference Path
Select Window →Preferences → General → Perspectives
Options
- Open a new perspective in
- Open a new view within the perspective
- or as a fast view
(side-docked to current perspective)
// other features are listed
Web Browser Preferences
The Web browser settings select which Web
browser is the default for information display.
Preference Path
Select Window → Preferences → General → Web Browser
The default option is to use the internal Web browser.
Internet
preferences
The Internet preferences have three setting types
Internet Settings
//
the draft defers the reader to the help pages for first two items
Proxy
settings
From within an intranet, the HTTP proxy server might be
used to cross a company firewall to get to the Internet.
To set follow the
following path.
Preference Path
Select Window → Preferences → Internet → Proxy Settings
"Select 'Enable Proxy' and enter the proxy host and port.
There are additional optional settings for the use of SOCKS
and enabling proxy authentication. Click Apply and then OK."
Java Development Preferences
Application Developer provides preferences for different
programming technologies including Java, Web tools,
XML, SQL and plug-in development. This section only
covers commonly used Java development preferences.
//
other preferences are treated in relevant chapters
Java Classpath Variables
Eclipse/Dev 7 supplies a series of default classpath variables
identified by variable name, avoiding direct referencing of
the local file system. This is a recommended approach when
developing with a team using multiple projects using the same
variables. In this methodology all team members are required
to set the variables required for a project. This data is then
maintained in the workspace.
Adding
Variables Pointing to Other Code Libraries
You may add variables pointing to other code libraries. The
example given in the IBM draft is locations for JDBC driver
classes or locally developed code that will see reuse.
Path for Setting Classpath
Variables
Select Window → Preferences → Java → Build Path →
Classpath Variables.
"Creation, editing, or removing of variables can be performed
in this screen. Click New to add a new variable. In the 'New
Variable Entry' dialog enter the name of the variable and
browse for the path and click OK "
Internally Set Classpath
Variables That Cannot Be Changed
- JRE_LIB
- runtime JAR file for currently used JRE
- JRE_SRC
- The source archive for the currently used JRE
- JRE_SRCROOT
- The root path for source archive for currently used JRE
Appearance
of Java Elements
How Java class members appear in views is configurable.
Path To Java Appearance Page
Select Window → Preferences → Java → Appearance.
Following is a summary of appearance options.
Java Appearance Options
- Show method
return types
- methods in views show return types
- Show method
type parameters
- methods in views show type parameters.
- Show
categories
- show categories specified in Javadoc comments
- Show members
in Package Explorer
- displays access scope of class members
- Fold empty
packages in hierarchical layout
- folds empty packages not containing resources
- Compress
package name segments
- "compresses the name of the package
- based on a pattern supplied in the dialog
- below the check box."
- Stack views
vertically in the Java Browsing perspective
- displays Java browsing view perspective vertically
- ( rather than horizontally )
To change the order of the members to be displayed
in the Java viewers do the following:
Changing Order of Appearance of
Java Members
Select Java → Appearance → Members Sort Order.
To specify types and packages to hide do the following:
Filtering Types & Packages
Select Java → Appearance → Type Filters
//
create a new filter or add packages to the type
// filter list. The default
is to hide nothing.
Code Style and Formatting
The Workbench Java editor allows configuration
of code format and style to suit personal or team
preferences. Formatting can be applied to Java
created by wizards as well as that formed in the
editor.
Code Style Sample
- Member attributes / fields -> prefixed by an 'm'
- Static attributes / fields -> prefixed by an 's'.
- Method Parameters-> prefixed by a 'p'.
- Local variables can have any name
- Boolean getter methods will have a prefix of 'is'.
Setting Style
Select Windows → Preferences → Java → Code Style
Select the Fields row and click Edit.
In the 'Field Name Conventions dialog' enter m in the Prefix
list field and click OK.
Repeat for all the conventions defined
Coding Conventions
For the generation of setter and getter methods the
following conventions are used.
"Whenever a prefix of m followed by a capital letter is
found on an attribute, this would ignore the prefix and
generate a getter and setter without the prefix.
If the prefix is not found followed by a capitalized letter,
then the setter and getter would be generated with the
first letter capitalized followed by the rest of the name
of the attribute.
Code Style Snippet
// From IBM
Rational Application Developer 7.0 Programming Guide
private String maddress;
private float m_salary;
private int zipcode;
/**
* @return the m_salary
*/
public float getM_salary() {
return m_salary;
}
/**
* @return the maddress
*/
public String getMaddress() {
return maddress;
}
/**
* @return the counter
*/
public long getCounter() {
return mCounter;
}
/**
* @return the zipcode
*/
public int getZipcode( ) {
return zipcode;
}
Checkbox Code Style Settings
The following settings are controlled by checking
checkboxes.
Checkbox
Control Style Settings
- Qualify all
generated field accesses with 'this.'
If selected, field accesses are always
prefixed with this
-Use 'is' prefix
for getters that return boolean
If
selected, boolean getter methods are prefixed with is not get.
-Auto-
add comments for new methods and types
If
selected, new methods & types are commented
-Add '@Override'
annotation for overriding methods
If
selected, overriding methods include an @Override annotation.
-Exception variable
name in catch blocks
Specify
the exception variable name declared in catch blocks.
Formatter
The formatter preferences in Application Developer
are used to enforce the code format of the standard
defined for a team of developers. In other words,
Java written in a developer's own style can be formatted
to the specification used by a team.
//
formatting would follow testing
Three standard profiles are supplied with Application
Developer and custom profiles can be created.
Standard Built-In Profiles
- Eclipse //
default startup profile
- Eclipse 2.1 // like WebSphere Studio V5
- Java Conventions
Configuring the Formatter
Select Window → Preferences
→ Java → Code Style → Formatter
Other Options
- Show
- click to display a profile's information
- New
- click new to create a new profile
- Import
- click to load an existing profile
Using
the Formatter
In the Java editor, right-click →
Select Source → Format.
//
uses rules defined in formatter preferences
Creating a User-Defined Profile
User-defined profiles would be extensions of existing
built-in profiles. If the existing profile is modified then
it is saved as a new profile.
Profiles can be exported as XML files. They contain the
standard definitions required for your project. This file
can be stored in a team repository and imported by team
members.
Summary of Profile Features
- Indentation
- specifies indentations including
- Tab spacing
- Alignment of fields
- Indentation of code
- Braces
- formats where braces are placed
- includes a preview
- White Space
- formats where spaces are placed
- Blank Lines
- specifies where blank lines are placed
Examples // from IBM
Rational draft
- Before and after package declaration
- Before and after import declaration
- Within a class
- Before first declaration
- Before field declarations
- Before method declarations
- At the beginning of a method body
- New Lines
- Specifies where to insert a new line
Examples // from IBM
Rational draft
- In empty class body
- In empty method body
- In empty annotation body
- At end of file
- Control
Statements
- controls line insertions in control statements
- how 'if else' statements appear
- Line Wrapping
- the style for wrapping of code constructs
Examples // from IBM
Rational draft
Maximum line width (default is 80)
Default indentation (2)
- Comments
- rules for general comments and Javadoc's appearance
Java Editor
Settings
Most options for the Java editor relate to look and
feel.
Java Editor Configurations
Select Windows → Preferences → Java → Editor
Options Applicable to Text Editors
General → Editors →Text Editors
Main Java Editor Settings
- Smart caret
positioning at line start and end
- Home & End jump to line's
- first & last non-white whitespace character
- Smart caret
positioning in Java names
- (overrides platform behavior)
- If selected, adds word boundaries inside Java names.
- Report
problems as you type
- "If selected, the editor marks errors & warnings
- as you type, even if you do not save the editor
- contents. The problems are updated after a short delay."
- Highlight
matching brackets
- placing cursor next to a brace highlights brace pair
- Light bulb
for quick assists
a light bulb shows up when a quick assist is available
- Appearance
color options
- specify colors for editor appearance features
Content Assist
Content is used in assisting a rapid error free code
development. It is triggered by Ctrl+Spacebar and
will complete a variable or method name.
Configuring Content Assist
Select Windows → Preferences → Java →
Editor → Content Assist
Screenshot:
Screenshot the Content Assist Page.
Folding
The Workbench user can collapse a method, comments,
or class into a concise single line view.
Configuring Folding
Select Windows → Preferences → Java →Editor → Folding
Mark
Occurrences
This feature is used to highlight all occurrences of
a particular Java element. For instance, the selection
of a particular attribute will show in the right-hand
context bar all occurrences of that attribute in the code
being looked at.
Configuring Mark Occurrences
Select Windows → Preferences →Java → Editor
→ Mark Occurrences
Templates
A template captures frequently reoccurring code
patterns. App Dev 7, if we might call it that, has
pre-defined. It also allows for the creation of new
templates or edits of existing templates.
By typing some of the statement to be added, then
pressing Ctrl+Spacebar a list of matching templates
appears in a list.The list is filtered as you type. A
template is color coded yellow to distinguish it
from a Java statement.
Configuring Templates
Select Windows → Preferences → Java → Editor →
Templates
Click 'New' to add a new template. A text area is
provided in which the new template needs to be
coded.
'Insert Variable' is used to select from a list of
predefined variables.
Template can be both imported and exported.
Compiler Options
Compilers generate warnings or errors. Warning do
not affect correct program execution. Java Language
Specification, compiler errors are always reported as
errors by the Java compiler.
Other problems can be labeled as if they are warnings,
errors or something to be ignored.
Configuring Compiler Options
Select Window → Preferences → Java →Compiler
Four Compiler Option Sub-Divisions
- Building
- Indicate building settings
- Errors/Warnings
- Associates error and warnings to categories, e.g.
- code style
- potential programming problems
- unnecessary code
- annotations, etc.
- Javadoc
- settings dealing with Javadoc problems
- what to display as errors
- Task Tags
- create, edit and remove Java task tags.
Installed
JREs
Application Developer 7 allows you to specify which
Java Runtime Environment (JRE) should be used. By
default the standard Java VM that comes with the
product is used.
To ensure compatibility, the same JRE should be used
to compile code. For example, if an application is going
to be run on WebSphere Application Server V6.1, then
that JRE should be associated with this environment.
Configuring the Installed JREs
Select Windows → Preferences → Java →Installed JREs
JRE Preferences
By default, the JRE running the Workbench will also be
used to build and
run Java programs. This JRE appears
selected in the list of installed JREs.
If the
target JRE required not on the list of JREs, then it
needs to be installed on the machine and added onto
the list. You can add, edit, or remove a
JRE.
Steps to Adding a JRE
// assuming target is JRE 1.6 @ C:\Program
Files\Java\jre1.6
- Click Add
- In the Add JRE dialog enter:
- JRE type
- select Standard VM or Standard 1.1.x VM.
- usually 'Standard VM'
- JRE name // any name to identify the JRE
- JRE home directory* //
root directory of JRE install
- // JRE: C:\Program Files\Java\jre1.6\
- Default VM arguments
- JRE Arguments // command line arguments
- JRE system libraries
- List of JRE required, Jar files
- Add Jar
files under
- C:\Program Files\Java\jre1.6\lib and/or
- C:\Program
Files\Java\jre1.6\lib\ext directories.
- Click OK to add.
- Select the JRE in the list of installed JREs
- Set it as the default
JRE, click OK,
- Rebuild all the projects in the workspace.
*Changing the JRE where code is
executed does not affect
the set up for Java
source compilation. Compilation build path
is similarly adjustable.
That finishes a summary of the third chapter. We
should not get our 'hands on' a copy of the application
to see the features for ourselves.
Installing the
Application
Three options should be available to us.
1) Use the Application at the school. This may not be
possible initially as we told the school of the application
change very late. It takes them time to procure the
application through their channels and then to install
it.
2) Use the 60 trial from the IBM site. The pdf draft
has installation information in the Appendix A. You
will need to join IBM's site and need a high speed
connection.
3) Once you have signed on with IBM you can use
their online trial version of the application. This gives
you 3 hours trial time at a sitting.
Trial and Online Versions
http://www.ibm.com/developerworks/downloads/r/rad/tryonline.html
Assignment
Access Application Developer and provide the
following screenshots. If you were not able to access
the application please submit a short explanation of
the obstacles you encountered.
1) Screenshot The logging preference
window set to
7 days.
2) Screenshot 2: Show the
team capability being
enabled via the human icon on the welcome page.
3) Screenshot 3: Screenshot the Content Assist Page.