54 WebSphere Studio Application Developer Version 5 Programming Guide
Specifying the default perspective
The J2EE perspective is Application Developer’s default perspective. You can
also change the default perspective from the preferences dialog:
From the main menu bar, select
Window > Preferences -> Workbench ->
Preferences.
Select the perspective that you want to define as the default, and click
Make
Default.
Click
OK.
Organizing and customizing perspectives
Application Developer provides the following features to organizing perspectives:
Open perspectives
Customize perspectives
Reset perspectives
Save perspectives
Close perspectives
These actions can be found in the Window menu. To customize a perspective,
click
Window -> Customize Perspective
. The Customize Perspective dialog
opens (Figure 3-6).
Tips:
The name of the perspective is shown in the window title area.
The vertical toolbar at the left side of the Workbench, called the shortcut
bar, provides icons that you can use to quickly switch between the
perspectives that you have opened.
To close a perspective, right-click that perspective's button on the shortcut
bar and select
Close
.
After working with Application Developer for some time, you have opened
several perspectives. You might have the impression that Application
Developer is working slower. It is good practice to close perspectives,
because they can consume a lot of memory; hence, they slow down the
overall performance.
Chapter 3. Perspectives, views, and editors 55
Figure 3-6 Customize perspective
In the dialog you can use the check boxes to select which elements you want to
see on drop-down menus of the selected perspective. Items you do not select
are still accessible by clicking the Other menu option. These options can be
customizes:
The
New
menu
The
Window -> Open Perspective
menu
The
Window -> Show View
menu
Action sets (icons) that show up on the toolbar
You can also customize a perspective by adding, closing, moving, and resizing
views. To add a new view to the perspective, simply click
Window -> Show View
and select the view you would like to add to the currently open perspective.
You can move a view to another pane by using drag and drop. To move a view,
simply select its title bar, drag the view, and drop it on top of another view. Both
views are now stacked and you can use the tabs at the bottom of the view to
switch between them.
While you drag the view, the mouse cursor changes into a drop cursor. The drop
cursor indicates what will happen when you release the view you are dragging:
The floating view appears below the view underneath the cursor.
56 WebSphere Studio Application Developer Version 5 Programming Guide
The floating view appears to the left of the view underneath the
cursor.
The floating view appears to the right of the view underneath the
cursor.
The floating view appears above the view underneath the cursor.
The floating view appears as a tab in the same pane as the view
underneath the cursor. You can also drop the view on the
perspective toolbar to make it a fast view.
You cannot dock the floating view at this point.
Once you have configured the perspective to your preferences, you can save it
as your own perspective by selecting
Window -> Save Perspective As
.
To restore the currently opened perspective to its original layout, select
Window
-> Reset Perspective
.
Perspectives walkthrough
In this section we describe the perspectives that we are using to develop, test,
and deploy the samples in this document.
J2EE perspective
The default perspective of Application Developer is the J2EE perspective, shown
in Figure 3-7. Application Developer lets you change the default perspective. See
“Specifying the default perspective” on page 54 for an instruction to change the
default perspective.
The J2EE perspective contains the following views that you would typically use
when you develop resources for enterprise application, EJB, Web, and
application client, or connector projects or modules:
J2EE Navigator view—This view provides a project and Java-centric view of
your J2EE and other projects in the workspace. It will show the project
resources and not the individual model objects as in the J2EE Hierarchy view.
For Java projects, the source folders will show the packaged based grouping
Tip: You can double-click a view’s title bar to maximize the view. Double-click
again to restore it to the original size. Alternatively, you can press CTRL-M to
maximize and restore the view.
Chapter 3. Perspectives, views, and editors 57
of the files much like the Java Packages view. Note that the four J2EE
module types (EJB, application client, Web, and connector) are also Java
projects.
Figure 3-7 J2EE perspective
J2EE Hierarchy view—Provides a hierarchical view of the content models
for J2EE resources found in the J2EE projects. This view provides you with
an easy way to view deployment descriptor trees of your J2EE applications
and modules, and to quickly navigate to editors for component objects.
Additionally, it provides links to EJB to RDB mapping, and for configuring
applications to run on a J2EE application server.
Outline view—Shows the outline of the file that you are editing. The Outline
view changes as you change open files in different editors or select different
editor tabs.
Tasks view—Lists the to-do items that you have entered, plus any
automatically logged problems, warnings, or other information associated
with the selected project. The former is true if you have this option enabled.
58 WebSphere Studio Application Developer Version 5 Programming Guide
You can double-click an item to address the specific problem in the
appropriate resource.
Properties view—Provides a tabular view of the properties and associated
values of objects in files you have open in an editor. For example, you can
specify converters in the Properties view of the Mapping editor.
Status bar—Provides a description of the location of selected objects in the
J2EE Hierarchy and J2EE Navigator views in the left side. When file and
deployment descriptors are open, it shows the read-only state of the files and
the line and column numbers when applicable. Sometimes when long
operations run, a status monitor will appear in the status bar, along with a
button with a stop sign icon. Clicking the stop sign will stop the operation
when the operation can be cancelled.
Resource perspective
The Resource perspective is a very simple perspective (Figure 3-8).
Figure 3-8 Resource perspective
By default it shows these elements:
Chapter 3. Perspectives, views, and editors 59
Navigator view—This view provides a hierarchical view of all the resources
in the Workbench. By using this view you can open files for editing, or select
resources for operations such as exporting.
Outline view—This view displays an outline structure of the file that is
currently open in the editor area, and lists structural elements. The contents
of the outline view are editor-specific.
Editor pane—Depending on the type of file you are editing, the appropriate
editor is displayed in the editor area. For example, if you are editing a .java
file, the Java editor displays in the editor area.
Web perspective
Web developers can use the Web perspective to build and edit Web resources,
such as servlets, JSPs, HTML pages, Style sheets and images, as well as the
deployment descriptor file, web.xml (Figure 3-9).
Figure 3-9 Web perspective
60 WebSphere Studio Application Developer Version 5 Programming Guide
The Web perspective contains a number of views, such as:
J2EE Navigator view—The same view is included in the J2EE perspective.
Page Designer—Page Designer allows you to work with HTML files, JSP
files, and embedded JavaScript. Within the Page Designer, you can move
among three pages that provide different ways for you to work with the file
that you are editing. You can switch pages by clicking the tabs at the bottom
of the editor pane. These pages work in conjunction with the Workbench
Outline and Properties views, tool bar buttons, menu bar options, and context
menus.
– Design—The Design page of Page Designer is the WYSIWYG mode for
editing HTML and JSP files. As you edit in the Design page, your work
reflects the layout and style of the Web pages you build without the added
complexity of source tagging syntax, navigation, and debugging. Although
many tasks can also be performed in the same way in the Source page,
the Design page provides full access to Page Designer menu options,
context menu actions, view-specific GUI options (such as those in the
Styles view), and drag and drop behavior.
– Source—The Source page enables you to view and work with a file's
source code directly. The Outline and Properties views both have features
that supplement the Source page.
– Preview—Shows how the current page is likely to look when viewed in a
Web browser. JSPs shown in this view will contain only static HTML
output.
Gallery view—Contains a variety of catalogs of reusable files that can be
applied to Web pages. The file types available include images, wallpaper,
Web art, sound files, and style sheet files.
Library view—Allows you to catalog and organize reusable programming
objects, such as HTML tagging, JavaScript, and JSP code, along with files
and custom JSP tags. The view can be extended based on additional objects
that you define and include.
Outline view—Shows the outline of the file that you are currently editing. For
example, for an HTML file, the Outline view shows the tag structure and
hierarchy within the HTML file. The context menu for any selected tag
enables you to remove the tag, add an attribute to the tag (if any exist or have
not already been specified), add a child tag (if any exist), and add a sibling tag
before or after the tag.
Web Structure view—Provides you with a way to navigate through the
various referenced parts of a Web application from a starting point such as a
Web page (JSP or HTML file), an Action mapping, or a global forward. Parts
of a Web application can be JSP files, links, Action mappings, form beans,
and so forth.
Chapter 3. Perspectives, views, and editors 61
The view also give you a general idea of how the different parts of a Web
application are linked together and how different parts reference each other.
The view provides additional information about a part to facilitate Web
application development. Among the information displayed are errors that
may cause a Web application to run incorrectly and data parameters that a
part requires.
Attributes view—Provides tabbed pages that allow you to update attributes
for tags selected in files open in the active Web editor. Changes to attribute
value text fields are reflected in the edited file immediately when cursor focus
is changed, or when you press the Enter key. In addition, changes to any of
the controls in the Attributes view are immediately reflected in the edited file.
Links view—Shows the resources that the selected file in the J2EE
Navigator view links to or uses. It also shows the files that link to the file
selected in the J2EE Navigator view or are open in Page Designer.
Thumbnail view—Shows thumbnails of the images in the selected project,
folder, or file. This view is especially valuable when used in conjunction with
the Gallery view to add images from the artwork libraries supplied by
WebSphere Studio to your page designs. You can drag and drop from this
view into the J2EE Navigator view or the Design or Source page of Page
Designer.
Styles view—Provides guided editing for cascading style sheets and
individual style definitions for HTML elements.
Colors view—Allows you to apply colors from a palette (or custom colors) to
selected objects in the editing area.
Servers view—Lists servers defined for the project and their status.
Java perspective
The Java perspective (Figure 3-10) supports developers who create, edit and
build Java code.
The Java perspective consists of an editor area and displays by default the
following views:
Package Explorer view—This is displayed by default in the Java perspective
and shows the Java element hierarchy of all the Java projects in your
Workbench. It provides you with a Java-specific view of the resources shown
in the Navigator. The element hierarchy is derived from the project's build
classpath. For each project, its source folders and referenced libraries are
shown in the tree view. From here you can open and browse the contents of
both internal and external JAR files.
62 WebSphere Studio Application Developer Version 5 Programming Guide
Figure 3-10 Java perspective
Hierarchy view—Can be opened for a selected type to show its super
classes and subclasses. It offers three different ways to look at a class
hierarchy:
– The Type Hierarchy displays the type hierarchy of the selected type, that
is, its position in the hierarchy, along with all its Superclass and
subclasses
– The Supertype Hierarchy displays the supertype hierarchy of the selected
type
– The Subtype Hierarchy displays the subtype hierarchy of the selected type
More information about the Hierarchy view is provided in “Java Type Hierarchy
perspective” on page 64.
Outline view—Shows the elements (imports, class, fields, and methods),
that exist in the source file that is currently open in the editor. Clicking an item
in the outline will position you in the editor view at the line where that structure
element is defined.
Packages/Classes
Java Editor
Fields/Methods
Tasks
Chapter 3. Perspectives, views, and editors 63
See Chapter 5, “Developing Java applications” on page 93 for more information
about how to work with the Java perspective.
Java Browsing perspective
The Java Browsing perspective also addresses Java developers, but it provides
different views (Figure 3-11).
Figure 3-11 Java Browsing perspective
The Java Browsing perspective also displays an editor area, but unlike the Java
perspective, it displays by default the following views: Projects, Packages,
Types, Members, and an editor pane.
Tip: To get a larger Java editor view, you can move the Outline view and
place it tabbed next to the Package Explorer and Hierarchy view.
Java Editor