org.fife.rtext.plugins.project.model
Class Workspace

java.lang.Object
  extended by org.fife.rtext.plugins.project.model.Workspace
All Implemented Interfaces:
ModelEntity

public class Workspace
extends java.lang.Object
implements ModelEntity

A workspace is a collection of projects.

Version:
1.0
Author:
Robert Futrell

Constructor Summary
Workspace(ProjectPlugin plugin, java.io.File file)
           
 
Method Summary
 void accept(WorkspaceVisitor visitor)
          Called when a visitor visits this entity.
 void addProject(Project project)
          Adds a project to this workspace.
 boolean containsProjectNamed(java.lang.String name)
          Returns whether a project already exists with the specified name.
 java.lang.String getFileFullPath()
          Returns the absolute path to the file containing this workspace.
 java.lang.String getName()
           
 java.util.Iterator<Project> getProjectIterator()
           
static Workspace load(ProjectPlugin plugin, java.io.File file)
          Loads a workspace from an XML file.
 boolean moveProjectDown(Project project)
           
 boolean moveProjectUp(Project project)
           
 void removeProject(Project project)
           
 void save()
           
 boolean setName(java.lang.String name)
          Gives this workspace a new name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Workspace

public Workspace(ProjectPlugin plugin,
                 java.io.File file)
Method Detail

accept

public void accept(WorkspaceVisitor visitor)
Description copied from interface: ModelEntity
Called when a visitor visits this entity.

Specified by:
accept in interface ModelEntity
Parameters:
visitor - The visitor.

addProject

public void addProject(Project project)
Adds a project to this workspace.

Parameters:
project - The project to add.
See Also:
removeProject(Project)

containsProjectNamed

public boolean containsProjectNamed(java.lang.String name)
Returns whether a project already exists with the specified name.

Parameters:
name - The proposed project name.
Returns:
Whether a project with that name already exists.

getFileFullPath

public java.lang.String getFileFullPath()
Returns the absolute path to the file containing this workspace.

Returns:
This workspace's file.

getName

public java.lang.String getName()

getProjectIterator

public java.util.Iterator<Project> getProjectIterator()

load

public static Workspace load(ProjectPlugin plugin,
                             java.io.File file)
                      throws java.io.IOException
Loads a workspace from an XML file.

Parameters:
plugin - The project plugin.
file - The XML file.
Returns:
The workspace.
Throws:
java.io.IOException - If an IO error occurs.

moveProjectDown

public boolean moveProjectDown(Project project)

moveProjectUp

public boolean moveProjectUp(Project project)

removeProject

public void removeProject(Project project)

save

public void save()
          throws java.io.IOException
Throws:
java.io.IOException

setName

public boolean setName(java.lang.String name)
Gives this workspace a new name. Immediately creates a new XML file in the same directory containing the previous workspace file.

Parameters:
name - The new workspace name.
Returns:
Whether the operation was successful.