Contents

Previous

Next



Source-Navigator Tutorial

Source-Navigator scans your source code and loads the extracted information into a project database. This database stores all information about file names, symbol elements, and symbol relationships (functions and global variables are examples of symbols). Source-Navigator provides you with different browsers (graphical views) into the project database.

Creating a New Project

To create a new project, follow these steps:

  1. Create a directory in which to store your project files.

  2. Launch Source-Navigator.
    In UNIX, at the command prompt, type snavigator
    In Windows, open the directory where Source-Navigator is located and double-click the snavigator.exe icon.

  3. Source-Navigator launches and the Projects window appears.

  4. Click the New Project button.
    The Auto-Create Project dialog appears.

  5. Click the "..." button next to the Project File text box. The Open dialog appears. Navigate to the project directory.
    Enter the name of the project.

    Click the Save button. The Open dialog closes.
  6. If the Add Directory text box does not point to the project directory, use the "..." button to navigate to it. Click OK when done.

  7. The Scanning Project progress bar appears:

  8. Once your project is created, the Symbol Browser appears:

    The Symbol Browser is empty because there are not any files in the project.
  9. From the Windows menu, select Add View -> Editor to create a new file.

  10. The Editor window appears.

  11. Enter your code and save the file. Saving the file using either Save or Save as updates the Symbol Browser. Fast Save does not update the Symbol Browser window.

  12. Click the Symbol Browser window to see the newly created symbol for the selected directory.

Opening a New Project

In this tutorial, existing source code is used to create the c++_demo project.

  1. In the Symbol Browser, from the File menu, select New Project.
    The Auto-Create Project dialog appears.

  2. Click the "..." button next to the Project File field. The Open dialog appears. Navigate to the c++_demo directory. The path is .../share/demos.

  3. Enter c++_demo.proj to create the C++ demo project.

  4. Click the Save button. The Open dialog closes.
    If the Add Directory text box does not point to the c++_demo directory, use the "..." button to navigate to it. The path is .../share/demos.

  5. Click OK to generate the c++_demo project.

Using the Symbol Browser

After you create the demo project, the Symbol Browser window opens. The Symbol Browser provides a view of the symbols within the project.

  1. Click on the icon to the left of the file or symbol name to expand the list view to a tree view of the file or symbol.

  2. Double-click on the file or symbol name Agent.h to open the Editor to the location of the selected file or symbol in the source code.

For more information on the Symbol Browser, see Symbol Browser.

Using the Editor

Items in the project database are hyperlinked to the Editor. When you double-click on a symbol anywhere within Source-Navigator, the Editor opens to the location of that selected symbol in your source code.

When you save modified source files, the project database is updated and changes are reflected in all of the Source-Navigator tools.

For more information on the Editor, see Editor.

Using the Symbol Accelerator

The Symbol Accelerator combo-box in the toolbar allows you to quickly navigate through the code. When the Editor is open, the Symbol Accelerator lists all of the symbols either within the open file or within the entire project.

When other browsers are open, the Symbol Accelerator lists the components relative to that browser. For instance, in the Class Browser, it lists only classes in the file or in the project.

Notice that the Symbol Accelerator text field in the toolbar displays the symbol that is referenced as the cursor moves through the file.

Using the Cross-Reference Browser

The Cross-Reference Browser (also called Xref) helps you to understand complex source code by showing the Refers-to and Referred-by relationships between symbols in the project. You can traverse the tree, and expand or collapse the elements within the tree.

Cross-Reference Browser relationships

 

Refers-to
shown by blue arrows

 

Referred-by
shown by red arrows

  1. From the Symbol Browser, open the Agent.h file.

  2. Highlight the class Notifiee.

  3. To activate the Cross-Reference Browser, select the Xref tab in the Editor window.

  4. Add an Editor view to the Cross-Reference Browser window. From the Windows menu, select Add View -> Editor.

  5. Click on the function Notification(mi) Notification.

  6. Click the Refers-to button. The Cross-Reference Browser view lists the functions that reference Notification(mi) Notification.

  7. Click on Ref(fu) and notice that the Refers-to and Referred-by buttons in the toolbar become active. Click the Referred-by button.

    Source-Navigator shows the source syntax of Ref(fu) in the Editor pane, and shows the functions that reference Ref(fu).

For more information on the Cross-Reference Browser, see Cross-Reference Browser.

Using the Class Browser

The Source-Navigator Class Browser provides a view of classes and their attributes. Using the Class Browser, you can analyze the members of a selected class based on inheritance tree, scope, member attribute, member type, and more.

Imagine a situation where you are investigating the class structures and attributes of classes within your project, but want to simultaneously view the declaration or implementation of the classes in the source code.

  1. Ensure that Agent.h is open. If it is not, select it from the Symbol Browser.

  2. To activate the Class Browser, select the Class tab in the Editor window.

  3. Add an Editor to the Class Browser. From the Windows menu, select Add View -> Editor.

  4. In the Symbol Accelerator, all class components for the entire project are listed. From this list of components, select AwaitStmt.

  5. In the Class Browser, click AwaitStmt(md) in the list view.

    Notice that the Editor view on the bottom takes you to the Declaration of the AwaitStmt.
  6. From the Search menu, select Find Implementation.

    Notice that the Editor view updates to show the Implementation.

Note

Declaration is set by default. You can set Source-Navigator to open to the Implementation instead. For more information, see Class/Hierarchy Preferences.

For more information on the Class Browser, see Class Browser.

Using the Hierarchy Browser

The Hierarchy Browser (also known as the Class Hierarchy Browser) helps you understand the inheritance relationship for a particular class.

  1. To activate the Hierarchy Browser, select the Hierarchy tab in the Editor window.

  2. Add an Editor to the Hierarchy Browser. From the Windows menu, select Add View -> Editor.

  3. From the Symbol Accelerator, select the class BinaryExpr.

    Source-Navigator draws an inheritance tree from GlishObject, the base class, to LogExpr, a derived class.

    By clicking on any of the classes in the tree, Source-Navigator shows the class definition in the source code in the Editor.

For more information on the Hierarchy Browser, see Hierarchy Browser.

Using the Include Browser

Some programming languages allow files to include source code from other files. The Include Browser allows you to see these Includes and Included by relationships.

  1. Click the Edit tab.

  2. Add an Include Browser to the Editor. From the Windows menu, select Add View -> Include.

    The Include Browser allows you to maintain awareness of where you are in the project based on pathnames and included files.

    This complex view will maintain your visibility while you move between files.
  3. Go to the History -> Edit menu.

  4. Select another view from the Editor, such as the previous Notifiee view.

  5. Notice that the Editor opens a view to that source file and the integrated Include Browser shows information relative to the "including" or "included" files.

For more information on the Include Browser, see Include Browser.

Closing the Demo Project

To close a project, from the File menu, choose Close Project.

This tutorial introduced you to some of Source-Navigator's browsers for more information on these and other useful tools, see any chapters in Part II of this User's Guide.

With the user interface concepts conveyed in this tutorial, you are now ready to begin exploring your own software projects.


Contents

Previous

Next