Class Compile
- java.lang.Object
-
- ca.cgjennings.apps.arkham.project.TaskAction
-
- ca.cgjennings.apps.arkham.project.Compile
-
- All Implemented Interfaces:
IconProvider
public class Compile extends TaskAction
A task action that compiles selected Java source files. The static methodgetCompiler()
has been exposed to provide access to the Java compiler for your own use.- Since:
- 2.1
- Author:
- Chris Jennings
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Compile.Compiler
An interface that provides basic access to a Java source compiler.
-
Constructor Summary
Constructors Constructor Description Compile()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
appliesTo(Project project, Task task, Member member)
Returnstrue
if this action can be performed on the specified member of a project, project or a task.static Compile.Compiler
getCompiler()
Returns aCompile.Compiler
that can be used to compile Java source files, ornull
if none is available.java.lang.String
getDescription()
Returns a longer description of the action, suitable for use as a tool tip.java.lang.String
getLabel()
Returns the human-readable name of this action.boolean
perform(Project project, Task task, Member member)
Perform this action on a member of a project, a project or a task.static void
setCompiler(Compile.Compiler javac)
Explicitly sets the compiler implementation to use.-
Methods inherited from class ca.cgjennings.apps.arkham.project.TaskAction
appliesToSelection, applyToChildren, getActionName, getIcon, performOnSelection, resolveTarget, toString
-
-
-
-
Method Detail
-
getLabel
public java.lang.String getLabel()
Description copied from class:TaskAction
Returns the human-readable name of this action.- Specified by:
getLabel
in classTaskAction
- Returns:
- the name used to create menu items for this action, localized if possible
-
getDescription
public java.lang.String getDescription()
Description copied from class:TaskAction
Returns a longer description of the action, suitable for use as a tool tip.- Overrides:
getDescription
in classTaskAction
- Returns:
- a long description of the action, or
null
-
perform
public boolean perform(Project project, Task task, Member member)
Description copied from class:TaskAction
Perform this action on a member of a project, a project or a task. If the project itself is the target,task
andmember
will benull
. If a task is the target, thenmember
will be null. If an error occurs while executing the task, then it is the action's responsibility to inform the user. This method can returnfalse
to indicate that if the action is being applied to multiple members, it should stop immediately rather than continue to the next member.- Specified by:
perform
in classTaskAction
- Parameters:
project
- the project that is being acted upontask
- the task within the project that is being acted upon;null
if acting on a projectmember
- the specific member within the task to act upon;null
if this is a project or task
-
appliesTo
public boolean appliesTo(Project project, Task task, Member member)
Description copied from class:TaskAction
Returnstrue
if this action can be performed on the specified member of a project, project or a task. If the project itself is the target,task
andmember
will benull
. If a task is the target, thenmember
will be null. If an error occurs while executing the task, then it is the action's responsibility to inform the user. This method can returnfalse
to indicate that if the action is being applied to multiple members, it should stop immediately rather than continue to the next member.- Specified by:
appliesTo
in classTaskAction
- Parameters:
project
- the project that is being acted upontask
- the task within the project that is being acted upon;null
if acting on a projectmember
- the specific member within the task to act upon;null
if this is a project or task
-
getCompiler
public static Compile.Compiler getCompiler()
Returns aCompile.Compiler
that can be used to compile Java source files, ornull
if none is available. If a compiler has been set explicitly usingsetCompiler(ca.cgjennings.apps.arkham.project.Compile.Compiler)
, then the most recently set compiler is returned. Otherwise, a default compiler implementation is used. The default implementation should be available on any system with a Java 6+ JDK (Java Development Kit) installed.If no compiler has been explicitly set and the default implementation is not available, this method returns
null
.- Returns:
- an interface to a Java compiler installed on the user's system,
or
null
-
setCompiler
public static void setCompiler(Compile.Compiler javac)
Explicitly sets the compiler implementation to use. Plug-in developers may call this to replace the defaultCompile.Compiler
with a custom implementation.- Parameters:
javac
- the compiler implementation to use when compiling Java source files- Throws:
java.lang.NullPointerException
- if the compiler isnull
-
-