Adding a file to the IDE
The Forte for Java Open File feature provides the ability to open existing (meaning not created in the IDE) source files in the IDE straight from a file chooser without the need to first mount directories under the Filesystems tab in the Explorer or navigate to them in the Explorer.
To open a file in the IDE:
- Choose Open File from the first toolbar or the File menu in the Main Window. A file chooser will appear asking you which file you wish to open.
- Browse to the directory on disk where your file is (for example,
MyFirstClass.java
), select it, and choose Open.If the file is already accessible in the Explorer, then the file will open (usually in the Editor window) immediately.
- If the file is not already accessible in the Explorer, you must decide which package to put the file in. If you are trying to open a Java source file, a dialog box will appear suggesting the package to use and enable you to press Accept or Select.
- If you press Accept, the file will be opened and the proper directory will be mounted.
- If you press Select, a dialog box will appear with a list of possible packages. Select one and press Mount. The package you select will determine which directory will be mounted in the Explorer. The file will then be opened and the proper directory will be mounted.
If you are opening a Java source file, the IDE tries to determine the correct directory to mount by looking through the source file and trying to find a package declaration. For example, if you are opening
C:\mysources\com\mycom\MyClass.java
, and this file begins with the declarationpackage com.mycom;
, thenC:\mysources
will be selected as the default. If there is no package declaration, the directory directly containing the source file will be the default to mount.You can override the default, but be sure that you choose the right mount point. If you do not choose the correct mount point, you will not be able to work with the file (your package declaration will be invalid, you will not be able to compile or execute the source, debugging will not work, and so on). When opening other types of files (such as GIF images, HTML, or resource property files) that do not have package declarations, you must be sure to mount the correct directory - look at the bottom of the dialog box to see what "package" will be used for the file. The choice will affect any Java sources that are in the same mounted directory. If you are using classloader-based resource loading (that is, based on an abstract resource name such as
/com/mycom/myImage.gif
), such as when creating a JAR file for distribution, then the resource names and JAR manifest entry names will be relative to the mounted directory as well.Files that cannot be opened for editing will typically just be displayed in their own Explorer window. You can also select ZIP or JAR archives with Open File. When you do, they are immediately mounted in the Explorer and an Explorer window is opened on their contents to make it easy to browse archives.
Contents | Prev | Next | Index |