[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Adding Files

This section describes how to add files to your IDE project. You can learn more about the following topics:

After adding a file to a project, the IDE adds the path used to locate that file to the project's Access Paths. The Message window appears after the IDE adds a new access path to the project.


NOTE

If you create a project using the Empty Project option, see "Linker" and "File Mappings". These sections describe how to configure the IDE so that you can add files to your project.

Normally, the IDE forces each file in a project to have a unique name. To remove this restriction, enable the Save project entries using relative paths checkbox in the Target Settings panel.

See "Access Paths" for more information about defining additional paths in your project.

For more information about the Message window, see "Guided Tour of the Message Window."


Placement of added files and groups

The IDE always places added files and groups after the currently selected item in the Project window. If the Project window does not contain a selection, the added items appear at the bottom of the window. To place a new file or group in a particular location, always select the file or group above the desired location before using the Add Files or Add Window command.

Regardless of the expanded or collapsed state of a selected group, the IDE places the added files at the end of that group. To learn about how to select a file or group of files, see "Selecting Files and Groups."

You can move a file or group to a new location within the project. For more information, see "Moving Files and Groups".


Using the Add Files command

Choose Project > Add Files to open the Add Files dialog box, which helps you add files to your project. Use the menu command to add source-code files, libraries, resource files, and other files.

In order for files to appear in the dialog box, their extensions must match a mapping defined in the File Mappings preference panel. To examine and configure file mappings, see "File Mappings".


Add Files dialog box (Windows)

Figure 3.13 shows the Add Files dialog box. The Files of Type pop-up menu is initially set to view All Files.

Use the dialog box to navigate through folders and drives to find files that you wish to add.

To add a single file to your project, select the file and click Add. Alternatively, double-click the file.

To select multiple files, as shown in Figure 3.13, press the Control key while clicking the file names in the dialog box.

Adding Files to a Project (Windows):

To select a contiguous group of files, click on the first file name in the group, then press the Shift key and click on the last file in the group.

After you select the files that you wish to add, click Add. If your project contains multiple build targets, the IDE prompts you (Figure 3.16) to select the build targets to which you want the files added. There might be a delay while the IDE locates the selected files and adds them to your project.

Click Cancel to close the dialog box without adding any files to the project.


Add Files dialog box (Mac OS)

Figure 3.14 shows the Add Files dialog box.

Adding Files to a Project (Mac OS):

Use the pop-up menu at the top of the file list to navigate through folders and drives to find files that you wish to add. You can also use the Shortcuts, Favorites, or Recent buttons to assist your search.

To add a single file to your project, select the file and click Add. Alternatively, double-click the file.

To select multiple files, click the disclosure triangles in the list to reveal the files that you wish to add. Shift-click each file name to include it in your selection. If you change your mind about adding a particular file, Shift-click that file's name to de-select it.

After you select the files that you wish to add, click Add. If your project contains multiple build targets, the IDE prompts you (Figure 3.16) to select the build targets to which you want the files added. There might be a delay while the IDE locates the selected files and adds them to your project.

Click Cancel to close the dialog box without adding any files to the project.


Add Files dialog box (Solaris and Linux)

Figure 3.15 shows the Add Files dialog box. The file path field at the top of the dialog box displays the path to the current directory listing.

Use the dialog box to navigate through folders and drives to find files to that you wish to add. The Select files to add list shows the files to be added to your project.

To add a file to your project, select the file in the directory listing and click Add to move that file to the Select files to add list. Alternatively, double-click the file to move it to the list. Repeat this procedure for each file that you wish to add to your project.

Click Add All to add all the files displayed in the file list to the Select files to add list (all available files in the directory).

To remove a file from the Select files to add list, select the file that you wish to remove and click Remove.

Click Remove All to clear the Select files to add list.

Adding Files to a Project (Solaris and Linux):

After you select all the files that you wish to add, click Done. The IDE adds to your project the files in the Select files to add list. If your project contains multiple build targets, the IDE prompts you (Figure 3.16) to select the build targets to which you want the files added. There might be a delay while the IDE locates the selected files and adds them to your project.

Click Cancel to close the dialog box without adding any files to the project.


Using drag and drop

You can drag and drop files or folders into an open Project window to add them to the project.

To add files to your project using this technique, first select the files or folders that you wish to add. You can select files in various places, including the desktop or the multi-file search list in the IDE's Find window.

To complete the add operation, drag your selection into the Project window. If your project contains multiple build targets, the IDE prompts you (Figure 3.16) to select the build targets to which you want the files added.

After you drag the selected files into the Project window, the IDE verifies that it can add the files to the project. After you drag a folder into the Project window, the IDE verifies that the folder, or one of its subfolders, contains at least one source-code file, library, or resource file, and that file is not already in the project.

The IDE rejects the drag-and-drop operation if the selection does not contain at least one recognized file.


NOTE

See "Linker" and "File Mappings" for more information on configuring the IDE to recognize files.

Use the focus bar (an underline) that appears in the Project window to place the files in a specific position within the existing group hierarchy.

Releasing the mouse button (dropping the files) adds the dragged items to the project, inserting them below the position indicated by the focus bar. If your project contains multiple build targets, the IDE prompts you (Figure 3.16) to select the build targets to which you want the files added.

The IDE does not allow you to drag an entire volume (such as your hard disk) into the Project window.

The IDE allows you to drag and drop items outside of the Project window. You can also drag files to another application to open them in that application.

Although the IDE supports dragging and dropping files into the Project window on all platforms, some platforms do not allow you to remove files by dragging them out of the Project window. To learn how to remove files from the Project window, see "Removing Files and Groups".

Adding Files to Specific Build Targets:

Using the Add Window menu command

The Add Window menu command adds to the active project the file associated with the active editor window. You typically use this command when you create a new file and decide to add that file to the active project.

The IDE enables the Add Window menu command only after you meet the following criteria:

After meeting the criteria, you can use the Add Window menu command by following these steps:

1. Ensure that a project is currently open.

The IDE adds the file to the active project.

2. Open the file that you wish to add to the project.

An editor window appears and shows the contents of the file.

3. Choose Project > Add Window.

The name of the menu command changes, based on the file name shown in the title bar of the active editor window. For example, if the name of the active window is MyFile, the name of the menu command changes from Add Window to Add MyFile to Project.

If the file that you wish to add is currently untitled, the Save As dialog box appears. Use the dialog box to name and save the file. The IDE adds the saved file to the active project.

If your project contains multiple build targets, the IDE prompts you (Figure 3.16) to select the build targets to which you want the file added.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000