44 WebSphere Studio Application Developer Version 5 Programming GuideThe symbol in front of each template, shown Figure 2-18, in the code assist list is colored yellow, so you can distin
Trang 144 WebSphere Studio Application Developer Version 5 Programming Guide
The symbol in front of each template, shown Figure 2-18, in the code assist list is colored yellow, so you can distinguish between a template and a Java statement entry
Figure 2-18 Using templates for code assist The Templates preference page allows you to create new and edit existing templates A template is a convenience for the programmer to quickly insert often reoccurring source code patterns
To open the Templates preferences page, click Window -> Preferences -> Java
and select Templates from the Java tree, as shown in Figure 2-19
Figure 2-19 Templates preferences
Trang 2The Templates preferences page opens where you can perform the following tasks:
Create templates
Edit existing templates
Remove templates
Import templates from XML files
Export selected or all templates to a XML file
Enable or disable selected or all templates for code assist
To create a new template, click New The New Template dialog comes up as shown in Figure 2-20 Here you have to enter the name of the template, the description and its pattern
Figure 2-20 Creating a new template
The name you enter here, will be displayed in the code assist list when you press Ctrl-Space In the Pattern field you have to enter the actual code you want to be inserted by using the template
There are also some predefined variables available These variables can be inserted by clicking Insert Variable This will bring up a list and a brief description
Trang 346 WebSphere Studio Application Developer Version 5 Programming Guide
To import these templates, launch the templates preferences dialog and click
Import to open a file browser, and then navigate to the directory containing the template files
You can also enable or disable specific or all templates by either using the check boxes in front of the template or using the Enable All or Disable All buttons Exporting templates exports them to an XML file in a folder you can specify
Summary
In this chapter we covered the basic functionality of the Workbench and the underlying Java development environment
In particular, we discussed setting up workspaces and preferences
Trang 4Chapter 3. Perspectives, views, and
editors
Application Developer supports a role-based development model It does so by providing several different perspectives on the same project Each perspective is suited for a particular role and provides the developer with the necessary tools to work on the tasks associated with that role
This chapter provides information about these topics:
3
Integrated development environment (IDE) Resource perspective XSL Debug perspective Java perspective Plug-in Development perspective Java Browsing perspective Data perspective
Trang 548 WebSphere Studio Application Developer Version 5 Programming Guide
Integrated development environment (IDE)
An integrated development environment (IDE) is a set of software development tools such as source editors, compilers, and debugger, that are accessible from
a single user interface
In Application Developer, the IDE is called the Workbench Application Developer’s Workbench supports customizable perspectives that support role-based development It provides a common way for all members of a project team to create, manage, and navigate resources easily It consists of a number
of interrelated views and editors
Views provide different ways of looking at the resource you are working in Editors allow you to create and modify the resource Perspectives are a combination of views and editors that show various aspects of the project resource, and are organized by developer role or task For example, a Java developer would work most often in the Java perspective, while a Web designer would work in the Web perspective
Several perspectives are provided in Application Developer, and team members also can customize them, according to their current role of preference You can open more than one perspective at a time, and switch perspectives while you are working with Application Developer
Before describing the perspectives, we take a look at Application Developer’s help feature
Application Developer help
Application Developer’s online help system provides access to the documentation, and lets you browse, search, and print help content It also has a full-text search engine included as well as context-sensitive help
Application Developer provides the help content in a separate window that you can open by selecting Help -> Help Contents from the menu bar (Figure 3-1)
Trang 6Figure 3-1 Help windows bookshelf
In the new help window you see the available books in the left pane and the content in the right pane When selecting a book in the left pane, the appropriate table of contents opens up and you can select a topic
At any time, you can return to the bookshelf by clicking the Table of Contents
button
You can navigate through the help documents by using the Go Back and Go Forward buttons on the top right side There are also buttons for printing the document, toggling and synchronizing the navigation Synchronizing the
navigation synchronizes the navigation frame with the current topic This is
Trang 750 WebSphere Studio Application Developer Version 5 Programming Guide
Figure 3-2 Application Developer help Application Developer’s help manual contains a lot of useful information about the tool and technologies It provides information about the different concepts used by the Workbench, the different Tasks you can do within the Workbench, and some useful samples and tutorials
The Search field allows you to do a search over all books The link Advanced Search opens a dialog box where you can specify your search in more detail (Figure 3-3)
Note: The first time you search the online help, the help system initiates an
index-generation process This process builds the indexes for the search engine to use It may take several minutes, depending on the amount of documentation Each time you add or modify the documentation set (for example, when you install a new feature or update an existing one), the index will be updated to reflect the new information set
Trang 8Figure 3-3 Advanced Search dialog for help Enter your search expression in the appropriate field of the search dialog and select the set of books to searched Click Search to start your search
Perspectives
Perspectives provide a way to look at a project through different “glasses” Depending on the role you are in and/or the task you have to do, you open a different perspective A perspective defines an initial set and layout of views and editors for performing a particular set of development activities, for example, EJB development, profiling, and so forth You can change the layout and the
preferences and save a perspective that you can have customized, so that you can open it again later
Views
Trang 952 WebSphere Studio Application Developer Version 5 Programming Guide
Editors
When you open a file, Application Developer automatically opens the editor that
is associated with that file type For example, an HTML editor is opened for .html, htm and jsp files while a Java editor is opened for java and jav files Editors that have been associated with specific file types open in the editor area
of the Workbench By default, editors are stacked in a notebook arrangement inside the editor area You also have the option of tiling open files However, if there is no associated editor for a resource, Application Developer will attempt to launch an external editor outside the Workbench
Perspective layout
Most of Application Developer’s perspectives use a similar layout Figure 3-4 shows a layout of a perspective which is quite common
Figure 3-4 Perspective layout
Source Editor (Code) Design View (Visual Editor) Navigator view
Package Explorer view Hierarchy view
Menu bar / Toolbar
Outline view Properties view
Task view (show compilation errors) Search view (display search results) Console view (program output, server status)
synchronize
synchronize
Trang 10On the left side you have views that help you to navigate through your project’s files, where in the middle of the Workbench you find a larger pane, usually the source editor or the design pane This allows you to change the code and design
of files in your project The right pane usually contains the Outline or the Properties views
In some perspectives you can see that the editor pane is a little larger and the Outline or Properties view is placed at the bottom left corner of the perspective The content of the views is synchronized This means that if you change a value
in the Properties view, for example, the Editor view is automatically updated to reflect the change
Switching perspectives
There are two ways to open another perspective You can use the Open a Perspective icon in the top left corner of the Workbench working area and select the appropriate perspective from the list Alternatively, you can click
Window -> Open Perspective and either select a perspective or click Other to bring up the Select Perspective dialog (Figure 3-5)