org.schmant.project.eclipse
Class EclipseWorkspaceSettings

java.lang.Object
  extended by org.schmant.support.AbstractArgumentChecker
      extended by org.schmant.project.eclipse.EclipseWorkspaceSettings

public class EclipseWorkspaceSettings
extends AbstractArgumentChecker

This object contains settings that are used when creating an EclipseWorkspace object.

Much workspace metadata can be parsed from its metadata files. This object may contain extra information that the project parser cannot figure out by itself. If values in this object conflict with parsed values, this object's values takes precedence.

Since:
0.7.1
Author:
Karl Gustafsson

Constructor Summary
EclipseWorkspaceSettings()
           
 
Method Summary
 EclipseWorkspaceSettings addClasspathVariable(String name, Object value)
          Add one classpath workspace variable.
 EclipseWorkspaceSettings addClasspathVariables(Map<String,?> variables)
          Add all classpath variables in the supplied Map.
 EclipseWorkspaceSettings addLibraries(Map<String,? extends Library> m)
          Add all supplied user libraries.
 EclipseWorkspaceSettings addLibrary(String name, Library lib)
          Add one user-defined library.
 EclipseWorkspaceSettings addProjectDirectories(Object o)
          Add one or several project directories.
 EclipseWorkspaceSettings addProjectDirectory(Object o)
          Add one project directory.
 Map<String,Object> getClasspathVariables()
          Get all classpath variables that have been added to this object.
 Map<String,Library> getLibraries()
          Get all user-defined libraries.
 List<Object> getProjectDirectories()
          Get all user-defined project directories.
 boolean isDontAutodetectProjectDirectories()
          Is project directory autodetection disabled?
 EclipseWorkspaceSettings setDontAutodetectProjectDirectories(boolean b)
          If this is enabled, the EclipseWorkspaceInfoCollector will not try to autodetect project directories in the workspace directory.
 
Methods inherited from class org.schmant.support.AbstractArgumentChecker
check, check, check, check
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EclipseWorkspaceSettings

public EclipseWorkspaceSettings()
Method Detail

addClasspathVariable

public EclipseWorkspaceSettings addClasspathVariable(String name,
                                                     Object value)
Add one classpath workspace variable.

Classpath variables are normally parsed from the workspace metadata, so there should not be any need to add them manually if they are to have the same values as they have in the workspace.

Parameters:
name - The name of the classpath variable.
value - The classpath variable value.
Returns:
this
See Also:
addClasspathVariables(Map)

addClasspathVariables

public EclipseWorkspaceSettings addClasspathVariables(Map<String,?> variables)
Add all classpath variables in the supplied Map.

Classpath variables are normally parsed from the workspace metadata, so there should not be any need to add them manually if they are to have the same values as they have in the workspace.

Parameters:
variables - A mapping between classpath variable names and their values.
Returns:
this
See Also:
addClasspathVariable(String, Object)

getClasspathVariables

public Map<String,Object> getClasspathVariables()
Get all classpath variables that have been added to this object.

Returns:
All defined classpath variables.

addLibrary

public EclipseWorkspaceSettings addLibrary(String name,
                                           Library lib)
Add one user-defined library. If the supplied library is null, the library will be ignored.

Parameters:
name - The name of the library, as it occurs in an Eclipse project's .classpath file. This name includes a prefix such as org.eclipse.jdt.USER_LIBRARY. The name for the user-defined library MyLib will be org.eclipse.jdt.USER_LIBRARY/MyLib
lib - The library. This may be set to null to tell the workspace object to ignore the library.
Returns:
this
See Also:
addLibraries(Map)

addLibraries

public EclipseWorkspaceSettings addLibraries(Map<String,? extends Library> m)
Add all supplied user libraries. The Map may contain null values. Libraries with null values are ignored by the workspace object.

Parameters:
m - A mapping between library names and the libraries. The values may be null. Libraries with null values are ignored by the workspace object.
Returns:
this
See Also:
addLibrary(String, Library)

getLibraries

public Map<String,Library> getLibraries()
Get all user-defined libraries.

Returns:
All user-defined libraries.

addProjectDirectory

public EclipseWorkspaceSettings addProjectDirectory(Object o)
Add one project directory. This can be used to specify a project directory that is not in the workspace directory. (Project directories in the workspace directory are detected automatically by the EclipseWorkspaceInfoCollector.)

Parameters:
o - The project directory.
Returns:
this
Since:
1.0.1
See Also:
addProjectDirectories(Object), setDontAutodetectProjectDirectories(boolean)

addProjectDirectories

public EclipseWorkspaceSettings addProjectDirectories(Object o)
Add one or several project directories. This can be used to specify project directories that are not in the workspace directory. (Project directories in the workspace directory are detected automatically by the EclipseWorkspaceInfoCollector.)

Parameters:
o - The project directories. This may be a collection or an array. The list is flattened using FlatteningList.
Returns:
this
Since:
1.0.1
See Also:
addProjectDirectory(Object), setDontAutodetectProjectDirectories(boolean)

getProjectDirectories

public List<Object> getProjectDirectories()
Get all user-defined project directories.

Returns:
All user-defined project directories.
Since:
1.0.1

setDontAutodetectProjectDirectories

public EclipseWorkspaceSettings setDontAutodetectProjectDirectories(boolean b)
If this is enabled, the EclipseWorkspaceInfoCollector will not try to autodetect project directories in the workspace directory. Then all project directories have to be added manually to this object.

Parameters:
b - Should project directory autodetection be disabled?
Returns:
this
Since:
1.0.1
See Also:
addProjectDirectories(Object), addProjectDirectory(Object)

isDontAutodetectProjectDirectories

public boolean isDontAutodetectProjectDirectories()
Is project directory autodetection disabled?

Returns:
true if project directory autodetection is disabled.
Since:
1.0.1