IDL offers a variety of ways to organize your code. This topic covers some of the methods we have seen that work well and consistently. You could choose to organize your code in other ways, though, so select a method that makes sense and is easy to use.
In the IDL Workbench, projects are simply a way of organizing your files. Logical groupings of related files make it easier to keep them organized, or compile code and build larger programs.
We recommend creating directories on your computer or network to hold related IDL source code for tasks like a programming project or a scientific paper. You can then link these directories to the IDL Workbench with a project. Think of a project as being equivalent to these directories - logical groupings of related files.
The advantages of using individual projects rather than storing all of your files under one project are:
There are a few guidelines to keep in mind when using projects in the Workbench:
When you write programs, create projects that point to directories outside of the workspace provided by IDL. The default location of this workspace is:
C:\Users\<username>\IDLWorkspace8xUsers/<username>/IDLWorkspace8x/home/<username>/IDLWorkspace8xIn this demonstration, we will walk you through creating a project to hold .PRO files for a paper we will publish on Tritium Contamination.
First, use the local computer's native file browser to set up a folder or directory to house the related .PRO files for our paper. In the screenshot below, we have created a folder called "TritiumContaminationPaper" in the "My Documents" area of our local computer (a Windows machine). Note that we have previously created three .PRO files for our paper and have moved them into this directory (see below):
Next, create the project from the IDL workbench and connect it to the folder we just created on the local computer. Click the "New Project" icon in the Workbench's toolbar.
The New Project dialog will appear. Type the name of the new project, "TritiumContaminationPaper", in the "Name" field:
Next, click the radio button for "Create the new project from an existing directory," then click the Browse button. A second dialog will appear allowing you to connect the new project to an existing folder or directory:
Navigate to the folder you want to use to store your files, in this case it is the folder we created in the first step, above, called "TritiumContaminationPaper." Select the folder and click "OK." (Optionally, from this dialog you can create a new folder or directory to use for your project files if you have not already done this.)
Once you click "OK," the Workbench displays the new project in the Project Explorer. Expand the contents of the project by double-clicking its name to see the .PRO files already stored there:
Compare the Workbench view of the project with the file browser's view of the folder:
Note that both windows display the .PRO files we created previously. Additionally, the file browser displays a file created by the IDL Workbench called ".project". This file contains IDL-specific information about the project.
IDL gives you many ways to manage your path. The use of projects is one way that we have found works well and gives you a real-time, visual indication of your current path in the IDL Workbench.
By default, if a project's folder is "open" in your IDL Workbench's Project Explorer, then its underlying directory on your computer is automatically included in your IDL path. Conversely, if a project's folder is "closed," then its directory is not included in your IDL path. Note that you can override this behavior when creating a project.
Creating and Using Projects, The Project Explorer, Projects and Path Management