Importing Existing GNAT Projects

Importing existing GNAT projects (i.e., those defined by a GNAT project file), is accomplished using a wizard provided by GNATbench. The wizard handles all the configuration details required to make the existing GNAT project into an Eclipse GNATbench project.

To invoke the wizard you may use either the "File" menu and select "Import...", or use the contextual menu in the Navigator and again select "Import..." The first approach is illustrated below.

file import menu

A new wizard page will appear (shown below), allowing you to choose which import wizard to apply. Workbench defines a number of import wizards so you may need to expand the "Ada" category. Select "Existing GNAT Project" and press Next.

import wizard selection page

The next wizard page appears (see the following figure) and requests the location of the GNAT project file defining the project to be imported. You may either enter the path manually or browse to it via the "Browse" button to the right of the text entry pane.

import gnat project selection page

On that same page you also choose whether to import the GNAT project into an existing Workbench project or into a new Workbench project. Typically you will create a new project rather than import it into an existing project.

That page also offers the choice of whether to copy the files and folders of the GNAT project into the Workbench project or only create links to the existing files and folders. Creating links does not make a copy of the files, but rather, creates transparent references to all the project resources in the file system outside of the Eclipse workspace. Changes to the files, compilation, and deletion within Eclipse will directly affect the files and folders in the external file system when the linking option is taken.

Press Finish after making all these choices. The new project will be created for you.

Note that you may have to modify the GNAT project file created by the wizard. For example, you might need to re-specify the location of the executable (a directory) if the original GNAT project file specified it with an absolute path. Similarly, the GNAT project file might specify multiple main programs or other properties that should be changed.

You might also need to use the Eclipse-defined import wizards to import additional folders and files. Use the "File System" option under the "General" wizard category to invoke these wizards:

file system import wizard