Systems Engineering Software

Working with projects, directories, and files

Eclipse uses projects to manage files and directories (also called folders). The following topics are discussed on this page:

Creating a new project

To create a new project, you need the Project Explorer or Package Explorer view.

Select File menu ‣ New ‣ Project... to open the New Project window. Alternatively, right click somewhere in the Project Explorer or Package Explorer, and select New ‣ Project..., to open the same window.

In the New Project window, from the General category, select Project, and click the Next > button.

In the next window, enter a project name, for example models.

By default, a project is created inside your workspace. If you want it at a different place (so you can remove the workspace without losing your projects), uncheck the Use default location option, and enter a Location. Make sure the location does not yet exist, for example by ending with the project name. It is recommended to always create a project in a directory that has the same name as the project.

Click the Finish button to create the project. Observe how it appears in the Project Explorer or Package Explorer.

Importing an existing project

If you previously created a project, but it is no longer visible in your Project Explorer or Package Explorer view, you can import it. Imported projects are linked to your workspace, but remain in their original location on your hard disk (by default, they are not moved or copied to your workspace).

Importing existing projects is particularly useful if you removed you workspace and started with a fresh one.

To import one or more existing projects, select File menu ‣ Import... to open the Import window. Alternatively, right click somewhere in the Project Explorer or Package Explorer, and select Import..., to open the same window.

In the Import window, from the General category, select Existing Projects into Workspace, and click Next >.

In the next window, in Select root directory, point it to the directory that contains the project you wish to import. The available projects in the given root directory, and all its sub-directories (recursively), are listed in the Projects list. Select the project(s) you want to import, by checking the relevant check boxes, and click Finish. Observe how the project(s) appear(s) in the Project Explorer or Package Explorer.

Removing a project from Eclipse

To remove a project from Eclipse, you need the Project Explorer or Package Explorer view.

Right click the project in the Project Explorer or Package Explorer and choose Delete. Alternatively, select it and press the Delete key on your keyboard. The Delete Resources dialog appears. To only remove the project from Eclipse, and keep the files on your hard disk, disable the Delete project contents on disk (cannot be undone) option and click the OK button. Alternatively, to remove the project from Eclipse and also remove all the files in the project from your hard disk, enable the Delete project contents on disk (cannot be undone) option and click the OK button.

Wait for Eclipse to complete the removal operation.

Creating a new directory

You can structure large collections of files, by putting them into different directories (also called folders). Directories can only be created in projects, or in other directories.

Select the project or directory in which you want to create a new directory (by left clicking its name in the Project Explorer or Package Explorer), and create a new directory by selecting File menu ‣ New ‣ Folder. Alternatively, right click on the project or directory instead, and from the popup menu select New ‣ Folder.

In the New Folder window, enter the Folder name, and click Finish.

Creating a new file

Select the project or directory in which you want to create a new file (by left clicking its name in the Project Explorer or Package Explorer), and create a new file by selecting File menu ‣ New ‣ File. Alternatively, right click on the project or directory instead, and from the popup menu select New ‣ File.

In the New File window, enter the File name, and click Finish. Make sure to give the file the correct file extension. That is, Chi 3 files should end with .chi, while CIF 3 files should end with .cif.

An editor for the new file opens, and you can start editing it.

Renaming a file, directory, or project

To rename a file, directory, or project, select it by left clicking its name in the Project Explorer or Package Explorer, and then select File menu ‣ Rename.... Alternatively, right click on the file, directory, or project instead, and from the popup menu select Refactor ‣ Rename.... A second alternative is to select the file, directory, or project, and then press the F2 key.

In the Rename Resource window, enter the New name, and click OK.

Locating files, directories, and projects

Often, it is convenient to be able to manage files not from inside Eclipse, but from outside Eclipse, for instance in a file explorer provided by your operating system. The Properties view can be used to find out where the files, directories, and projects that are in Eclipse, are located on your hard disk. With the Properties view visible, select a file, directory, or project in the Project Explorer or Package Explorer. In the Property column of the Properties view, look for location. The corresponding Value indicates where the file, directory, or project is located on your hard disk. Note that you can right click the location and choose Copy to copy the location to the clipboard.

As an alternative to the Properties view, you can also use the Properties window. Right click a file, directory, or project in the Project Explorer or Package Explorer and choose Properties. In the window that shows, select Resource on the left, if it is not already selected. Then, on the right, look for the Location.

To directly open the directory that contains a file, directory, or project in your system’s file explorer, right click the file, directory, or project in the Package Explorer and choose Show In ‣ System Explorer. This functionality is not available in the Project Explorer.

Don’t forget to refresh your projects in Eclipse after manipulating them outside Eclipse.

Refreshing a file, directory, or project

Whenever changes are made to files or directories from outside Eclipse, and those files or directories are also in one of the projects inside Eclipse, the changes are not automatically reflected in the Project Explorer or Package Explorer. To ensure that the current state of the files and directories are properly reflected in Eclipse, a refresh is required. To refresh a file, directory, or project, right click it, and choose Refresh. Any files and directories that no longer exist will disappear from Eclipse. Any new files and directories created outside Eclipse will appear in Eclipse as well.

Checking the size of a file

When working with files, you may occasionally encounter large files. Opening large files in Eclipse can cause serious performance problems. You can use the Properties view to check the size of a file. With the Properties view visible, select a file in the Project Explorer or Package Explorer. In the Property column of the Properties view, look for size. The corresponding Value indicates the size of the file.

As an alternative to the Properties view, you can also use the Properties window. Right click a file in the Project Explorer or Package Explorer and choose Properties. In the window that shows, select Resource on the left, if it is not already selected. Then, on the right, look for the Size.