Chapter 2. Cosmo Code Interface Reference

This chapter describes in detail the function of each window, menu, and display in the Cosmo Code development environment (jdev). In addition, the chapter describes commands available on the command line.

This chapter contains the following sections:

Cosmo Code Development Environment Interface

The Cosmo Code interface is a window containing two decks: the Debug deck and the Query deck. Each deck contains tabbed cards that represent different debugging tools. The main Cosmo Code window also contains buttons for controlling execution of your program, a program field, a command-line interface pane, and a Thread bar.


Note: Although the Query deck (Static Analysis subsystem) is installed by default, installation is optional and the Query deck may not be available in your configuration.

The interface contains the following elements:

You can get help on using the development environment via the Help menu on the main menu bar; a one-line Quick Help bar in the lower-left corner of the window for each area of the interface; and the help command in the command-line interface.

Quick Help

Quick Help is attached to the position of the cursor. Whenever the cursor is over a certain area of the Cosmo Code window (the control buttons, the menu bar, and so on), a line of text giving a brief description of the area appears in the lower-left corner of the window.

Admin Menu

The Admin menu performs general management functions dealing with programs, windows, and user preferences. This menu is available on all cards and provides these selections:

“Attach...”  

Displays the “Attach Program Dialog” which allows you to specify a program to run and a fileset for performing queries.

”Search Path...” 


Displays the “File Search Path Dialog” which allows you to specify a path to a file to use during a debugging session.

“Set Classpath and Flags...” 


Displays the “Set Classpath and Flags Editor” which allows you to specify options for the JavaTM interpreter.

“Edit Fileset...” 

Displays the “Fileset Editor” which allows you to select files for inclusion in a fileset and create a fileset.

“Preferences...” 

Displays the “Preferences Dialog” which allows you to set configration preferences for the different tools in the environment.

“Save As Text...” 


Displays the “Save As Text Dialog” which records the information in the display area as a text file.

“Quit” 

Exits Cosmo Code.

Attach Program Dialog

The Attach Program Dialog allows you to load a program into the Cosmo Code environment. If you installed the Query deck (the Static Analysis subsystem), this dialog also allows you to specify a fileset to use in generating a database for performing queries.

Program 

An editable text field that allows you to type in the pathname and class name for a JavaTM application, or the pathname and .html filename for a Java applet.

Fileset 

An editable text field that allows you to type in the pathname and filename for a fileset to use in generating a database for performing queries. You can use this field to specify a new fileset as well as an existing fileset. Note that this field is available only when the Query deck (the Static Analysis subsystem) has been installed.

File Search Path Dialog

The File Search Path dialog allows you to specify paths to use for files during a debugging session. If your program is stopped and you would like to specify an alternative file to use in continuing, type the pathname and filename into this field. It overrides any other path settings.

File Search Path 


An editable list that contains the search path for files to use during a debugging session.

Set Classpath and Flags Editor

The Set Classpath and Flags editor allows you to set flags, or options, for the JavaTM interpreter. The format for entries is

-option value

For example:

-classpath .:/usr/people/jjones/apps/app1:/usr/people/jjones/apps/app2


Current Flags 

List of flags currently set. You can select an item to display and modify it in the Enter Flags text field.

Enter Flags 

An editable text field that either displays an item selected in the Current Flags list or allows you to type in a new flag path.

Add 

Adds a flag to the Current Flags list.

Replace  

Replaces a selected flag in the Current Flags list with a flag in the Enter Flags field.

Remove  

Removes a selected flag from the Current Flags list.

Help 

Provides a help window with a description of the editor.

Close  

Closes the editor.

Fileset Editor

To browse classes or perform queries, you need to create a fileset and a database to represent your application. You create or modify a fileset, a text file called jdev.fileset, using the Fileset Editor. The fileset is created in the directory from which you started Cosmo Code and contains the list of .class files that make up your program.

The only valid file type for a fileset is a .class file. If you add any other file types to your fileset, the database will not generate correctly and you will not be able to perform queries.

You should check that the files you include in the fileset were compiled using the -g flag to javac. If you do not use this flag, or if you use the -O flag, only partial information will be displayed in the Query deck.

For more information on filesets and database generation, see “Generating the Database.”

To invoke the Fileset Editor, choose “Edit Fileset...” from the Admin menu.

Directories and files that you can add to the fileset appear in the file list on the left of the window. Fileset contents appear in the the file list on the right of the wndow.

Browsing Directory 


A text entry field that displays the current directory. To display the contents of a new directory in the list, type a pathname to the new directory and press <Enter>.

File List 

Displays the contents of the directory specified in the Browsing Directory field. Files or directories can be selected for inclusion in the fileset. If you include a directory, all the files contained in the directory are automatically included in the fileset. Make sure the files and directories you include in the fileset consist only of .class files.

Display Files Check Button 


A check button that allows you to filter the contents of the file list to view and highlight .class files only. When the button is checked, .class files are highlighted in the file list, enabling you to move the complete set of .class files to the fileset.

Current Fileset 


A read-only display that shows the full pathname of the current fileset. The directory displayed here is the current working directory. To change the fileset, choose “Attach...” from the Admin menu in the main Cosmo code window, and enter the new fileset name in the Attach Program Dialog.

Fileset File List 


Displays the contents of the fileset. This list should display only .class files. If you have included other file types, remove them from the fileset.

Add 

Adds a selected file or directory to the fileset. To add more than one line at a time, drag the cursor over a range of files or hold down the <Control> button while clicking, then click the Add button.

Remove  

Removes a selected line from a fileset list. To remove more than one line at a time, drag the cursor over a range of files or hold down the <Control> button while clicking, then click the Remove button.

Save 

Creates the fileset or puts all the fileset changes into effect.

Cancel  

Closes the window and returns the fileset to the state it was in when you first opened the Fileset Editor.

Generating the Database

Once you have defined a fileset to represent your program using the “Fileset Editor,” you can perform queries from cards in the Query deck, or from the right mouse button menu in the Source card. The first time you switch to the Query deck or perform a query after the fileset has been created, a database is generated to represent the program's contents.

A number of files are created for the database in the following locations:

jdev.fileset.jsudindex  


Created in the directory that contains jdev.fileset. This file provides an index for the database files.

jdev.fileset.jsudlist 


Created in the directory that contains jdev.fileset. This text file lists the locations of the database files for the .class files you specified in the fileset. It is used to generate the database index.

.jsuds directories 


Created in the directories that contain the .class files specified in your fileset. For example, if you specify two directories that contain .class files in your fileset, a .jsuds directory is created in each of the two directories you specified in the fileset.

A .jsuds directory contains .jsuds file for each .class file. If the directory containing the .class files does not have write permission, a .jsuds directory is created by default in your home directory. You can specify an alternative directory using the “Preferences...” option on the Admin menu.

In generating the database, Cosmo Code searches the paths set in the CLASSPATH environment variable for any packages and classes to be analyzed that have not been specified in the fileset but are included by files in the fileset. The classes found by searching the class path are fully analyzed as though they were explicitly set in the fileset.

The CLASSPATH variable is automatically set when you start Cosmo Code. You can add to the class path using the “Set Classpath and Flags...” option on the Admin menu.

Modifying a Fileset and Updating the Database

If you later modify either the contents of the source files in the fileset or add or remove files, the database is automatically regenerated when you perform a query from the View menu in the Overview card or from the Query menu in the Query card. The database is not updated automatically when you perform queries from the right mouse button menu in the Overview, Query and Class cards. In this case, you can update the database explicitly by choosing either “Reanalyze Changed Sources” or “Reanalyze All Sources” from the Analysis menu in the cards on the Query deck.

Note that the database contents for system classes is shared across filesets and does not get regenerated when a fileset changes. If you want to rebuild the database for system classes, you must manually remove the .jsuds directory when the information for system classes is kept. (This directory is created in your home directory when you do not have write permission to directories containing system classes.)

Preferences Dialog

The Preferences dialog allows you to set configuration preferences for the different tools in the environment:

Click Apply Defaults to set the displayed preferences back to the system default. Click Apply to apply the preferences you have selected, but leave the dialog open. Click OK to apply the selected preferences and close the window. The preferences you select are preserved from one debugging session to another.

Global Preferences

The following preferences can be set in the Global Preferences category:

“Preferences File” 


A File Finder that allows you to set the path of the preferences file.

“Restore Window Configurations At Startup” 


A toggle that allows you to save your window configuration.

“Restore Window Location At Startup” 


A toggle that allows you to save your window locations.

“Display Quick-Help Bar In Windows”  


A toggle that allows you to view one-line help messages at the bottom of the window. The help messages change as you move the cursor over different areas of the window.

“Display Delayed Popup Help” 


A toggle that allows you to display help when your cursor stays over an a button for three seconds or more without moving.

“Popup Help/Expression Delay” 


A menu that allows you to select the speed with which the popup help and symbol evaluation appears. The options are “Slow,” “Medium,” and “Fast.”

Source Preferences

The following preferences can be set in the Source Preferences category:

“Use Horizontal Scrollbar” 


A toggle that allows you to specify whether you want a horizontal scrollbar in the source display area.

“Show Line Numbers” 


A toggle that displays or hides line numbers in the annotation column for the source file displayed in the source display area.

“Number of Spaces Used For Tabs” 


A text entry field that allows you to specify the number of spaces in a tab to use in formatting code displayed in the source display area.

“Popup Expression Evaluation Mode” 


A menu that allows you to set the ability to evaluate symbols in the source display area. The default value for this preference is “Auto Evaluation” which sets the ability to automatically evaluate symbols by passing the cursor over the symbol in the source display area. “Evaluation Off” switches off the Evaluation mode. “Click to Evaluate” sets the ability to evaluate a symbol by clicking on the symbol in the source display area.

Command-Line Preferences

The following preference can be set in the Command-Line Preferences category:

“Maximum History Depth” 


A text entry field that allows you to set the maximum number of commands to include in the history list.

Overview Preferences

Overview preferences are not available until you have either clicked on the Query deck icon or performed a query. The following preference can be set in the Overview Preferences category:

“Generated Files Directory” 


A text entry field that allows you to specify where to save .jsuds files. This is used only when you do not have write permission to a directory containing .class files. If you choose not to set this preference, the default behavior is to create a .jsuds directory in your home directory (~/.jsuds). If you choose to set this preference, enter a pathname ending in /.jsuds . Once you have changed the directory, the new directory is displayed when you open either the Overview or the Query preferences. For more information on .jsuds directories and files, see “Generating the Database.”

Query Preferences

Query preferences are not available until you have either clicked on the Query deck icon or performed a query. The following preference can be set in the Query Preferences category:

“Generated Files Directory” 


A text entry field that allows you to specify where to save .jsuds files. This is used only when you do not have write permission to a directory containing .class files. If you choose not to set this preference, the default behavior is to create a .jsuds directory in your home directory (~/.jsuds). If you choose to set this preference, enter a pathname ending in /.jsuds . Once you have changed the directory, the new directory is displayed when you open either the Overview or the Query preferences. For more information on .jsuds directories and files, see “Generating the Database.”

Source(2) Preferences

The Source(2) preferences affect the Source card on the Query deck. The following preferences can be set in the Source(2) Preferences category:

“Use Horizontal Scrollbar” 


A toggle that allows you to specify whether you want a horizontal scrollbar in the source display area.

“Show Line Numbers” 


A toggle that displays or hides line numbers in the annotation column for the source file displayed in the source display area.

“Number of Spaces Used For Tabs” 


A text entry field that allows you to specify the number of spaces in a tab to use in formatting code displayed in the source display area.

“Popup Expression Evaluation Mode” 


A menu that allows you to set the ability to evaluate symbols in the source display area. The default value for this preference is “Auto Evaluation” which sets the ability to automatically evaluate symbols by passing the cursor over the symbol in the source display area. “Evaluation Off” switches off the Evaluation mode. “Click to Evaluate” sets the ability to evaluate a symbol by clicking on the symbol in the source display area.

Class Preferences

The following preferences can be set in the Class preferences category:

“Display Inherited Fields” 


When checked, displays inherited methods and variables in the Class card, in addition to methods and variables defined locally.

“Display Java Package Names” 


When checked, displays the JavaTM package names in the Class Contents list.

“Display Names Aligned” 


When checked, aligns the method and variable names in the display.

“Display Arglist Aligned” 


When checked, aligns the method argument lists in the display.

Class Fields Display Order

“Declaration Order” 


Displays the related classes in order of their declaration or the detection of their relation.

“Sorted on Name”  


Performs a sort based on the name of the methods and variables and displays the result.

“Sorted on Type” 


Performs a sort based on the return type or data type of methods and variables.

Field Double Click Action

“Show Definition”  


Displays the source code where the item is defined.

“Show Declaration”  


Displays the source code where the item is declared.

“Show Declaration if no Definition”  


Displays the source code where the item is defined; if there is no definition, then the source code containing the declaration is displayed.

Class Relations Display Order

“Sorted on Name”  


Performs a sort based on the names of the classes and displays the result.

“Declaration Order” 


Displays the related classes in order of their declaration or the detection of their relation.

Save As Text Dialog

File list 

Lists files in the current directory.

Selection 

A text entry field with options to retrieve previous entries (using the Recycle button) or select directories in the same path for viewing (using the buttons along the top of the File Finder).

OK 

Saves the contents of the display area to the specified file.

Filter 

Displays a Filter dialog that allows you to filter the contents of the file list.

Cancel 

Cancels the save operation.

Help Menu

The Help menu provides a set of help cards that contain steps to complete common tasks in Cosmo Code. Each help card also contains links to related information elsewhere in the documentation.

In addition to the task-based help, the Help menu provides the following help options:

“Click for Help” 


Changes the cursor to a question mark (?). When you move the cursor over an area in the Cosmo Code window and click the left mouse button, a help window displays information about the area under the cursor.

Keyboard shortcut: <Shift F>-1

“Overview” 

Provides local web pages that contain introductory information about the Cosmo Code development environment.

Release Notes (Web) 


Provides a local web page that contains release notes, installation information and important notes about using Cosmo Code.

Demo (Web) 

Provides local web pages that contain steps on how to load, run, debug, and browse an example Java applet.

“Index...” 

Displays the entire list of help topics, alphabetically, hierarchically, or graphically.

“Keys & Shortcuts” 


Lists the available keys and shortcuts.

“Product Information” 


Provides general copyright and version number information.

Card Tabs

The tabs in the “Card Deck” allow you to quickly switch between the various cards. Each card enables you to view and manipulate different pieces of the code you are debugging: for example, the Source Card allows you to view and modify source code, the Callstack Card allows you to view and modify call stack information.

Card Deck

A card deck consists of a number of tabbed cards that allow you to move easily from one view of your program to another. For example, select the Source card to view or modify source code, or select the Data card to evaluate a symbol. The Cosmo Code development environment provides two decks: the Debug deck, which is displayed at startup, and the Query deck, which is accessible using the deck buttons to the right of the tabs.


Note: Although the Query deck (the Static Analysis subsystem) is installed by default, installation is optional and the Query deck may not be available in your configuration.

Each card in the deck can be torn off to create a separate view. You can tear off a card by using the left mouse button to drag the tab for the card to a point on your desktop, then releasing the mouse button. You can also choose “Clone Card” or “Clone Deck” from the right-button menu available on the tab of each card.

Previous Card Button

Click the Previous Card button to the left of the card tabs to move back to the previous card visited.

Deck Buttons

The deck buttons allow you to switch between decks. The Cosmo Code development environment provides access to two decks: the Debug deck and the Query deck. However, at installation you may choose to install only the Debug deck, in which case you won't see a button for the Query deck.

You can clone a deck by using the left mouse button to drag the deck icon to a new location, or by choosing “Clone Deck” from the right mouse button menu.

Program Field/Status Area

The Program field displays the pathname of the program that you are currently debugging. You can attach a program by typing the pathname to the program or just the program name in this field. If the program is a JavaTM applet, the program name must be an .html file. If the program is a standalone Java application, the program name must be the .class file containing the main class.

The Program text field is active when there is no thread running in a program. When a thread is running, the Status area appears in place of the Program field.

The Status Area is active when a program is running. It displays information about the current thread in the program. You can make a thread the current thread by clicking the thread button in the Thread bar. Status information about the thread is displayed in the Status area as in the following example:

Thread 10, Thread-7:running
Thread 3, Screen Updater: cond. waiting

The following states are possible for a thread: zombie, running, sleeping, waiting in a monitor, cond. waiting, suspended, and at breakpoint.


Note: Java and other Java-based names are trademarks of Sun Microsystems, Inc., and refer to Sun's family of Java-branded technologies.


Control Buttons

The control buttons above the Command-Line Debugging area allow you to perform operations such as running a program, suspending a thread, stepping into or over a method, and so on. The control buttons available include the following:

Continue Button

The Continue button continues execution of all threads when threads were suspended by reaching a breakpoint, and continues a single thread when the thread has been explicitly suspended. If you press the right mouse button with the cursor over the Continue button, you can choose to continue either “This Thread” or “All Threads” from the menu. The Continue command is legal only if the running thread or threads are suspended. If the program has not been run or has been killed, the button is desensitized (grayed out). If the target program has not yet started executing, click the Run button to start execution.

Suspend Button

The Suspend button stops the execution of the currently running thread. If you press the right mouse button with the cursor over the Suspend button, you can choose to suspend “This Thread” or “All Threads.” The Suspend command is valid only when a thread is running; otherwise the button is desensitized (grayed out).

Step Button

The Step button executes a single step in a line of source code. This command is legal only if a thread is suspended; otherwise the button is desensitized (grayed out). If a statement invokes a method, it is stepped “into.” That is, the next source statement is displayed, even if that statement is encountered in a different method. If a breakpoint is encountered while executing Step, the command is canceled and the thread is suspended where the breakpoint was fired.

When you press the right mouse button with the cursor over the Step button, a popup menu allows you to choose the number of source lines to be stepped. The step value menu selections consist of “1, 2, 3, 4, 5, 10, 15, 20, N...” If you choose “N...”, a dialog opens allowing you to enter a step value.

Next Button

The Next button executes a single step in a line of source code. This command is legal only if a thread is suspended; otherwise the command button is desensitized (grayed out). If a statement invokes a method, it is stepped “over.” That is, the next source statement in the current method is displayed, although statements in a different method are being executed. If a breakpoint is encountered while executing Next, the command is canceled and the thread is suspended where the breakpoint was fired.

When you press the right mouse button with the cursor over the Next button, a popup menu allows you to choose the number of source lines to be stepped. The step value menu selections consist of “1, 2, 3, 4, 5, 10, 15, 20, N...” If you choose “N...”, a dialog opens allowing you to enter a step value.

Return Button

The Return button continues execution of the thread until the current method that is being executed returns. If you move up and down the call stack while a thread is suspended, clicking the Return button continues execution and returns from whichever method you are currently examining on the call stack. This command is legal only if a thread is suspended; otherwise the command button is desensitized (grayed out). The thread is suspended immediately upon returning to the calling method. All code within the current method is executed as usual. If a breakpoint is encountered while executing the Return command, the command is canceled and the thread is suspended where the breakpoint was fired.

Examine Button

If you have selected an item to examine or evaluate in the Source card, the Examine button takes you to the Data card and displays the item in the Target field.

Frame Down Button

From any card, the Frame Down button allows you to step forward through the frames on the stack. This command is legal only if the running thread is suspended; otherwise the button is desensitized (grayed out). The information displayed in the card reflects the state of the thread at that stack frame.

Frame Up Button

From any card, the Frame Up button allows you to step backward through the frames on the stack. This command is legal only if the running thread is suspended; otherwise the button is desensitized (grayed out). The information displayed in the card reflects the state of the thread at that stack frame.

Kill Button

The Kill button stops, or kills, the currently running thread. This command is legal only if the thread is running; otherwise the button is desensitized (grayed out).

Run Button

The Run button runs the program that you are currently debugging. After the initial run, Run allows you to rerun the program, maintaining the breakpoints you have set.

Command-Line Debugging Area

The Command-Line Debugging area allows you to type in debugging commands at the jdev prompt. For a list of commands, see “Command-Line Interface.” Cut and paste features are available in this area, in addition to the following control sequences:

Completion

<Esc> 

Completes a command. Beeps if completion is not possible or if there are multiple completions.

<Ctrl-d> 

On an empty line, lists all the available debugging commands in the command-line area. Otherwise lists all possible completions. Beeps if no completions are possible.

Movement

<Ctrl-p> or up arrow 


Move backward one line in the history list

<Ctrl-n> or down arrow 


Move forward one line in the history list

<Ctrl-a> 

Move cursor to beginning of line

<Ctrl-e> 

Move cursor to end of line

<Ctrl-b> 

Move cursor back one character

<Ctrl-f> 

Move cursor forward one character

<Alt-b> 

Move cursor back one word

<Alt-f> 

Move cursor forward one word

Deletion

<Ctrl-d> 

Delete forward one character

<Ctrl-h> 

Delete backward one character

<Ctrl-w> or <Alt-Backspace> 


Delete backward one word

<Alt-d> 

Delete forward one word

<Ctrl-k> 

Delete from current position to end of line

<Ctrl-u> 

Delete entire line

Other

<Ctrl-y> 

Retrieve the last deleted lines or words

<Ctrl-s> 

Search forward in the history list

<Ctrl-r> 

Search backward in the history list

<Ctrl-m> 

Insert a carriage return

!! 

Repeat the last command

Command-Line Interface

The command-line interface supports debugging commands similar to dbx commands. For more information, refer to the dbx Reference Manual. The syntax for the Cosmo Code debugging commands is as follows:

alias [name [“string”]] 


Without arguments, lists all aliases. With a single argument, lists the value for name. With arguments name and string, creates an alias called name with the value string.

attach thread_id 


Attaches to the specified thread, adding it to the pool of controlled threads and making it the current active thread.

class classname 


Loads the specified class into the source display area and makes that source the current file.

classes  

Lists all currently known classes.

clear 

Clears all input and output from the command-line text area.

continue 

Causes the current thread to resume.

delete all 

Deletes all breakpoints.

delete breakpoint_number [,breakpoint_number, ...] 


Deletes the specified breakpoint or breakpoints. Use the status command to get a list of breakpoint numbers.

dir [dir][...] 


Without arguments, prints the current source directory list (the list of directories in which to locate a file). Otherwise appends the directory or directories supplied to the current source directory list.

disable all  

Disables all inactive breakpoints.

disable breakpoint_number [,breakpoint_number, ...] 


Disables the specified breakpoint or breakpoints. Use the status command to get a list of breakpoint numbers.

down [count] 

Moves down the specified number of frames in the call stack. down moves in the direction of the calling function.

enable all 

Enables all inactive breakpoints.

enable breakpoint_number [,breakpoint_number, ...] 


Enables the specified breakpoint or breakpoints. Use the status command to get a list of breakpoint numbers.

examine expression 


Displays expression in the Data card.

exceptions 

Lists all exceptions that are caught.

file [filename] 


Without arguments, displays the current file. Otherwise, loads filename into the Source display area and makes filename the current file.

help [keyword] 


Without arguments, prints help information for all commands. Otherwise prints help for keyword. keyword can be either a complete command or the initial characters of a command. If the characters are not unique, help is displayed for all matches to the characters specified.

history 

Lists the contents of the command history list. Last command can be repeated with !!. History list can be searched using <Ctrl-s> to move forward and <Ctrl-r> to move back, or using the up and down arrow keys. The length of the history list can be set by choosing “Preferences” from the Admin menu.

kill [thread_id][...] 


Without arguments, kills the active thread. Otherwise kills the thread or threads specified.

load [classname] 


Without arguments, reports the class currently being debugged when a program is attached. Otherwise loads the specified class for debugging.

locals 

Displays all the local variable names for the current frame and their values.

memusage 

Lists total and free memory for the program running.

methods classname 


Lists the methods in the specified class.

next [count] 

Without an argument, steps over the next line. Otherwise, steps over the specified number of source instructions. This command does not step into methods.

pop [card | deck] 


Without arguments, displays the last card visited. Otherwise displays the specified card or deck. The argument can be either a complete card or deck name or enough initial characters of the name to uniquely identify it. The current deck is always searched first.

print expression [,expression, ...] 


Prints the value of the specified expression(s). To print the value of a complex structure such as a string or an object, prefix the expression with *, for example *expression.

quit 

Exits the debugging session.

rerun [parameters] 


Without arguments, runs the program again using the same arguments. Otherwise runs using the specified arguments.

resume [id1 id2 ..] 


Without arguments, resumes current thread. Otherwise resumes specified thread or threads.

return 

Continues execution of the thread until the method currently being executed returns. If you move up and down the call stack while a thread is suspended, return continues execution and returns from whichever method you are currently examining on the call stack.

run [parameters] 


Without arguments, removes any existing parameters to the program and runs the program. Otherwise runs the program with the specified parameters.

status [breakpoint_number [, breakpoint_number, ...]] 


Without arguments, displays a list of all currently set breakpoints. Otherwise displays the specified breakpoints.

step [count] 

Without an argument, steps into the next line. Otherwise, steps the specified number of source instructions.

stop at [class] class{::|:}line_number 


Sets a breakpoint to stop execution at the specified class and line.

stop at [file file{::|:}]line_number 


If a file is specified, sets a breakpoint to stop execution at the specified file and line. Otherwise sets a breakpoint at line in the file currently displayed in the Source card.

stop exception exception_object 


Stops the thread when an exception is thrown.

stop in|entry [class] classname{::|:}method_name 


Stops execution on entering a specified class and method.

suspend [thread_id1 thread_id2 ..] 


Without arguments, suspends the current thread. Otherwise, suspends the specified thread or threads.

thread thread_id 


Sets the current thread to the specified thread.

threads [groupname] 


Without an argument, lists threads in the current thread group. Otherwise, lists all threads in the specified group.

unalias name 

Cancels the alias specified as name.

up [count] 

Moves up the specified number of frames in the call stack. up moves in the direction of the called function.

use [dir][dir] 

Without arguments, displays the current source directory list (the set of directories in which to locate a file). Otherwise, sets the source directory list to the directories supplied.

where [thread] 


Without arguments, prints the current call stack. Otherwise prints the call stack for the specified thread. The specified thread can either be the ID displayed by the threads command, or the thread name displayed by the threads command and in the Thread Bar.

Thread Bar

The Thread bar is located at the bottom of the Cosmo Code window. For each thread in the program, the Thread bar contains a button that consists of an icon followed by a thread name. The Thread bar displays threads spawned by standard JavaTM class libraries as well as threads you have explicitly created. For example, if you write an applet that does not explicitly create a thread, you will see a number of threads with names like Awt-Motif or Screen Updater-3 created by classes that you use in your applet.

Thread buttons display the following information:

  • Blue highlight around the button—the thread is the current thread and all control buttons and Debug deck cards apply to the thread.

  • Green circle icon on the button—the thread is runnable (either running or waiting to run).

  • Red square icon on the button—the thread is suspended.

  • Grey X icon on the button—the thread is stopped (killed).

At any point while a program is running, one thread is the current thread. When a thread is the current thread, you can suspend, resume, or stop the thread. The cards and commands in the Debug deck apply to the current thread. With one exception, you control which thread is current by clicking on a thread button to make it the current thread. If an existing current thread is running and a breakpoint is encountered in another thread, that thread automatically becomes the current thread.

When you select a thread by clicking on its button, status information about the thread is displayed in the Status area as in the following example:

Thread 10, Thread-7:running
Thread 3, Screen Updater: cond. waiting

The following states are possible for a thread: zombie, running, sleeping, waiting in a monitor, cond. waiting, suspended, and at breakpoint.

Click the right mouse button on a thread icon to view the thread name or ID and to display a menu with the following options:

“Switch” 

Makes the selected thread the current thread.

“Hide Label”/”Show Label” 


Hides or shows the label for the thread icon.

“Set Label..” 

Allows you to specify a label name for a thread. The default label shows either the thread name (if a name is specified in the source code) or a system generated thread name such as Thread-7.


Note: The Thread bar displays thread names, not thread IDs. If you do not explicitly name a thread when you create it, a system-generated name such as Thread-7 is used (although the thread ID for this thread might be 9). Status messages and command-line output display both the thread name and the thread ID.


Debug deck

The Debug deck is displayed when you start the Cosmo Code development environment. It contains the following cards for source-code debugging and analysis:

Source Card

The Source card allows you to display a file's contents, set breakpoints in the file, and evaluate symbols. You can switch between files in the display area using the File Finder located at the bottom of the file display area. If a breakpoint is reached in a file that is not currently displayed, the Source card shows the file in the display area, highlighting the line of source code where the breakpoint is set.

The Source card contains the following elements:

Source Display Area

The source display area is a scrollable text area for displaying and editing source code. Use the Source menu or use the File Finder to view a source file.

If a breakpoint has been set in a displayed file

  • The line of source code is highlighted

  • The column to the left of the source code contains an arrow icon to indicate the state of the breakpoint. The arrow points down when the breakpoint is set but not reached, and points right when the breakpoint is reached during execution.

  • The scroll bar contains a colored indicator for each breakpoint. Click the middle mouse button on the indicator to scroll the file to the breakpoint.

When a breakpoint is reached in a current thread, the thread is suspended and the source where the breakpoint is set is displayed in the source display area. If a current thread is suspended using the Suspend button, the source for the code being executed is displayed in the source display area.

Source Card Popup Menu

In the source display area, select a symbol to get a right mouse button menu with the following options:

“Popup Eval” 

Evaluates the selected symbol and displays the results in a popup window over the display area.

“Examine”  

Displays the symbol being evaluated and the result of the evaluation in the Data card.

“Where Defined” 


Displays the location in the source file where the selected item is defined.

“Format” 

Provides a submenu that allows you to view the selected item as one of the following types: Default, String, Int, Unsigned, Octal, Hex, Float, Char, Type, and Sizeof.

File Finder

The File Finder allows you to locate and open source files. Use the drop-pocket, text-field or Recycle icon to open a file as follows:

  • Drag and drop a file into the drop pocket to the left of the text field.

  • Type the pathname and filename into the text field.

  • Click Recycle to view a file whose contents you have previously displayed.

Source Annotation Column

The Source Annotation column displays line numbers for a file if the “Show Line Numbers“ preference has been set in the Preferences dialog. It can also be used to set, display, and clear breakpoints.

To set a breakpoint, click the left mouse button when the cursor is positioned to the left of the source-code line where you want to set the breakpoint. To delete a breakpoint, click the left mouse button over an active breakpoint.

Press the right mouse button in the Annotation column to view a menu that displays the line number at the position of the cursor and offers the following options:

“Continue to Line” 


Allows you to continue execution to the location where the menu option is selected. For example, if a breakpoint is set at line 62 and you want to continue to line 85, press the right mouse button at line 85 and choose “Continue to Line” from the menu. Execution continues from line 62 to 85.

“Enable Breakpoint” 


Allows you to enable a disabled breakpoint. This option is active when the cursor is over an disabled breakpoint.

“Disable Breakpoint” 


Allows you to disable an active breakpoint. This option is active when the cursor is over an enabled breakpoint.

“Delete Breakpoint” 


Allows you to delete a breakpoint. This option is active when the cursor is over a breakpoint.

“Modify Breakpoint...” 


Allows you to modify a breakpoint. The breakpoint you want to modify is displayed in the Breakpoint dialog. When you modify a breakpoint, you are actually deleting a breakpoint and creating another in its place. For example, if you have a breakpoint at line 32 in a file and you modify the line number to 35, this creates a new breakpoint at line 35 and deletes the breakpoint at line 32. This option is active when the cursor is over a breakpoint.

“Create Breakpoint...” 


Opens the “Breakpoint Dialog” and allows you to create a breakpoint.

Source Menu

The Source menu in the Source card provides these selections to deal with source files:

“Open...” 

Displays an “Open Dialog” that allows you to select and display a source file in the source display area.

Keyboard shortcut: <Ctrl> o

“Save” 

Records changes made during the debugging session to the source file. The file must be editable before you can save it. (Select “Make Editable,” from the Source menu if the file is read only.)

“Save As...” 

Displays a “Save File Dialog” that allows you to record changes made during the debugging session by saving the source file under a different filename or to a different location.

“Insert File...” 

Displays an “Insert File Dialog” that allows you to insert the text of a file within your current file. This option is available when the source code display area is in editable mode.

“Make Read Only” / “Make Editable” 


Toggles the source code displayed between read-only and writable states so that you can edit your code. This option does not check the files permissions on disk.

“Search...” 

Displays a “Search Dialog” that allows you to search for a Literal Case-Sensitive, Literal Case-Insensitive, or Regular Expression.

Keyboard shortcut: <Ctrl> s

“Go To Line...” 

Displays a “Go To Line Dialog” that lets you scroll to a position in the source code by specifying a line number.

Open Dialog

The Open dialog allows you to display source-code files as follows:

File List 

A list of files in the current directory.

File Finder 

An editable text field with options to retrieve previous entries (using the Recycle button) or select directories in the same path for viewing (using the buttons along the top of the File Finder).

OK 

Opens the file you have specified.

Cancel 

Cancels the open file operation.

Filter 

Displays a Filter dialog that allows you to filter the contents of the file list.

Save File Dialog

The Save File dialog allows you to save source-code files as follows:

File List 

A list of files in the current directory.

File Finder 

An editable text field with options to retrieve previous entries (using the Recycle button) or select directories in the same path for viewing (using the buttons along the top of the File Finder).

OK 

Saves the file to the path you have specified.

Cancel 

Cancels the save operation.

Filter 

Displays a Filter dialog that allows you to filter the contents of the file list.

Insert File Dialog

The Insert File dialog allows you to insert a file into a source-code file as follows:

File List 

A list of files in the current directory.

File Finder 

An editable text field with options to retrieve previous entries (using the Recycle button) or select directories in the same path for viewing (using the buttons along the top of the File Finder).

OK 

Inserts the file you have specified at the insertion point in the source code display area.

Cancel 

Cancels the insert file operation.

Filter 

Displays a Filter dialog that allows you to filter the contents of the file list.

Search Dialog

The Search dialog allows you to search for specific items in a source file as follows:

Search Type 

A set of radio buttons that allow you to specify how you want the search performed: Literal Case Sensitive, Literal Case Insensitive, Regular Expression.

Next 

Scrolls to the next occurrence of an item and highlights it.

Prev 

Scrolls to the previous occurrence of an item and highlights it.

Reset 

Removes the highlighted matches in the source display area, the search target indicators in the scroll bar, and any text in the Search text entry field.

Search 

An editable text field. Type in the item to search for and press <Enter> or click Apply.

Apply 

Performs the search and highlights all matches in the source display area. A beep after a few seconds indicates that no match has been found. Click a search target indicator in the scroll bar with the middle mouse button to scroll to that point.

Cancel 

Removes the highlighted matches in the source display area and the search target indicators in the scroll bar, then closes the dialog.

Close 

Closes the dialog.

Go To Line Dialog

The Go To Line dialog allows you to enter a line number or use the slider at the top of the dialog to select a line number. You do not have to display line numbers in the Source Annotation column to use this feature.

Breakpoints Menu

The Breakpoints menu in the Source card provides the “Create Breakpoint...” option which opens the “Breakpoint Dialog.”

Callstack Card

The Callstack card displays the methods in the call stack (referred to as frames) when a thread is at a breakpoint or suspended. The most recent call is highlighted and displayed at the bottom of the list of calls in the display area. To view source code for a user code item on the call stack, double-click the item name. The Source card pops to the top with the appropriate location in the source file highlighted.

Each entry in the Callstack Display area appears as follows:

class.method(filename.java:line_number)

In a multi-threaded application, the current thread determines the information displayed in the call stack. To view the call stack for other threads, click the appropriate thread in the thread bar at the bottom of the window.

Breakpoints Card

The Breakpoints card allows you to set, clear, enable, and disable one or more breakpoints on lines of source code, methods, and exceptions. The main display area of the Breakpoints card shows all the breakpoints set in the program and their status.

Edit Menu

The Edit menu provides the following options:

“Create Breakpoint...” 


Displays a “Breakpoint Dialog” that allows you to create breakpoints.

“Delete All Breakpoints 


Deletes all breakpoints displayed in the Breakpoints display area.

“Enable All Breakpoints” 


Enables all breakpoints displayed in the Breakpoints display area.

“Disable All Breakpoints” 


Disables all breakpoints displayed in the Breakpoints display area.

Breakpoint Dialog

The Breakpoint dialog allows you to set three types of breakpoints using the option menu at the top of the dialog.

“Source Breakpoint” 


Provides text entry fields to enter both a line number and a file or class name.

“Method Breakpoint” 


Provides a text entry field to enter a class name followed by a colon then a method name.

“Exception breakpoint” 


Provides a text entry field for a class which is the argument to a throw command in your source code. This class must be a descendant of the Throwable class.

The OK button creates the breakpoint or generates an error message if the breakpoint cannot be created. The Clear button clears the contents of the dialog entry boxes. The Cancel button cancels breakpoint creation.

Breakpoints Display Area

The display area shows a list of all breakpoints in either enabled or disabled state. The disabled breakpoints are highlighted in red. You can perform the following operations on breakpoints displayed in the card:

  • Enable, disable, or delete one or more selected breakpoints by selecting the breakpoint(s) and clicking the appropriate button below the display area.

  • Modify a breakpoint by selecting it from the list and then clicking the Modify button below the display area.

  • Select one or more breakpoints and press the right mouse button to display a menu that allows you to enable, disable, delete or modify breakpoints.

  • Double-click a breakpoint to open the Breakpoint dialog and modify the breakpoint.

Enable Button

The Enable button enables a disabled breakpoint that has been selected in the list (highlighted in red).

Disable Button

The Disable button disables a breakpoint that has been selected in the list. The breakpoint is highlighted in red to show its disabled status.

Delete Button

The Delete button allows you to delete a breakpoint selected in the list.

Modify Button

The Modify button allows you to modify a breakpoint selected in the list. The breakpoint you want to modify is displayed in the Breakpoint dialog. When you modify a breakpoint, you are actually deleting a breakpoint and creating another in its place. For example, if you have a breakpoint at line 32 in a file and you modify the line number to 35, this creates a new breakpoint at line 35 and deletes the breakpoint at line 32.

Data Card

The Data card allows you to examine variables and expressions in detail, to set variable values, and to set up a view of expressions that is updated each time some part of your program reaches a breakpoint. For example, you can select an object in the Source card and click the Examine button to view the object's structure in the Data card. You can store expressions or variables in the Data card while a program is running. Each time a breakpoint is encountered or a thread is suspended, the stored expression or variable values are updated.

Edit Menu

The Edit menu offers the “Clear All” option to clear all data displayed in the Data card Target field.

Target Field

The Target field allows you to type in a symbol for evaluation. The evaluation is performed when you press <Enter>, and the result appears in the Expression Details area. The following are examples of formats that can be evaluated:

symbol 

Displays the value of symbol.

*object 

Displays the contents of object as a table.

*array 

Displays the contents of array as a table.

array[i] 

Displays the value of the specified array position.

object.field 

Displays the contents of the specified field in the structure.

Keep Button

The Keep button allows you to move an item from the display area to the Expression View area where values are updated during the running of the program.

View Option Menu

The View option menu allows you to select the type of data to view and the format to view it in. The options are

Expression Details Area

If you have compiled your program using javac -g, you can type in a symbol to evaluate in the Target field. When you press <Enter>, the result appears in the Expression Details area. The following are examples of formats that can be evaluated:

symbol 

Displays the value of symbol.

*object 

Displays the contents of object as a table.

*array 

Displays the contents of array as a table.

array[i] 

Displays the value of the specified array position.

object.field 

Displays the contents of the specified field in the structure.

If an evaluation result is an object, array, or similar complex structure, its handle is displayed. Double click the handle to view the contents of the structure in the Expression Details area.

Expression View Area

You can select either the “Custom” or “Locals” view for the Expression View area using the View option menu. The default view is “Custom.” Both views display a two-column table. The left-hand column contains variables or expressions and the right-hand column contains values.

Press the right mouse button in the right-hand column of the table to display a menu with the following options:

“Popup Eval” 

Evaluates the selected variable or expression and displays the results in a popup window over the display area.

“Examine”  

Displays the variable or expression being evaluated and the result of the evaluation in the Data card.

“Where Defined” 


Displays the location in the source file where the selected item is defined.

“Format” 

Provides a submenu that allows you to view the selected item as one of the following types: Default, String, Int, Unsigned, Octal, Hex, Float, Char, Type, and Sizeof.

Custom View

The Custom view allows you to record symbols whose values you want to monitor as you run a program. You can type symbols into the left-hand column of the table, and view their current values in the right-hand column. You can also move an expression or variable from the Target field to the table by clicking the Keep button.

Locals View

The Locals view displays variables local to the file displayed in the Source card.

Execution Card

The Execution card displays text output from a JavaTM program in a scrollable display area.

Query Deck

The Query deck allows you to examine the structure of your JavaTM program by providing features to list different elements of the program, such as classes or methods. You can also perform queries on relationships between the different elements of your application; for example, you can determine which methods call each other. The Query deck contains the following elements:

Analysis Menu

The Analysis menu appears on all cards in the Query deck. It provides options for rebuilding the query database from .class files:

“Reanalyze Changed Sources” 


Rebuilds the query database for any files that have been changed.

“Reanalyze All Sources” 


Rebuilds the query database using all files.

For more information on when to use these menu items, see “Generating the Database.”

Overview Card

The Overview card displays different views of an application by listing various components that make up the application, such as classes or files. From any view of your application, you can perform more specific queries.

The Overview card contains the following elements:

View Menu

The View menu provides the following options:

“Class List”  

Returns all classes it finds in the files defined by the fileset.

“Method List” 

Returns all methods in the fileset.

“File List” 

Returns all files included in the fileset as well as any included files specified by files within the fileset.

Overview History Buttons

The left and right arrow buttons allow you to cycle through previous query results. The left arrow moves back in history, and the right arrow moves forward. Arrow buttons are desensitized (grayed out) if there is no history in the direction of the arrow. The results from previous queries are displayed in the display area. The center History button displays a history list with the last ten queries. New queries are always added to the bottom of the list.

Title Field

The Title field describes the contents of the display area in the Overview card. For example, if you have chosen to list all classes in a fileset, the title field would read “Class List.”

List Display Area

The List Display area displays a view selected from the View menu. The options available are:

You can double-click an item in a list to view it in greater detail:

  • Double-click a class to display the class in the Class card.

  • Double-click a method to display the class containing the method in the Source card.

  • Double-click a filename to display the file in the Query deck's Source card.

  • Double-click a variable to display the class containing the variable in the Source card.

To perform a query on an item in the display area, select the item and press the right mouse button to get a menu appropriate for the selected item. Query results are displayed in the Query card. The right mouse button menus are

If you change the contents of source files in your fileset, or change the contents of the fileset before performing a right mouse button query, you must recompile any changed files and update the database to reflect fileset changes by choosing the appropriate item from the Analysis menu. For more information on modifying filesets and regenerating the database, see “Generating the Database.”

File Actions

The options available on the File Actions menu are

“Show in Class Card“ 


Because this option is irrelevant for files, it is desensitized (grayed out).

“Show Definition”  


Displays the selected file in the Source card on the Query deck.

Class Actions

The options available on the Class Actions menu are

“List Fields” 

Displays all methods and variables in the class.

“List Methods” 


Displays a list of methods in the class.

“List Variables” 


Displays a list of variables in the class.

“List Classes Using” 


Displays a list of classes that use the selected class.

“Lists Methods Using” 


Displays a list of methods that use the selected class.

“List All Derived Classes” 


Displays all the classes that inherit from the selected class.

“Show in Class Card” 


Displays the selected class in the Class card.

“Show Definition” 


Displays the source code for the selected class in the Source card on the Query deck.

Variable Actions

The options available on the Variable Actions menu are

“List Classes Using” 


Displays a list of classes that use the selected variable.

“Lists Methods Using” 


Displays a list of methods that use the selected variable.

“Show in Class Card” 


Displays the class containing the selected variable in the Class card.

“Show Definition” 


Displays the source code for the definition of the selected variable in the Source card on the Query deck.

Method Actions

The options available on the Method Actions menu are

“List Classes Used” 


Displays all classes used by the selected method.

“List Fields Used” 


Displays all methods and variables used by the selected method.

“List Methods Used” 


Displays all the methods used by the selected method.

“List Variables Used” 


Displays all the variables used by the selected method.

“List Classes Using” 


Displays a list of classes that use the selected method.

“Lists Methods Using” 


Displays a list of methods that use the selected method.

“Show in Class Card” 


Displays the class containing the selected method in the Class card.

“Show Definition” 


Displays the source code for the definition of the selected method in the Source card on the Query deck.

Class List

The Class List displays information in the following columns. A horizontal scroll bar appears across the bottom of the display area if columns are not visible.

Class  

Shows class or interface type and package information.

File 

Shows the file that contains the class or interface type.

Line 

Shows the line number at which the class or interface type is defined.

Text 

Shows the first line of the class or interface type declaration or, if this information is not available, one of the following two messages is displayed:

<could not open package.class>— Source files for the class could not be found. If the .java files are not in the same directory as the .class files (or in the directory where you compiled the files), add the directory containing the .java files using the “Search Path...” from the Admin menu. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

<invalid line number>—Files were probably not compiled using the -g option to javac. The -g option provides additional information used by both the debugger and the static analysis extension. To get line number and source information, recompile the .java files using javac -g. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

Method List

The Method List displays information in the following columns. A horizontal scroll bar appears across the bottom of the display area if columns are not visible.

Method 

Shows the method name.

Class  

Shows class or interface type and package information.

File 

Shows the file that contains the class or interface type.

Line 

Shows the line number at which the class or interface type is defined.

Text 

Shows the first line of the class or interface declaration or, if this information is not available, one of the following two messages is displayed:

<could not open package.class>— Source files for the class could not be found. If the .java files are not in the same directory as the .class files (or in the directory where you compiled the files), add the directory containing the .java files using the “Search Path...” from the Admin menu. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

<invalid line number>—Files were probably not compiled using the -g option to javac. The -g option provides additional information used by both the debugger and the static analysis extension. To get line number and source information, recompile the .java files using javac -g. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

File List

The File List displays file names in the File column.

Query Card

The Query card allows you to perform queries and display results for any query you have performed.

The Query card contains the following elements:

Query Target Field

The Query Target field allows you to enter a class, method or file to use in performing a query. Note that this field is case sensitive. You can enter either a complete class, method, or file name or you can enter a partial string. If you type a partial string into this field and then perform a query, the Query card displays all elements that match the partial string.

Query History Buttons

The left and right arrow buttons allow you to cycle through previous query results. The left arrow moves back in history, and the right arrow moves forward. Arrow buttons are desensitized (grayed out) if there is no history in the direction of the arrow. The results from previous queries are displayed in the display area. The center History button displays a history list with the last ten queries. New queries are always added to the bottom of the list.

Query Option Menu

The Query option menu allows you to perform the queries listed below. Results are displayed in the Query card.

“Where Defined?” 


Expects a symbol name in the Query Target field. It finds all symbols that match the target text and returns the source-code locations where those symbols are defined. If you double-click a source location in the Query Results area, the source is displayed at the correct line in the Source card.

“Find Matching Classes” 


Expects a class name or part of a class name in the Query Target field and returns all classes that match the target. Double-click a class to display the class in the Class card.

“Find Matching Methods” 


Expects a method name or part of a method name in the Query Target field and returns all methods that match the target. Double-click a method to display the class containing the method in the Class card.

“Find Matching Variables” 


Expects a variable name or part of a variable name in the Query Target field and returns all variables that match the target. Double-click a variable to display the class containing the variable in the Class card.

“Find Matching Files” 


Expects either a filename or part of a filename in the Query Target field and returns all filenames that match the target. Double-click a filename to display it in the Source card on the Query deck.

Do Query Button

After entering a query target in the Query Target field and selecting a query from the Query menu, click the Do Query button to perform the query. The results are displayed in the Query card.

Query Results Display Area

The Query Results Display area displays the results of queries performed from the Query option menu below the Query Target field, or from the right mouse button menu in the Overview and Query cards.

The queries available from the option menu are:

You can double-click an item displayed in the Query results area to view it in more detail:

  • Double-click a class to display the class in the Class card.

  • Double-click a method to display the class containing the method in the Source card.

  • Double-click a filename to display the file in the Source card.

  • Double-click a variable to display the class containing the variable in the Source card.

To perform a query on an item in the display area, select the item and press the right mouse button to get a menu appropriate for the selected item. The right mouse button menus are

If you change the contents of source files in your fileset, or change the contents of the fileset before performing a right mouse button query, you must recompile any changed files and update the database to reflect fileset changes by choosing the appropriate item from the Analysis menu. For more information on modifying filesets and regenerating the database, see “Generating the Database.”

Where Defined

The Where Defined query displays symbols that match the text entered in the Query Target field in the following columns. A horizontal scroll bar appears across the bottom of the display area if columns are not visible.

Symbol 

Shows the name of the symbol that matches the text entered in the Query Target field.

Scope 

Shows the scope within which the symbol is valid.

File 

Shows the file that contains the class or interface type.

Line 

Shows the line number at which the class or interface type is defined.

Text 

Shows the first line of the class or interface declaration or, if this information is not available, one of the following two messages is displayed:

<could not open package.class>—Source files for the class could not be found. If the .java files are not in the same directory as the .class files (or in the directory where you compiled the files), add the directory containing the .java files using the “Search Path...” from the Admin menu. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

<invalid line number>—Files were probably not compiled using the -g option to javac. The -g option provides additional information used by both the debugger and the static analysis extension. To get line number and source information, recompile the .java files using javac -g. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

Find Matching Classes

The Find Matching Classes query displays classes that match the text entered in the Query Target field in the following columns. A horizontal scroll bar appears across the bottom of the display area if columns are not visible.

Class  

Shows class or interface type and package information.

File 

Shows the file that contains the class or interface type.

Line 

Shows the line number at which the class or interface type is defined.

Text 

Shows the first line of the class or interface declaration or, if this information is not available, one of the following two messages is displayed:

<could not open package.class>—Source files for the class could not be found. If the .java files are not in the same directory as the .class files (or in the directory where you compiled the files), add the directory containing the .java files using the “Search Path...” from the Admin menu. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

<invalid line number>—Files were probably not compiled using the -g option to javac. The -g option provides additional information used by both the debugger and the static analysis extension. To get line number and source information, recompile the .java files using javac -g. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

Find Matching Methods

The Find Matching Methods query displays methods that match the text entered in the Query Target field in the following columns. A horizontal scroll bar appears across the bottom of the display area if columns are not visible.

Method 

Shows the method name.

Class  

Shows class or interface type and package information.

File 

Shows the file that contains the class or interface type.

Line 

Shows the line number at which the class or interface type is defined.

Text 

Shows the first line of the class or interface declaration or, if this information is not available, one of the following two messages is displayed:

<could not open package.class>— Source files for the class could not be found. If the .java files are not in the same directory as the .class files (or in the directory where you compiled the files), add the directory containing the .java files using the “Search Path...” from the Admin menu. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

<invalid line number>—Files were probably not compiled using the -g option to javac. The -g option provides additional information used by both the debugger and the static analysis extension. To get line number and source information, recompile the .java files using javac -g. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

Find Matching Variables

The Find Matching Variables query displays variables that match the text entered in the Query Target field in the following columns. A horizontal scroll bar appears across the bottom of the display area if columns are not visible.

Variable 

Shows the variable name.

Class  

Shows class or interface type and package information.

File 

Shows the file that contains the class or interface type.

Line 

Shows the line number at which the class or interface type is defined.

Text 

Shows the first line of the class or interface declaration or, if this information is not available, one of the following two messages is displayed:

<could not open package.class>— Source files for the class could not be found. If the .java files are not in the same directory as the .class files (or in the directory where you compiled the files), add the directory containing the .java files using the “Search Path...” from the Admin menu. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

<invalid line number>—Files were probably not compiled using the -g option to javac. The -g option provides additional information used by both the debugger and the static analysis extension. To get line number and source information, recompile the .java files using javac -g. Then choose “Reanalyze all Sources” from the Analysis menu and try the query again.

Find Matching Files

The Find Matching Files query displays files that match the text entered in the Query Target field.

Class Card

The Class card displays the contents of a class, and the relationships between classes. It also allows you to graph relations between classes. You can switch to the Class card and type in a class name to view, or you can double-click a class listed in the Overview card or the Query card to open the Class card automatically.

The Class card contains the following elements:

Current Subject Field

The Current Subject field indicates the kind and name of the element to be analyzed. The label on this field is initially Current Subject, but changes to one of the following labels, depending on what is displayed in the Class card: Java Class, Java Abstract Class, Java Final Class, or Java Interface. You can type a class or interface name directly into this field.

If you type a question mark (?) into the Current Subject field, the “Browsing Choices Window” opens. Double-click an item in the Browsing Choices window to display the item in the Class card.

Name Completion

If you type a partial string and then press the space bar, the Class card attempts to complete the element name by searching the fileset. A beep indicates that more than one matching name exists. If a match is made, press <Enter> to view the new element in the Class card.

Recycle Button

The Recycle button displays a list of classes previously viewed in the Class card. The list is empty if you have not yet displayed a class in the Class card.

Class Graph Button

The Class Graph button opens a “Class Graph Window” that displays a graph of the classes related to the class currently displayed in the Class card.

Call Graph Button

The Call Graph button opens a “Call Graph Window” that displays a graph of the calls between classes related to the class currently displayed in the Class card.

Query Identification Area

The Query Identification area is directly above the list area. This area displays the most recent query as a sentence containing both the query question and the name of the object of the query. The number of elements matching the query is displayed at the right end of the line.

List Areas

The lower two-thirds of the Class card consists of the Class Contents List and the Class Relations List areas displayed in side-by-side panes. You can change the relative widths of the panes by moving the sash that separates them. The two list areas contain the following information:

Queries from the Class Card

You can select an item in the Class Contents List or the Class Relations List and press the right mouse button to display a menu with queries appropriate for the selected item:

Class Contents List

The Class Contents list displays the methods and variables internal to the current class. They are organized according to access category—Restricted, Public, Protected, or Private. Within each access category, contents are sorted into two categories—Instance and Static. Within each category, first variables and then methods are displayed.

Here is a schematic of the outline format for each nested list:

Access (RESTRICTED, PUBLIC, PROTECTED, or PRIVATE)
    Scope (INSTANCE or STATIC)
       VARIABLES
       METHODS


Note: The Restricted category is the category the JavaTM language uses when no access keyword is supplied in the field definition. For more information, see the JavaTM Language Specification available from Sun's web site.

The outline icon to the left of items in the Class Contents list can be used to collapse (hide) or expand (make visible) the items under that category. The arrow inside the icon indicates whether the category is in expanded or collapsed state. If the arrow points downward, the list is in an expanded state. If the icon points to the right, the category is in a collapsed state.

Double-clicking any item in the Class Contents list displays the Source card containing the source code for the item with the declaration highlighted.

Queries in the Class Contents List

Select a method or variable and press the right mouse button to get a menu of queries appropriate for the item you have selected:

Query results are displayed in the Class Contents list by highlighting items that match the query. The Class Contents list also displays indicator marks in the scroll bars corresponding to the positions of matching items. Click an indicator with the middle mouse button to scroll to the matching item. A filled outline icon also shows a match.

Queries on Variables Menu

The Queries on Variables menu allows you to perform one of the following queries when a variable is selected in the Class Contents list:

“What Modifies” 


Highlights all methods and classes in which the selected variable is assigned a value.

“What Reads” 

Highlights all methods and classes in which the selected variable is read.

“What Accesses” 


Highlights all classes where the selected variable is assigned a value, read, or has its address taken.

“What Defines” 


Highlights the class that defines the selected variable.

“Show Source Where Defined” 


Displays the source code where the variable is defined in the Source card.

“Show Documentation” 


For JavaTM system classes, displays a web page containing information on the selected variable.

Queries on Methods Menu

The Queries on Methods menu allows you to perform one of the following queries when a method is selected in the Class Contents list:

“What Uses” 

Highlights all methods and classes that use the currently selected method.

“What Is Used”  


Displays the “What Is Used Submenu.”

“Call Graph” 

Displays the “Call Graph Submenu.”

“What Declares” 


Highlights the class that declares the currently selected method.

“What Currently Defines” 


Highlights the class that provides the current definition for the method.

“What Else Defines” 


Highlights all classes that define the currently selected method.

“What Overloads” 


Highlights all methods and classes that overload the currently selected method.

“Show Source Where Declared” 


Displays the source file in the Source card where you can view or edit the source code.

“Show Source Where Defined” 


Displays the source file in the Source card where you can view or edit the source code.

“Show Documentation” 


For JavaTM system classes, displays a web page containing information on the selected method.

What Is Used Submenu

The What Is Used submenu provides the following options:

“All (method and data access)” 


Highlights all variables, methods, and classes that the currently selected method uses.

“Method Calls” 


Highlights all methods called by the currently selected method.

“Variable Access” 


Highlights all variables that have been assigned, read, or had their address taken by the currently selected method.

“Variable Modification” 


Highlights all variables assigned by the currently selected method.

“Variable Read” 


Highlights all variables read by the currently selected method.

Call Graph Submenu

The Call Graph submenu provides the following options:

“Add” 

Adds the currently selected method and its calling structure to the Call Graph window, if one is open. If not, “Add” opens a Call Graph window before adding the method.

“Replace” 

Replaces all methods in the display with the selected method and its calling structure in the Call Graph window.

“Remove” 

Removes the currently selected method and its calling structure from the Call Graph window.

Class Relations List

The Class Relations list displays the current Java class or Java interface type and its related classes or interfaces separated into the following categories:

  • Current class—displayed as “<- This”

  • Base classes—contains the current class and its ancestors, as described in the section “Base Classes Hierarchy”

  • Derived classes—contains descendants of the current class, as described in the section “Derived Classes Hierarchy”

  • Interfaces—contains JavaTM interface types implemented by the current class, or by parents of the current class

  • Uses—contains classes that the current class uses (that is, instantiates or interacts with using methods and/or variables)

  • Used by—contains classes that the current class is used by (that is, methods and/or variables in the current class are used by the classes shown in this category)

  • Implementation Classes—Contains all the classes that implement the interface. This category appears only when a Java interface type is displayed in the Class card.

Double-clicking any item listed in the Class Relations list makes it the new current class or interface type.

The outline icon to the left of items in the Class Relations list can be used to collapse (hide) or expand (make visible) the items under that category. The arrow inside the icon indicates whether the category is in the expanded or collapsed state. If the arrow points downward, the list is in its expanded state. If the icon points to the right, the category is in its collapsed state.

Base Classes Hierarchy

The Base Classes hierarchy shows the ancestors of the current class. Each indented class is an ancestor of the class listed above it. If a class has ancestors, click the outline icon to view or hide the ancestors.

This schematic gives an example of a Base Classes hierarchy:

BASE CLASSES
   <-This
              first_parent_of_This (access type)
                                parent_of_first_parent_class (access type)
               second_parent_of_This (access type)
                               parent_of_second_parent_class (access type)

Derived Classes Hierarchy

The Derived Classes hierarchy shows the descendants of the current class. Each indented class is a descendant of the class listed above it. If a class has descendants, click the outline icon to view or hide the descendants.

This schematic gives an example of a Derived Classes hierarchy:

DERIVED CLASSES
    first_child_of_This
       child_of_first_child_class 
    second_child_of_This
       child_of_second_child_class

Queries in the Class Relations List

Select a class or interface and press the right mouse button to get a menu of queries appropriate for the item you have selected. Many of the items in the menus are common to more than one menu. All the queries are listed in alphabetical order below, followed by the menus where they can be found.

Query results are displayed in the Class Relations list by highlighting items that match the query. The Class Relations list also displays indicator marks in the scroll bars corresponding to the positions of matching items. Click an indicator with the middle mouse button to scroll to the matching item. A filled outline icon also shows a match.

“Show Source” (all menus) 


Opens the Source card on a file containing the declaration of the selected item. The first line of the declaration is highlighted in the source.

“Show Documentation” (all menus) 


For JavaTM system classes, displays a web page containing information on the selected class.

“What Instantiates” (Uses and Used By) 


Highlights all methods and variables of the current class that instantiate the selected class.

“What Is Declared” (Base Classes) 


Highlights all methods declared by the selected base class.

“What Is Defined” (Base Classes) 


Highlights all methods and variables defined by the selected base class.

“What Is Overloaded” (Derived Classes) 


Highlights all methods and variables of the current class that are overloaded by the selected class.

“What Is Overridden” (Base Classes) 


Highlights all the methods of the selected base class that are overridden by the current class.

“What Is Overridden” (Derived Classes) 


Highlights all the methods of the current class that are overridden by the selected derived class.

“What Is Used” (Derived Classes and Used By Classes) 


Displays the “What Is Used Submenu.”

“What Uses” (Uses Classes) 


Displays the “What Uses Submenu.”

What Is Used Submenu

The What Is Used submenu provides the following options:

“by Calling Methods/Using Variables” 


Highlights all methods and variables (of the current class) that the selected class uses.

“by Calling Methods” 


Highlights all methods (of the current class) that the selected class uses.

“by Using Variables” 


Highlights all variables (of the current class) that the selected class modifies, reads, or takes the address of.

“by Modifying Variables” 


Highlights all variables (of the current class) to which the selected class assigns a value.

“by Reading Variables” 


Highlights all variables (of the current class) from which the selected class reads a value.

What Uses Submenu

The What Uses submenu provides the following options:

“by Accessing Any Field” 


Highlights all methods and variables (of the current class) that use the selected class.

“by Calling Methods” 


Highlights all methods (of the current class) that use the methods of the selected class.

“by Using Variables” 


Highlights all methods (of the current class) that modify, read, or take the address of variables of the selected class.

“by Modifying Variables” 


Highlights all methods (of the current class) that assign a value to variables of the selected class.

“by Reading Variables” 


Highlights all methods (of the current class) that read a value from variables of the selected class.

Class Graph Window

The Class Graph window displays relationships among classes based on the class displayed in the Class card. The window shows an inheritance graph by default, and includes both JavaTM classes and Java interface types. You can control the type of graph displayed (inheritance or interaction) using the menu at the bottom of the window, and you can view smaller portions of the graph by selecting a view from the Views menu. The buttons along the bottom of the graph allow you to zoom and control the appearance of the graph.

You can use the graph to change the class displayed in the Class card by double-clicking a new class in the graph.

The Class Graph window contains the following elements:

Admin Menu

The Admin menu provides the following options:

“Save Graph” 

Displays a“Save Graph Dialog” that allows you to select or type in a filename in which to save the displayed graph. The graph is saved as a PostScript® file.

“Close” 

Closes the Class Graph window.

Save Graph Dialog

The Save Graph dialog allows you to save a graph as a Postscript file.

File list 

A list of files in the current directory.

File Finder 

An editable text field with options to retrieve previous entries (using the Recycle button) or select directories in the same path for viewing (using the buttons along the top of the File Finder).

OK 

Saves the graph in the file you have specified.

Cancel 

Cancels the save operation.

Filter 

Displays a Filter dialog that allows you to filter the contents of the file list.

Views Menu

The Views menu provides options for selecting the amount of information to display in the graph:

“Show All” 

A toggle that allows you to display all classes in the loaded fileset. This is the default view when you open the Class Graph.

“Show All Related” 


A toggle that allows you to display only classes related to the class displayed in the Class card.

“Show Butterfly” 


A toggle that allows you to display only the classes immediately related to the class displayed in the Class card.

Graph Display Area

The Graph Display area displays an inheritance graph of the entire fileset when the Class Graph button is clicked in the Class card. You can change the type of graph using the menu below the Graph Display area. The different graphs are

Inheritance  

Displays the inheritance relationship between classes and the JavaTM interface types that each class implements. Both these relationships are displayed using a solid black line between nodes on the graph.

Interaction 

Describes the relationship of used classes to the classes that are their users. A class is considered “used” when its methods and/or variables are accessed. A class is considered a user of another class when it accesses the methods or variables of the other class. The graph displays only one link between classes even when the class uses or is used by more than one method or variable in another class.

You can view a smaller portion of the graph by selecting an option from the “Views Menu”. The “Show All Related” and “Show Butterfly” options display hierarchies based on the current class. In the graph display, the current class node is highlighted.

If you choose to view a smaller portion of the graph, right-facing arrows appear on class nodes to show you that some classes are not displayed in the current view. You can view the hidden classes by double-clicking the node.

You can also change your view of the graph by selecting nodes in the graph and using the right mouse button menu to control the display of nodes.

  • To select a single node, click the left mouse button with the cursor over the node.

  • To select multiple, unrelated nodes, click the left mouse button with the cursor over the first node, then hold down the <Ctrl> key and click over additional nodes.

  • To select a node and all its sub-nodes, hold down the <Shift> key and click the left mouse button with the cursor over the node.

The right mouse button menu contains the following options:

“Hide Node” 

Hides the selected node or nodes in the graph.

“Collapse Subgraph” 


Hides all the nodes below the selected node or nodes.

“Show Immediate Children” 


Displays all the classes or interface types that inherit directly from the selected node or nodes.

“Show Parents” 


Displays the class and interface type(s) that the selected node or nodes inherit from.

Graph Control Elements

The Graph Control Elements allows you to control your view of the graph displayed in the Graph display area.

Zoom Menu

The Zoom option menu allows you to select a percentage granularity at which to view the graph.

Zoom In Button

The Zoom In button provides a detailed look at an area of the graph.

Zoom Out Button

The Zoom Out button provides a wider coverage of the graph area.

Overview Button

The Overview button provides a window with an outline of the entire graph and allows you to select the part of the graph you want to see in detail.

Multiple Arcs Button

The Multiple Arcs button allows you to toggle between viewing all relationships between nodes and viewing only a single link between nodes. The button displays multiple arcs between nodes if there are multiple instances of the relationship between the displayed nodes.For example, if more than one method in class X calls a method or methods in class Z, multiple links between the nodes for class X and class z appear in the graph.

Realign Button

The Realign button returns nodes to their default position after moving them.

Rotate Button

The Rotate button toggles between vertical and horizontal tree orientation.

Graph Option Menu

The Graph option menu allows you to switch between graphs. The menu displays the currently selected graph type. The available options are

Inheritance  

Displays the inheritance relationship between classes and the JavaTM interface types that each class implements. Both these relationships are displayed using a solid black line between nodes on the graph.

Interaction 

Describes the relationship of used classes to the classes that are their users. A class is considered “used” when its methods and/or variables are accessed. A class is considered a user of another class when it accesses the methods or variables of the other class. The graph displays only one link between classes even when the class uses or is used by more than one method or variable in another class.

Call Graph Window

Click the Call Graph button in the Class card to display the Call Graph window with the calling relationship among classes in the fileset. You can also access the Call Graph window when you select a method in the Class Contents list, press the right mouse button and choose an item from the Call Graph menu.

Admin Menu

The Admin menu provides the following options:

“Show Arglist”  


A toggle that allows you to specify whether you want to display the argument list for a method in the Call Graph window.

“Clear” 

Clears the Call Graph display area.

“Save Graph” 

Displays a “Save Graph Dialog” that allows you to select or type in a filename in which to save the displayed graph. The graph is saved as a PostScript® file.

“Close” 

Closes the Call Graph window.

Save Graph Dialog

The Save Graph dialog allows you to save a graph as a Postscript file.

File List 

A list of files in the current directory.

File Finder 

An editable text field with options to retrieve previous entries (using the Recycle button) or select directories in the same path for viewing (using the buttons along the top of the File Finder).

OK 

Saves the graph in the file you have specified.

Cancel 

Cancels the save operation.

Filter 

Displays a Filter dialog that allows you to filter the contents of the file list.

Browsing Choices Window

The Browsing Choices window appears when you type “?” into the Current Subject field in the Class card. It displays all classes in the fileset and allows you to double-click a class to view it in the Class card. The list displays the class or interface type (JavaTM Class, Java Interface, Java Abstract class, and Java Final Class) and the class name.

Admin Menu

The Admin menu consists of the following options:

“Sort” 

Allows you to sort the items alphabetically by column (type of class or class name.)

“Close” 

Closes the Browsing Choices window.

View Menu

The View menu provides toggles for the type of information that can be viewed. The options are JavaTM Class, Java Interface, Java Abstract Class, and Java Final Class. All options are selected by default on this menu.

Keys and Shortcuts

Some Cosmo Code commands have keyboard shortcuts listed on the right side of the menu:

Table 2-1. Shortcuts for commands for the Cosmo Code environment.

Command

Keyboard Shortcut

“Click for Help”

<Shift>-Fl

“File Open”

<Ctrl>-o

“Search”

<Ctrl>-s