net.sf.ant4eclipse.model.project
Class Workspace

java.lang.Object
  extended by net.sf.ant4eclipse.model.project.Workspace

public final class Workspace
extends java.lang.Object

Encapsulates the workspace that contains the (Eclipse-)Projects.


Method Summary
 void addExternalLocation(java.lang.String projectname, java.io.File location)
          Adds the external location for the supplied project.
static void clearCache()
          This method allows to clear the internal cache.
 boolean equals(java.lang.Object o)
          
 java.lang.String getAbsolutePath()
          Returns the absolute path of the workspace.
 java.io.File getChild(java.lang.String path)
          Returns the child of the workspace with the given path.
 java.io.File getChild(java.lang.String path, boolean relative)
          Returns the child of the workspace with the given path.
 java.io.File getExternalLocation(java.lang.String projectname)
          Returns the external location of the supplied project.
 java.io.File getFolder()
          Returns the workspace as a file.
 EclipseProject getProject(java.lang.String name)
          Returns the EclipseProject associated with the supplied name.
static Workspace getWorkspace(java.io.File workspace)
          Provides access to an instance of type Workspace.
 boolean hasChild(java.lang.String path)
          Returns whether the workspace has a child with the given path.
 int hashCode()
          
 void registerProject(EclipseProject project)
          Registers the supplied project with this workspace.
 java.lang.String toString()
          
 void unregisterProject(EclipseProject project)
          Unregisters the supplied project.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

addExternalLocation

public void addExternalLocation(java.lang.String projectname,
                                java.io.File location)
Adds the external location for the supplied project.

Parameters:
projectname - The name of the project which is located externally.
location - The location of the external project.

getExternalLocation

public java.io.File getExternalLocation(java.lang.String projectname)
Returns the external location of the supplied project.

Parameters:
projectname - The name of the external project.
Returns:
The external location of the project. null if it doesn't exist.

registerProject

public void registerProject(EclipseProject project)
Registers the supplied project with this workspace.

Parameters:
project - The project that shall be registered.

unregisterProject

public void unregisterProject(EclipseProject project)
Unregisters the supplied project.

Parameters:
project - The project that shall be unregistered.

getProject

public EclipseProject getProject(java.lang.String name)
Returns the EclipseProject associated with the supplied name.

Parameters:
name - The name of the desired project.
Returns:
The project associated with the supplied name.

getAbsolutePath

public java.lang.String getAbsolutePath()
Returns the absolute path of the workspace.

Returns:
Returns the absolute path of the workspace.

hasChild

public boolean hasChild(java.lang.String path)
Returns whether the workspace has a child with the given path.

Parameters:
path - the path (relative to the workspace)
Returns:
Returns whether the workspace has a child with the given path.

getChild

public java.io.File getChild(java.lang.String path)
Returns the child of the workspace with the given path. The returned file is absolute. The supplied path is not allowed to be a linked resource.

Parameters:
path - the path (relative to the workspace)
Returns:
the file with the given path

getChild

public java.io.File getChild(java.lang.String path,
                             boolean relative)
Returns the child of the workspace with the given path. The relative-flag indicates whether or not the returned File should be relative to the workspace: if true, the returned file is relative to the workspace (e.g. "project\.classpath"). If false, the returned file is absolute (e.g. "c:\myworkspace\project\.classpath"). The supplied path is not allowed to be a linked resource.

Parameters:
path - the path (relative to the workspace)
relative - indicates whether or not the returned File should be relative to the workspace
Returns:
the file with the given path

getFolder

public java.io.File getFolder()
Returns the workspace as a file.

Returns:
Returns the workspace as a file

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

getWorkspace

public static final Workspace getWorkspace(java.io.File workspace)
Provides access to an instance of type Workspace. If the specified file is a file instead of a directory an Exception will be thrown.

Parameters:
workspace - the file that represents the workspace.

clearCache

public static final void clearCache()
This method allows to clear the internal cache.