edu.rice.cs.drjava.model
Class AbstractGlobalModel.ProjectFileGroupingState

java.lang.Object
  extended by edu.rice.cs.drjava.model.AbstractGlobalModel.ProjectFileGroupingState
All Implemented Interfaces:
FileGroupingState
Enclosing class:
AbstractGlobalModel

 class AbstractGlobalModel.ProjectFileGroupingState
extends java.lang.Object
implements FileGroupingState


Field Summary
(package private)  boolean _autoRefreshStatus
           
(package private)  java.util.ArrayList<java.io.File> _auxFiles
           
(package private)  java.io.File _buildDir
           
(package private)  java.io.File _createJarFile
           
(package private)  int _createJarFlags
           
private  AsyncTask<java.util.List<java.io.File>,java.util.List<java.io.File>> _deleteFilesTask
           
private  java.util.ArrayList<java.io.File> _exclFiles
           
private  AsyncTask<java.io.File,java.util.List<java.io.File>> _findFilesToCleanTask
           
private  boolean _isProjectChanged
           
(package private)  java.lang.String _mainClass
           
(package private)  java.lang.String _manifest
           
(package private)  java.io.File _projectFile
           
(package private)  java.io.File[] _projectFiles
           
(package private)  java.lang.Iterable<AbsRelFile> _projExtraClassPath
           
(package private)  java.util.HashSet<java.lang.String> _projFilePaths
           
(package private)  java.io.File _projRoot
           
(package private)  java.util.Map<OptionParser<?>,java.lang.String> _storedPreferences
           
(package private)  java.io.File _workDir
           
 
Constructor Summary
AbstractGlobalModel.ProjectFileGroupingState(java.io.File project)
          Degenerate constructor for a new project; only the file project name is known.
AbstractGlobalModel.ProjectFileGroupingState(java.io.File pr, java.lang.String main, java.io.File bd, java.io.File wd, java.io.File project, java.io.File[] srcFiles, java.io.File[] auxFiles, java.io.File[] excludedFiles, java.lang.Iterable<AbsRelFile> cp, java.io.File cjf, int cjflags, boolean refreshStatus, java.lang.String customManifest, java.util.Map<OptionParser<?>,java.lang.String> storedPreferences)
           
 
Method Summary
 void addAuxFile(java.io.File f)
          Adds File f to end of _auxFiles vector.
 void addExcludedFile(java.io.File f)
          Excludes file from the project.
 void cleanBuildDirectory()
          Cleans the build directory.
 boolean getAutoRefreshStatus()
           
 java.io.File getBuildDirectory()
          Returns the directory in which to put the class files after compilation
 java.util.List<java.io.File> getClassFiles()
           
private  void getClassFilesHelper(java.io.File f, java.util.LinkedList<java.io.File> acc)
           
 java.io.File getCreateJarFile()
          Return the create jar file for the project.
 int getCreateJarFlags()
          Return the create jar flags for the project.
 java.lang.String getCustomManifest()
          Gets the custom manifest on the project
 java.io.File[] getExclFiles()
          Return an array of the files excluded from the current project
 java.lang.Iterable<AbsRelFile> getExtraClassPath()
          Returns a collection of classpath entries specific to the current project.
 java.lang.String getMainClass()
          Returns the name of the class that has the main method of the project
 java.util.Map<OptionParser<?>,java.lang.String> getPreferencesStoredInProject()
           
 java.io.File getProjectFile()
          Returns the current project file
 java.io.File[] getProjectFiles()
          Return all files saved as source files in the project file.
 java.io.File getProjectRoot()
          Returns the project source root
 java.io.File getWorkingDirectory()
          Returns the working directory for the slave (interactions pane) JVM.
 boolean inProject(java.io.File f)
          Returns true the given file is in the current project file.
 boolean inProjectPath(java.io.File f)
          Determines whether the specified file in within the project file tree.
 boolean inProjectPath(OpenDefinitionsDocument doc)
          Determines whether the specified doc in within the project file tree.
 boolean isAuxiliaryFile(java.io.File f)
           
 boolean isExcludedFile(java.io.File f)
          Returns true if the file is excluded from the current project
 boolean isProjectActive()
           
 boolean isProjectChanged()
          Returns true if in project mode and the current project file has changed.
 void remAuxFile(java.io.File file)
          Removes File file from _auxFiles list.
 void removeExcludedFile(java.io.File f)
          Remove the specified file from the files excluded from the current project
 void setAutoRefreshStatus(boolean status)
           
 void setBuildDirectory(java.io.File f)
          Sets the current build directory.
 void setCreateJarFile(java.io.File f)
          Sets the create jar file of the project.
 void setCreateJarFlags(int f)
          Sets the create jar flags of the project.
 void setCustomManifest(java.lang.String manifest)
          Sets the custom manifest on the project
 void setExcludedFiles(java.io.File[] fs)
          Sets the array of files excluded from the current project
 void setExtraClassPath(java.lang.Iterable<AbsRelFile> cp)
          Sets the list of project-specific classpath entries.
 void setMainClass(java.lang.String f)
          Sets the name of the class that has the main method of the project (Note: should point to the sourcefile of the document, not the class file)
 void setPreferencesStoredInProject(java.util.Map<OptionParser<?>,java.lang.String> sp)
           
 void setProjectChanged(boolean changed)
          Sets that the project state is no longer a snapshot of the open project.
 void setProjectFile(java.io.File f)
          Sets project file to specifed value; used in "Save Project As ..." command in MainFrame.
 void setProjectRoot(java.io.File f)
          Sets the current project root.
 void setWorkingDirectory(java.io.File f)
          Sets the current working directory for the interactions pane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_projRoot

volatile java.io.File _projRoot

_mainClass

volatile java.lang.String _mainClass

_buildDir

volatile java.io.File _buildDir

_workDir

volatile java.io.File _workDir

_projectFile

volatile java.io.File _projectFile

_projectFiles

final java.io.File[] _projectFiles

_auxFiles

volatile java.util.ArrayList<java.io.File> _auxFiles

_exclFiles

private volatile java.util.ArrayList<java.io.File> _exclFiles

_projExtraClassPath

volatile java.lang.Iterable<AbsRelFile> _projExtraClassPath

_isProjectChanged

private boolean _isProjectChanged

_createJarFile

volatile java.io.File _createJarFile

_createJarFlags

volatile int _createJarFlags

_autoRefreshStatus

volatile boolean _autoRefreshStatus

_storedPreferences

final java.util.Map<OptionParser<?>,java.lang.String> _storedPreferences

_manifest

volatile java.lang.String _manifest

_projFilePaths

java.util.HashSet<java.lang.String> _projFilePaths

_findFilesToCleanTask

private AsyncTask<java.io.File,java.util.List<java.io.File>> _findFilesToCleanTask

_deleteFilesTask

private AsyncTask<java.util.List<java.io.File>,java.util.List<java.io.File>> _deleteFilesTask
Constructor Detail

AbstractGlobalModel.ProjectFileGroupingState

AbstractGlobalModel.ProjectFileGroupingState(java.io.File project)
Degenerate constructor for a new project; only the file project name is known.


AbstractGlobalModel.ProjectFileGroupingState

AbstractGlobalModel.ProjectFileGroupingState(java.io.File pr,
                                             java.lang.String main,
                                             java.io.File bd,
                                             java.io.File wd,
                                             java.io.File project,
                                             java.io.File[] srcFiles,
                                             java.io.File[] auxFiles,
                                             java.io.File[] excludedFiles,
                                             java.lang.Iterable<AbsRelFile> cp,
                                             java.io.File cjf,
                                             int cjflags,
                                             boolean refreshStatus,
                                             java.lang.String customManifest,
                                             java.util.Map<OptionParser<?>,java.lang.String> storedPreferences)
Method Detail

isProjectActive

public boolean isProjectActive()
Specified by:
isProjectActive in interface FileGroupingState
Returns:
true if the model is in project mode, false otherwi

inProjectPath

public boolean inProjectPath(OpenDefinitionsDocument doc)
Determines whether the specified doc in within the project file tree. No synchronization is required because only immutable data is accessed.

Specified by:
inProjectPath in interface FileGroupingState
Returns:
true if the document is part of the active project (in the project path), or false if it is not (or the model is not in project mode)

inProjectPath

public boolean inProjectPath(java.io.File f)
Determines whether the specified file in within the project file tree. No synchronization is required because only immutable data is accessed.

Specified by:
inProjectPath in interface FileGroupingState
Returns:
true if the file is part of the active project (in the project path), or false if it is not (or the model is not in project mode)

getProjectFile

public java.io.File getProjectFile()
Description copied from interface: FileGroupingState
Returns the current project file

Specified by:
getProjectFile in interface FileGroupingState
Returns:
the absolute path to the project file. Since projectFile is final, no synchronization is necessary.

inProject

public boolean inProject(java.io.File f)
Description copied from interface: FileGroupingState
Returns true the given file is in the current project file.

Specified by:
inProject in interface FileGroupingState

getProjectFiles

public java.io.File[] getProjectFiles()
Description copied from interface: FileGroupingState
Return all files saved as source files in the project file. If not in project mode, returns null.

Specified by:
getProjectFiles in interface FileGroupingState

getProjectRoot

public java.io.File getProjectRoot()
Description copied from interface: FileGroupingState
Returns the project source root

Specified by:
getProjectRoot in interface FileGroupingState
Returns:
null if no build directory is specified

getBuildDirectory

public java.io.File getBuildDirectory()
Description copied from interface: FileGroupingState
Returns the directory in which to put the class files after compilation

Specified by:
getBuildDirectory in interface FileGroupingState
Returns:
null if no build directory is specified

getWorkingDirectory

public java.io.File getWorkingDirectory()
Description copied from interface: FileGroupingState
Returns the working directory for the slave (interactions pane) JVM.

Specified by:
getWorkingDirectory in interface FileGroupingState

setProjectFile

public void setProjectFile(java.io.File f)
Sets project file to specifed value; used in "Save Project As ..." command in MainFrame.

Specified by:
setProjectFile in interface FileGroupingState

setProjectRoot

public void setProjectRoot(java.io.File f)
Description copied from interface: FileGroupingState
Sets the current project root.

Specified by:
setProjectRoot in interface FileGroupingState

addAuxFile

public void addAuxFile(java.io.File f)
Adds File f to end of _auxFiles vector.

Specified by:
addAuxFile in interface FileGroupingState

remAuxFile

public void remAuxFile(java.io.File file)
Removes File file from _auxFiles list.

Specified by:
remAuxFile in interface FileGroupingState

addExcludedFile

public void addExcludedFile(java.io.File f)
Description copied from interface: FileGroupingState
Excludes file from the project.

Specified by:
addExcludedFile in interface FileGroupingState

removeExcludedFile

public void removeExcludedFile(java.io.File f)
Description copied from interface: FileGroupingState
Remove the specified file from the files excluded from the current project

Specified by:
removeExcludedFile in interface FileGroupingState

getExclFiles

public java.io.File[] getExclFiles()
Description copied from interface: FileGroupingState
Return an array of the files excluded from the current project

Specified by:
getExclFiles in interface FileGroupingState

setExcludedFiles

public void setExcludedFiles(java.io.File[] fs)
Description copied from interface: FileGroupingState
Sets the array of files excluded from the current project

Specified by:
setExcludedFiles in interface FileGroupingState

setBuildDirectory

public void setBuildDirectory(java.io.File f)
Description copied from interface: FileGroupingState
Sets the current build directory.

Specified by:
setBuildDirectory in interface FileGroupingState

setWorkingDirectory

public void setWorkingDirectory(java.io.File f)
Description copied from interface: FileGroupingState
Sets the current working directory for the interactions pane.

Specified by:
setWorkingDirectory in interface FileGroupingState

getMainClass

public java.lang.String getMainClass()
Description copied from interface: FileGroupingState
Returns the name of the class that has the main method of the project

Specified by:
getMainClass in interface FileGroupingState
Returns:
null if no build directory is specified

setMainClass

public void setMainClass(java.lang.String f)
Description copied from interface: FileGroupingState
Sets the name of the class that has the main method of the project (Note: should point to the sourcefile of the document, not the class file)

Specified by:
setMainClass in interface FileGroupingState

setCreateJarFile

public void setCreateJarFile(java.io.File f)
Description copied from interface: FileGroupingState
Sets the create jar file of the project.

Specified by:
setCreateJarFile in interface FileGroupingState

getCreateJarFile

public java.io.File getCreateJarFile()
Description copied from interface: FileGroupingState
Return the create jar file for the project. If not in project mode, returns 0.

Specified by:
getCreateJarFile in interface FileGroupingState

setCreateJarFlags

public void setCreateJarFlags(int f)
Description copied from interface: FileGroupingState
Sets the create jar flags of the project.

Specified by:
setCreateJarFlags in interface FileGroupingState

getCreateJarFlags

public int getCreateJarFlags()
Description copied from interface: FileGroupingState
Return the create jar flags for the project. If not in project mode, returns null.

Specified by:
getCreateJarFlags in interface FileGroupingState

isProjectChanged

public boolean isProjectChanged()
Description copied from interface: FileGroupingState
Returns true if in project mode and the current project file has changed.

Specified by:
isProjectChanged in interface FileGroupingState

setProjectChanged

public void setProjectChanged(boolean changed)
Description copied from interface: FileGroupingState
Sets that the project state is no longer a snapshot of the open project.

Specified by:
setProjectChanged in interface FileGroupingState

isAuxiliaryFile

public boolean isAuxiliaryFile(java.io.File f)
Specified by:
isAuxiliaryFile in interface FileGroupingState
Returns:
true if the file is a project auxiliary file

isExcludedFile

public boolean isExcludedFile(java.io.File f)
Description copied from interface: FileGroupingState
Returns true if the file is excluded from the current project

Specified by:
isExcludedFile in interface FileGroupingState

getAutoRefreshStatus

public boolean getAutoRefreshStatus()
Specified by:
getAutoRefreshStatus in interface FileGroupingState

setAutoRefreshStatus

public void setAutoRefreshStatus(boolean status)
Specified by:
setAutoRefreshStatus in interface FileGroupingState

getPreferencesStoredInProject

public java.util.Map<OptionParser<?>,java.lang.String> getPreferencesStoredInProject()
Specified by:
getPreferencesStoredInProject in interface FileGroupingState
Returns:
the stored preferences.

setPreferencesStoredInProject

public void setPreferencesStoredInProject(java.util.Map<OptionParser<?>,java.lang.String> sp)
Specified by:
setPreferencesStoredInProject in interface FileGroupingState

cleanBuildDirectory

public void cleanBuildDirectory()
Description copied from interface: FileGroupingState
Cleans the build directory.

Specified by:
cleanBuildDirectory in interface FileGroupingState

getClassFiles

public java.util.List<java.io.File> getClassFiles()
Specified by:
getClassFiles in interface FileGroupingState
Returns:
a list of class files.

getClassFilesHelper

private void getClassFilesHelper(java.io.File f,
                                 java.util.LinkedList<java.io.File> acc)

getExtraClassPath

public java.lang.Iterable<AbsRelFile> getExtraClassPath()
Description copied from interface: FileGroupingState
Returns a collection of classpath entries specific to the current project.

Specified by:
getExtraClassPath in interface FileGroupingState
Returns:
the project's extra classpath

setExtraClassPath

public void setExtraClassPath(java.lang.Iterable<AbsRelFile> cp)
Description copied from interface: FileGroupingState
Sets the list of project-specific classpath entries.

Specified by:
setExtraClassPath in interface FileGroupingState

getCustomManifest

public java.lang.String getCustomManifest()
Description copied from interface: FileGroupingState
Gets the custom manifest on the project

Specified by:
getCustomManifest in interface FileGroupingState

setCustomManifest

public void setCustomManifest(java.lang.String manifest)
Description copied from interface: FileGroupingState
Sets the custom manifest on the project

Specified by:
setCustomManifest in interface FileGroupingState