public abstract class AbstractProjectBasedTask
extends Task
Abstract base class for all project based tasks.
Constructor and Description |
---|
AbstractProjectBasedTask()
Creates a new instance of type AbstractProjectBasedTask.
|
Modifier and Type | Method and Description |
---|---|
void |
ensureJavaProject()
Ensures that the set project is a java project.
|
EclipseProject |
getEclipseProject()
Returns the EclipseProject instance associated with this task.
|
Workspace |
getWorkspace()
Returns the currently associated workspace .
|
static boolean |
hasText(java.lang.String str)
Check if a String has text.
|
boolean |
isProjectNameSet()
Returns true if the project name has been set.
|
boolean |
isProjectSet()
Returns true if the project has been set.
|
boolean |
isWorkspaceSet()
Returns whether a workspace has been set to this task.
|
void |
requireWorkspaceAndProjectNameOrProjectSet()
Requires that either the workspace and a project name or a project directory has been set.
|
void |
requireWorkspaceSet()
Requires that the workspace has been set.
|
void |
setInitialiseWorkspace(boolean enable)
Enables/disables the initial workspace initialisation.
|
void |
setProject(java.io.File projectDirectory)
Sets the project.
|
void |
setProjectName(java.lang.String projectName)
Sets the name of the project.
|
void |
setWorkspace(java.io.File workspace)
Sets the workspace for this task
|
public AbstractProjectBasedTask()
Creates a new instance of type AbstractProjectBasedTask.
public void ensureJavaProject()
Ensures that the set project is a java project. That means that the project must have the java project role. If the projet is not a java project, a BuildException will be thrown.
public EclipseProject getEclipseProject()
Returns the EclipseProject instance associated with this task.
ProjectBase.getEclipseProject()
public final void setProjectName(java.lang.String projectName)
Sets the name of the project.
projectName
- the name of the project.ProjectBase.getEclipseProject()
public final boolean isProjectNameSet()
Returns true if the project name has been set.
true
if the project name has been set.ProjectBase.getEclipseProject()
public final void setProject(java.io.File projectDirectory)
Sets the project.
projectDirectory
- the projectProjectBase.getEclipseProject()
public final boolean isProjectSet()
Returns true if the project has been set.
true
if the project has been set.ProjectBase.getEclipseProject()
public final Workspace getWorkspace()
Returns the currently associated workspace .
ProjectBase.getEclipseProject()
public final boolean isWorkspaceSet()
Returns whether a workspace has been set to this task.
ProjectBase.getEclipseProject()
public final void requireWorkspaceAndProjectNameOrProjectSet()
Requires that either the workspace and a project name or a project directory has been set.
ProjectBase.getEclipseProject()
public final void requireWorkspaceSet()
Requires that the workspace has been set.
public final void setWorkspace(java.io.File workspace)
workspace
- Path to workspace that should be associated with this TaskProjectBase.getEclipseProject()
public void setInitialiseWorkspace(boolean enable)
Enables/disables the initial workspace initialisation.
enable
- true
if the workspace should be initialised.ProjectBase.getEclipseProject()
public static boolean hasText(java.lang.String str)
Check if a String has text. More specifically, returns true
if the string not
null
, it's
length is > 0
, and
it has at least one non-whitespace character.
StringUtils.hasText(null) = false StringUtils.hasText("") = false StringUtils.hasText(" ") = false StringUtils.hasText("12345") = true StringUtils.hasText(" 12345 ") = true
str
- the String to check, may be null
true
if the String is not null, length > 0,
and not whitespace onlyCharacter.isWhitespace(char)