Using Sun WorkShop

Graphing Classes

Using the Class Grapher, you can graphically inspect the inheritance structure of classes in C++ programs.

Class Graph Window

The Class Graph window provides a graphic representation of class hierarchies. Figure 3-6 shows the Class Graph window.

To change the colors used for node background, graph pane background, node border, node text, and arrows between nodes in the Class Graph window, edit the WORKSHOP resource file (see "Call Graph and Class Graph Window Colors"). Any color changes you make apply to both the Class Graphi and Call Graph windows (see "Call Graph Window").

Figure 3-6 Class Graph Window

Graphic

Graph menu 

Provides commands for modifying the graph of the class hierarchies. 

Nodes menu 

Provides commands for modifying the nodes displayed. 

Class text box 

Allows you to enter the class you want to graph. Click the arrow at the end of the Class text box to access the list of classes previously graphed. 

Add button 

Adds a node with the given class to the Class Graph pane. 

Find button 

Moves the ClassGraph pane to show the node for the given class. 

Class Graph pane 

Displays a graphical presentation of class hierarchies. 

Expand Left button 

Shows all parent classes of the selected class (one level of parents). 

Expand Right button 

Shows all child classes of the selected class (one level of children). 

Expand Both button 

Shows all parent and child classes of the selected class (one level of parents and children).  

Collapse Left button 

Hides all parent classes of the selected class (one level of parents). 

Collapse Right button 

Hides all child classes of the selected class (one level of children). 

Collapse Both button 

Hides all parent and child classes of the selected class (one level of parents and children). 

Show Source button 

Displays the source file containing the selected class in an editor window. Sun WorkShop starts an editor if one is not presently open. 

Message footer 

Reports the number of nodes displayed, the number of nodes added, and the number of nodes not displayed, as well as error messages. 

Graphing a Class Hierarchy

To graph a class hierarchy:

  1. Choose Browse > Graph Classes, or select a class in the source code or Debugging window and choose Browse > Graph Classes.

  2. Type a class name in the Class text box and click Add Current Class or press Return.

To display information about a class:


Note -

You can change the display of the Class Graph window using the commands on the Graph menu (see "Changing the Look of a Call or Class Graph"). You can also print the class graph, as described in "Printing a Graph".