Using the GNAT Programming System: Tools

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 13. Tools

> 13.1 The Tools Menu |  |
> 13.2 Visual Comparison |  |
> 13.3 Code Fixing |  |

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 13.1 The Tools Menu

The `Tools` menu gives access to additional tools. Some items are currently disabled, meaning that these are planned tools not yet available.

The list of active items includes:

Shell Console

  Open a shell console at the bottom are of GPS. See section 2.7 The Shell Window.

Call Graph
  See section 10.2 Call Graph.

Dependency Browser
  See section 10.3 Dependency Browser.

Entity Browser
  See section 10.4 Entity Browser.

Compare
  See section 13.2 Visual Comparison.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 13.2 Visual Comparison

Note that this tool is in a preliminary stage. More capabilities will be added in the future such as comparison of multiple files, interactive merge, ....

The visual comparison, available either from the VCS menus or from the Tools menu, provide a way to display graphically differences between two files, or two different versions of the same file.

This tool is based on the standard text command `diff`, available on all Unix systems. Under Windows, you need to provide a proper equivalent, by e.g. installing a set of Unix tools such as cygwin (http://www.cygwin.com).

The dialog is composed of two main areas: on the left side, the reference file is displayed; on the right side, the modified file.

By default, only chunks of differences are displayed, with a number of lines of context around, that can be parametrized in the preferences dialog.

Vertical and horizontal scroll bars are available for each file that allow you to scroll both files at the same time. In addition, empty lines are added when needed so that the two files can always be displayed side by side and stay synchronized.

Colors are used to display the different kinds of chunks:

gray
  This color is used for all the chunks on the reference (left) file. Only the modified (right) file is displayed with different colors.

blue
  This color is used to display lines that have been modified compared to the reference file.

green
  Used to display lines added compared to the reference file; in other words, lines that are not present in the reference file.

red
  Used to display lines removed from the reference file; in other words, lines that are present only in the reference file.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 13.3 Code Fixing

GPS provides an interactive way to fix or improve your source code, based on messages (errors and warnings) generated by the GNAT compiler.

This capability is integrated with the Locations tree (see 2.8 The Locations Tree): when GPS can take advantage of a compiler message, an icon is added on the left side of the line.

For a simple fix, a wrench icon is displayed. If you click with the left button on this icon, the code will be fixed automatically, and you will see the change in the corresponding source editor. An example of a simple fix, is the addition of a missing semicolon.

You can also check what action will be performed by clicking on the right button which will display a contextual menu with a text explaining the action that will be performed. Similarly, if you display the contextual menu anywhere else on the message line, a sub menu called Code Fixing gives you access to the same information. In the previous example of a missing semicolon, the menu will contain an entry labeled Add expected string ";".

Once the code change has been performed, the tool icon is no longer displayed.

For more complex fixes, where more than one change is possible, the icon will display in additional of the tool, a red question mark. In this case, clicking on the icon will display the contextual menu directly, giving you access to the possible choices. For example, this will be the case when an ambiguity is reported by the compiler for resolving an entity.

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Mail Server on June, 15 2003 using texi2html