Using Sun WorkShop

Chapter 2 Getting Started

This chapter describes how to begin working in Sun WorkShop. For instructions on installing Sun WorkShop, see the Sun WorkShop Quick Install.

This chapter is organized into the following sections:

Starting Sun WorkShop

Once you have installed Sun WorkShop and added it to your command path, you can start it by typing workshop & at a command prompt.

If this is the first time you have used WorkShop, the About WorkShop window appears in front of the WorkShop main window. If you have not registered, take a few minutes and do so. If you have not read the Overview, now might be a good time to do so.

You can set colors and fonts used in the windows of WorkShop and its integrated text editor, including the foreground and background colors of windows, and colors used to highlight various types of text in the editor windows. You can also set other types of resources, such as a blinking cursor and the automatic wrapping of text in Sun WorkShop windows. For information on changing the default resources of Sun WorkShop in both CDE and non-CDE environments, see Appendix A, Setting Sun WorkShop Resources."

Sun WorkShop Main Window

The Sun WorkShop main window is your primary access to the programming operations that allow you to create, develop, debug, and fine-tune your applications. Figure 2-1 identifies the components of the window.

Figure 2-1 Sun WorkShop Main Window

Graphic

Window header 

Identifies the WorkSet and directory of the process running in Sun WorkShop 

Menu bar 

Provides commands for all of the Sun WorkShop operations 

Tool bar 

Provides quick access to the most common program development operations: opening a file, starting a build, debugging a program, browsing source files, managing WorkSets, analyzing data, managing code and versions, and designing GUIs 

Window footer 

Displays error messages and provides tool bar button definitions when the pointer is positioned over a button 

Sun WorkShop Menus

The menu bar in the Sun WorkShop main window provides the following menus, which provide commands for all of the Sun WorkShop operations.

WorkShop menu 

Provides commands to manage Sun WorkShop windows, to change the current Sun WorkShop directory, to exit Sun WorkShop, and to manage WorkSets 

File menu 

Provides commands to start an editor and create a new file or open an existing file 

Build menu 

Provides commands to open the Building window and to specify a new target, or to edit an existing target 

Debug menu 

Provides commands to open the Debugging window and to run or debug a program 

Browse menu 

Provides commands to open the Browsing window and to browse source files or classes 

Options menu 

Allows you to select a default editor, debugging options, WorkSet options, and window layout options 

Tools menu 

Provides quick access to Sun WorkShop operations and to Sun WorkShop development tools available with the Sun Performance WorkShop Fortran and the Sun Visual WorkShop C++ 

Help menu 

Provides commands to get help on programming in Sun WorkShop and to view help on a selected item; also provides a way for you to send in your comments about Sun WorkShop 

Tool Bar

The tool bar in the Sun WorkShop main window, shown in Figure 2-2, provides quick access to windows where you can edit files, build a target, debug a program, browse for program symbols, and more.

Figure 2-2 Sun WorkShop Main Window Tool Bar

Graphic

File button 

Opens the File to Open dialog box, where you can select a file to edit in the text editor of your choice--vi, GNU Emacs, and XEmacs. 

Building button 

Opens the Building window, then rebuilds the current targets. 

Debugging button 

Opens the Debugging window and loads the current program for debugging. If there is no current program, opens the Debug New Program dialog box, where you can select a program file and enter parameters for debugging. 

Browsing button 

Opens the Browsing window so you can perform queries using pattern searching or source browsing. 

WorkSets button 

Opens the WorkSets window and displays the current WorkSet. 

Analyzer button 

Opens the Sampling Analyzer window and the Analyzer Load Experiment dialog box allowing you to analyze application performance data. 

LoopTool button 

 

Opens the LoopTool window, where you can analyze multithreaded applications (available with Sun Visual WorkShop C++ and Sun Performance WorkShop Fortran) 

Merging button 

Opens the Merging window and a dialog box to select text files to compare and merge. 

TeamWare button 

 

Opens the Sun WorkShop TeamWare source code management tool, where you can access the TeamWare tools (available with Sun Visual WorkShop C++ and Sun Performance WorkShop Fortran) 

Visual button 

Opens the Visual window for you to design visual applications (available with the Sun Visual WorkShop C++) 

Selecting and Using Text Editors

Unless you have previously set your EDITOR environment variable to GNU Emacs or XEmacs, Sun WorkShop uses the vi editor (For information on how to set your EDITOR environment variable, see the man page for your command shell). To use the integrated GNU Emacs or XEmacs editors, you must use the Text Editor Options dialog box shown in Figure 2-3.

Figure 2-3 Text Editor Options Dialog Box

Graphic

The editor you choose will remain the default editor for subsequent sessions of Sun WorkShop. To change editors, choose Options > Text Editor Options from the Sun WorkShop main window and select a new default editor in the Text Editor Options dialog box.

The Sun WorkShop implementation of vi includes a Re-usable button. If the button is enabled, subsequently opened files are displayed in the original Vi window. If the button is disabled and you open a new vi file, the new file is displayed in a new Vi window. The Re-usable button in the lower-right corner of the window toggles between enabling and disabling the reuse feature.

Vi and XEmacs include tool bars specific to Sun WorkShop. GNU Emacs and XEmacs include minibuffer commands specfic to Sun WorkShop that help you to browse and debug source code. In addition, you can open Sun WorkShop from an existing Emacs session by typing M-x workshop-start in the minibuffer. To use GNU Emacs with Sun WorkShop, you need to set the load path in your .emacs file. See the online help section "Starting WorkShop From Emacs" for instructions.

Using WorkSets and Menu Picklists

Most of the Sun WorkShop menus contain picklists that provide access to the items used by the menu. For example, the picklist on the File menu contains all the files associated with the current Sun WorkShop WorkSet. The picklist on the Debug menu contains all the programs associated with the current Sun WorkShop WorkSet.A Sun WorkShop WorkSet is the set of items contained on the menu picklists.

WorkSets and menu picklists help you keep track of the files and other items you use for your development projects. WorkShop uses WorkSets and menu picklists to provide quick access to the various directories and files associated with a given development project, including the following:

Each type of item is saved to a different menu picklist. For example, if you load a program called Freeway into the Debugging window, Freeway is added to the Debug menu picklist. The next time you want to debug the Freeway program, you can choose Freeway from the Debug menu picklist.

Although you can create your own WorkSet, you do not have to. Sun WorkShop will create one for you. Sun WorkShop uses WorkSets to save complete sets of menu picklists. Whenever you start Sun WorkShop, it either creates a default WorkSet (usually .default.wst) or it opens the last WorkSet you had open. By default, when you close WorkShop, it automatically saves your current WorkSet.

You can create new WorkSets of your own using the New WorkSet item in the WorkShop menu. By saving a WorkSet you can save all the picklist items associated with a given development project under a single name. Saving your picklist items and files as a WorkSet makes them easier to access later.

Figure 2-4 WorkShop Menu

Graphic

For example, suppose you use Sun WorkShop to:

By default, the files, build target, and program you created are added to the appropriate menu picklist. In this case, the source files are placed on the File menu picklist, the build target is placed on the Build menu picklist, and the program is placed on the Debug menu picklist. To save all of these as a WorkSet, choose WorkShop Æ Save WorkSet As, and then type a name in the Name text box of the Save WorkSet As dialog box. Sun WorkShop stores the files, target and program under the name you choose. Loading this WorkSet later reloads the files, target, and program references connected to the appropriate menu picklists.

To start WorkShop with a specific WorkSet loaded, specify the WorkSet name on the command line at startup. For example, the following command starts WorkShop with all the files, targets, programs, and so on associated with the freeway WorkSet loaded on the appropriate menu picklists:

workshop freeway.wst

Adding Items to WorkSets and Menu Picklists

Whenever you start WorkShop, it remembers the last WorkSet you had open and the last set of development tasks you performed. It populates Sun WorkShop menu picklists with the items (files, programs, and so on) contained in that WorkSet.

Picklist items (for example, files on the File menu) can be added to or removed from menu picklists (and therefore to and from the current WorkSet) either by editing the WorkSet, or by adding or removing an item directly from any of the WorkShop menus.

Adding Items to a WorkSet Using the WorkSet Window

To edit the WorkSet directly, choose WorkShop Æ Edit WorkSet WorkSet_Name. When the WorkSet window appears, use it to add or delete the desired object.

Figure 2-5 WorkSet Window

Graphic

Adding Items to a WorkSet Using a Sun WorkShop Menu

To add an object to a WorkSet using a WorkShop menu, choose New from the menu. When you open a new item, it is automatically added to the menu picklist and the current WorkSet. To remove an item from a menu picklist (and therefore from the current WorkSet), choose Remove item from menu where item represents the object controlled by the menu. When the file chooser appears, select the item or items you want to remove.

Figure 2-6 File Menu Picklist

Graphic

For more information about creating, editing, or modifying WorkSets, see "Using WorkSets" in the Sun WorkShop online help.

Setting Window Layout Options

When you exit WorkShop, it remembers the size and position of its windows when it shuts down. By default, when you start WorkShop again, it uses this information in displaying its windows.

You may want Sun WorkShop to always use a particular window layout on startup, regardless of the layout when you exited your previous session. You can use the Window Layout dialog box (see Figure 2-7) to save a startup layout for Sun WorkShop to use every time it starts up.

Figure 2-7 Window Layout Dialog Box

Graphic

By default, Sun WorkShop records the size and position of each window on exit and uses this information the next time you open a window. If you want Sun WorkShop also to record the state of each window on exit (open, closed, or iconified), select the Restore size, position and visible windows radio button. When you start Sun WorkShop the next time, the windows are displayed in the recorded state. For example, if you have the Debugging window open and displayed, and the Browsing window open but iconified, when you exit Sun WorkShop, the next time you start Sun WorkShop, the Debugging window will be opened and displayed immediately, and the Browsing window will be opened and iconified.

If you select the Previous session exit layout radio button, then when Sun WorkShop starts, it uses the window layout in use at the exit from the previous session.

If you select the Preferred layout radio button, Sun WorkShop uses the window layout saved as the preferred layout for startup. When you click the Set Preferred Layout button, the current layout is saved as the preferred layout.

If you select the Factory default radio button, Sun WorkShop uses the window layout from the first time you started it.

Information Saved from Your Sun WorkShop Session

Sun WorkShop saves information from session to session in WorkSets (see "Using WorkSets and Menu Picklists"), in the .workshop-options file, and in the .workshoprc file.

Information saved in a WorkSet when you exit Sun WorkShop includes:

Information saved in your .workshop-options file when you exit Sun WorkShop includes:

Information saved in your .workshoprc file when you exit Sun WorkShop includes all of the dbx environment variable settings.