# com.bea.ide.workspace
IProject Interface

public interface IProject
extends `ICookieSupport`, `IDriverSupport`, `IPreferencesSupport`, `IPropertySupport`

Represents a source project in a Workshop application.

An IProject is member of an IWorkspace. The project's IProjectInfo contains the project's type information. Project types are defined in extension xml using the element, and specify project attributes and drivers for handling operations such build and run. An instance of each project driver associated with the project type will be added to an IProject on construction. Additional IProjectDriver implementations may be added to an IProject by services running in Workshop.

Each IProject has a root directory. Some project types may require that the project's root directory is directly inside the IWorkspace root directory. Other project types support root directories located outside the application directory. Some project types may support additional source root directories.

The system Preferences node is used to persist project-level settings the IWorkspace's .work file. User or machine-specific project-level settings are persisted with the user Preferences node.

All Superinterfaces
  `ICookieSupport`, `IDriverSupport`, `IPreferencesSupport`, `IPropertySupport`

## Field Summary

`public static final `String`` | `EVENT_ClassPathModified` Notification that a binary on the classpath has changed.
`public static final `String`` | `KEY_DISABLE_COMPILER_REBUILD` Cookie key to allow internal code to override default rebuild behavior.
`public static final `String`` | `PROP_ClassPath` String array of classpath members.
`public static final `String`` | `PROP_Closed` String
`public static final `String`` | `PROP_compilerReloading` String
`public static final `String`` | `PROP_packageCacheAvailable` Will be set to false during package cache reload.
`public static final `String`` | `PROP_sourceLoaded` String
`public static final `String`` | `PROP_SourcePath` String array of project source directories.
`public static final `String`` | `PROP_ValidRuntime` String
`public static final `String`` | `RUNNABLE_AS_WEB_APP` String
`public static final `String`` | `SUPPORTS_WEB_APP` String

## Method Summary

`public boolean` | `getBooleanProperty`(`String` propName) Returns the named property as a boolean value.
`public `IFile`` | `getCacheRoot`() Returns a cache location unique to the project under the application directory.
`public `ClassLoader`` | `getClassLoader`() Gets a classloader using the project's current classpath.
`public `ClassLoader`` | `getClassLoader`(`IFile`[] jarFiles, boolean includeProject, boolean includeIde) Gets a classloader that searches through a set of specified jarfiles, the user's project classpath, and/or the IDE application classpath.
`public `String`` | `getClassPath`() Returns search path of directories and zip/jar files.
`public `String`[]` | `getClassPathArray`() Returns search path of directories and zip/jar files.
`public `IFile`` | `getDirectory`() Returns the root directory of this project
`public `File`` | `getFile`()
`public `IFile`` | `getIFile`()
`public `String`` | `getName`() Returns the name of this Project
`public `String`` | `getPath`()
`public `IProjectInfo`` | `getProjectInfo`() Get this project's type information.
`public `String`` | `getRelativePath`(`URI` uri) Returns a relative path from this project to the given URI.
`public `String`` | `getSourcePath`() Returns source root directories for this project.
`public `String`[]` | `getSourcePathArray`() Returns source root directories for this project.
`public `String`` | `getType`()
`public `IWorkspace`` | `getWorkspace`() Gets the workspace this project is a member of.
`public boolean` | `hasValidRuntime`() Can we attempt to compile this project?
`public `String`` | `invalidFolderCheck`(`URI` uriParent, `String` sName) Checks the given name to see if it is a valid folder for this project.
`public boolean` | `isClosed`()
`public boolean` | `isInProject`(`URI` uri) Returns true if the uri passed in is under this project root.
`public boolean` | `isSourceLoaded`() Returns whether Workshop has completed source loading.
`public `Preferences`` | `systemNodeForPackage`(`String` key) Get the preference subtree in the project system preferences that corresponds to the given package name.
`public void` | `updateClassPath`() Recalculates the project classpath.
`public `Preferences`` | `userNodeForPackage`(`String` key) Get the preference subtree in the user project preferences that corresponds to the given package name.

Methods from interface `com.bea.ide.core.`ICookieSupport``
``addCookie`, `getCookie`, `removeCookie``

Methods from interface `com.bea.ide.core.`IDriverSupport``
``getDriver``

Methods from interface `com.bea.ide.core.`IPreferencesSupport``
``getUserObject`, `setUserObject`, `systemNodeForPackage`, `systemRoot`, `userNodeForPackage`, `userRoot``

Methods from interface `com.bea.ide.core.`IPropertySupport``
``addPropertyChangeListener`, `addPropertyChangeListener`, `getProperty`, `removePropertyChangeListener`, `removePropertyChangeListener`, `setProperty``

## Field Detail

### EVENT_ClassPathModified

    public static final String EVENT_ClassPathModified

  Notification that a binary on the classpath has changed.

### KEY_DISABLE_COMPILER_REBUILD

    public static final String KEY_DISABLE_COMPILER_REBUILD

  Cookie key to allow internal code to override default rebuild behavior. This value should not be used by external consumers.

### PROP_ClassPath

    public static final String PROP_ClassPath

  String array of classpath members. This property should never be set directly. Calling IProject.updateClassPath() will cause the classpath to be recalculated using the project's IBuildDriver.

### PROP_Closed

    public static final String PROP_Closed

### PROP_compilerReloading

    public static final String PROP_compilerReloading

### PROP_packageCacheAvailable

    public static final String PROP_packageCacheAvailable

  Will be set to false during package cache reload. Set to true when reload is complete.

### PROP_sourceLoaded

    public static final String PROP_sourceLoaded

### PROP_SourcePath

    public static final String PROP_SourcePath

  String array of project source directories. This property is set and maintained by the project's IBuildDriver.

### PROP_ValidRuntime

    public static final String PROP_ValidRuntime

### RUNNABLE_AS_WEB_APP

    public static final String RUNNABLE_AS_WEB_APP

### SUPPORTS_WEB_APP

    public static final String SUPPORTS_WEB_APP

## Method Detail

### getBooleanProperty(String) Method

    public boolean getBooleanProperty(String propName)

Returns the named property as a boolean value. False will be returned if the property is not set.

#### Parameters

propName
  String property name

#### Returns

boolean property value.

### getCacheRoot() Method

    public IFile getCacheRoot()

Returns a cache location unique to the project under the application directory. This directory will not be deleted when the application is closed. This directroy will be deleted if the project is removed from the application.

#### Returns

IFile cache root directory.

### getClassLoader() Method

    public ClassLoader getClassLoader()

Gets a classloader using the project's current classpath. Unlike a URLClassLoader, the returned classloader will not keep files open and prevent a referenced jarfile from being overwritten by the user.

#### Returns

ClassLoader

### getClassLoader(IFile[], boolean, boolean) Method

    public ClassLoader getClassLoader(IFile[] jarFiles,
                                      boolean includeProject,
                                      boolean includeIde)

Gets a classloader that searches through a set of specified jarfiles, the user's project classpath, and/or the IDE application classpath. Unlike a URLClassLoader, the returned classloader will not keep files open and prevent a referenced jarfile from being overwritten by the user.

#### Parameters

jarFiles
  An array of jars and/or directories that will be searched, in the order given. May be null, which is equivalent to an empty array.

includeProject
  True if the classpath for the project should be searched.

includeIde
  True if the IDE core and extension classpath should be searched.

#### Returns

ClassLoader

### getClassPath() Method

    public String getClassPath()

Returns search path of directories and zip/jar files. Paths in this string will be delimited with an os-specific path separator character.

#### Returns

String search path for project classes and resources.

### getClassPathArray() Method

    public String[] getClassPathArray()

Returns search path of directories and zip/jar files.

#### Returns

String array of project search paths.

### getDirectory() Method

    public IFile getDirectory()

Returns the root directory of this project

### getFile() Method

DEPRECATED use getDirectory

    public File getFile()

### getIFile() Method

DEPRECATED use getDirectory

    public IFile getIFile()

### getName() Method

    public String getName()

Returns the name of this Project

### getPath() Method

DEPRECATED use getDirectory

    public String getPath()

### getProjectInfo() Method

    public IProjectInfo getProjectInfo()

Get this project's type information.

#### Returns

IProjectInfo, will never be null.

### getRelativePath(URI) Method

    public String getRelativePath(URI uri)

Returns a relative path from this project to the given URI.

### getSourcePath() Method

    public String getSourcePath()

Returns source root directories for this project. Paths in this string will be delimited with an os-specific path separator character.

#### Returns

String source paths

### getSourcePathArray() Method

    public String[] getSourcePathArray()

Returns source root directories for this project.

#### Returns

String array of source paths.

### getType() Method

DEPRECATED use getProjectInfo().getTypeId()

    public String getType()

### getWorkspace() Method

    public IWorkspace getWorkspace()

Gets the workspace this project is a member of.

#### Returns

IWorkspace that contains this project.

### hasValidRuntime() Method

    public boolean hasValidRuntime()

Can we attempt to compile this project? Use PROP_ValidRuntime to listen to changes

### invalidFolderCheck(URI, String) Method

    public String invalidFolderCheck(URI uriParent,
                                     String sName)

Checks the given name to see if it is a valid folder for this project. The URI will be checked to see if the folder is under a project source directory. If it is, then the name must be a valid java identifier and not be a compiler restricted name.

#### Parameters

uriParent
  A uri in the current project where the folder would be created.

sName
  The folder name that should be examined for validity. This should not contain any path information (i.e. separators).

#### Returns

String value indicating the error message that should be shown to the user. The return value null means either that the folder name is valid, or that the given parent URI is not in this project.

### isClosed() Method

DEPRECATED Listen for Application.PROP_OpenProjects to fire, and search for your project in the list. Not there == closed.

    public boolean isClosed()

### isInProject(URI) Method

    public boolean isInProject(URI uri)

Returns true if the uri passed in is under this project root.

### isSourceLoaded() Method

    public boolean isSourceLoaded()

Returns whether Workshop has completed source loading.

#### Returns

boolean, true if source loading is complete, false if loading is in progress.

### systemNodeForPackage(String) Method

    public Preferences systemNodeForPackage(String key)

Get the preference subtree in the project system preferences that corresponds to the given package name.

#### Parameters

key
  String package name.

#### Returns

Preference node associated with the given package name. If no such node exists, an empty one is created and returned.

### updateClassPath() Method

    public void updateClassPath()

Recalculates the project classpath. Classpath change events will be fired if the classpath has changed.

### userNodeForPackage(String) Method

    public Preferences userNodeForPackage(String key)

Get the preference subtree in the user project preferences that corresponds to the given package name.

#### Parameters

key
  String package name.

#### Returns

Preference node associated with the given package name. If no such node exists, an empty one is created and returned.