Imagix 4D User Guide


Step 2 - Dialog-Based Approach (Java)

The central step in importing your source code into Imagix 4D is having the tool analyze your source code. In the dialog, you'll specify

  • the location(s) of the java files
  • the names of the java files (using *.java style expansions)
  • the location(s) of the associated class files

2a. Specify that you're adding a new data source

Open the Data Sources dialog (Project > Data Sources). To specify that you wish to add a new data source into the project rather than modify the settings for an existing data source, choose `+ new data source' under the Data Sources selector on the left side of the dialog. As this is a new project, and there are no existing data sources to modify, this is indeed the only choice available.

2b. Select that you're loading Java code

For the rest of step 2, you'll be working on the right side of the Data Sources dialog. At the top, select [Source Files][Dialog Based (Java)] in the menubutton labeled `Select Data Source Type'.

2c. Specify which source files you want to analyze

In the Source Files tab, use the Directory field to enter the name of the directory where your source code is located.

Note: If your source code spans several directories, you may be able to take advantage of the `Analyze files in subdirectories' just below the Directory field. If the code you want to analyze is spread across a directory and its subdirectories (and their subdirectories), enter the name of the top-level directory in this Directory field. If there are certain subdirectories that you want to omit, specify them through the Exclude dialog. Depending on how your source code is spread across your directory structure, you may need to repeat step 2 for each directory containing code you want to analyze.

In the Source Files field, enter the names of the source files. Patterns with * characters are expanded, for example `*.java' expands to a list of all the .java files in the directory. You may enter multiple names and/or patterns, separating them with spaces. You don't need to specify the .class files. The analyzer will automatically analyze any .class file that is imported by one of the .java files you specify.

2d. Select which language configuration file to use

In the Java Lang combobox, select the language configuration file that you set up in step 1. If you haven't yet configured a language configuration file for the version of Java you use with your software, strongly consider doing so now. If you select `other', you'll need to specify the implicit -cp options in the Import Settings for .jar Files area of the Class Paths tab (step 2e).

2e. Specify the locations of the class and jar files you wish to import

As noted in step 2c, normally you don't explicitly direct Imagix 4D to analyze class files. Instead, you rely on the import statements in the source code, and simply specify which class paths to search for the included class files. This is specified in the Class Paths tab.

In the `Import Settings for .class Files' portion of the tab, you control how the class files are imported. The class paths defined here control which directories are searched for a .class file when an import directive appears in a .java files being analyzed. If you need to specify more that one class path, you can use the `Additional -cp flags' field. You may enter as many -cp's as you wish. Put a space between the -cp and the directory name. Put a space between the directory name and the next -cp. If you're running under Windows, and the directory name contains a space, enclose the dirname with double quotation marks, such as `-cp "c:/program files/ include"'.

In the `Import Settings for .jar Files' portion of the tab, you can control the import of .jar files. This is used for .jar files not being picked up through the language configuration file (see step 1). Any .jar files matching the settings in the Directory and Jar Files fields will be imported.

2f. Start the analysis process

At this point you're ready to invoke the analyzer. However, analyzing your code often turns up errors in your settings, particularly how you have specified you class paths. You may find it preferable to load just a subset of your code first. If so, go to the Files field on the Source Files tab, and specify just one particular file to analyze in the first pass.

When you're ready to analyze your code, click Add Data Source at the bottom of the dialog.