org.eclipse.xtext.builder.impl
Class XtextBuilder
java.lang.Object
org.eclipse.core.internal.events.InternalBuilder
org.eclipse.core.resources.IncrementalProjectBuilder
org.eclipse.xtext.builder.impl.XtextBuilder
- All Implemented Interfaces:
- org.eclipse.core.runtime.IExecutableExtension
public class XtextBuilder
- extends org.eclipse.core.resources.IncrementalProjectBuilder
- Author:
- Sven Efftinge - Initial contribution and API, Jan Koehnlein, Knut Wannheden, Sebastian Zarnekow - BuildData as blackboard for scheduled data
Fields inherited from class org.eclipse.core.resources.IncrementalProjectBuilder |
AUTO_BUILD, CLEAN_BUILD, FULL_BUILD, INCREMENTAL_BUILD |
Method Summary |
protected org.eclipse.core.resources.IProject[] |
build(int kind,
java.util.Map args,
org.eclipse.core.runtime.IProgressMonitor monitor)
Runs this builder in the specified manner. |
protected void |
clean(org.eclipse.core.runtime.IProgressMonitor monitor)
Clean is an opportunity for a builder to discard any additional state that has
been computed as a result of previous builds. |
protected void |
doBuild(ToBeBuilt toBeBuilt,
org.eclipse.core.runtime.IProgressMonitor monitor,
IXtextBuilderParticipant.BuildType type)
|
protected void |
doClean(ToBeBuilt toBeBuilt,
org.eclipse.core.runtime.IProgressMonitor monitor)
|
protected void |
fullBuild(org.eclipse.core.runtime.IProgressMonitor monitor,
boolean isRecoveryBuild)
|
IResourceSetProvider |
getResourceSetProvider()
|
protected void |
incrementalBuild(org.eclipse.core.resources.IResourceDelta delta,
org.eclipse.core.runtime.IProgressMonitor monitor)
|
protected boolean |
isOpened(org.eclipse.core.resources.IResourceDelta delta)
|
Methods inherited from class org.eclipse.core.resources.IncrementalProjectBuilder |
forgetLastBuiltState, getBuildConfig, getCommand, getContext, getDelta, getProject, getRule, getRule, hasBeenBuilt, isInterrupted, needRebuild, rememberLastBuiltState, setInitializationData, startupOnInitialize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BUILDER_ID
public static final java.lang.String BUILDER_ID
- See Also:
- Constant Field Values
XtextBuilder
public XtextBuilder()
getResourceSetProvider
public IResourceSetProvider getResourceSetProvider()
build
protected org.eclipse.core.resources.IProject[] build(int kind,
java.util.Map args,
org.eclipse.core.runtime.IProgressMonitor monitor)
throws org.eclipse.core.runtime.CoreException
- Description copied from class:
org.eclipse.core.resources.IncrementalProjectBuilder
- Runs this builder in the specified manner. Subclasses should implement
this method to do the processing they require.
If the build kind is IncrementalProjectBuilder.INCREMENTAL_BUILD
or
IncrementalProjectBuilder.AUTO_BUILD
, the getDelta
method can be
used during the invocation of this method to obtain information about
what changes have occurred since the last invocation of this method. Any
resource delta acquired is valid only for the duration of the invocation
of this method. A IncrementalProjectBuilder.FULL_BUILD
has no associated build delta.
After completing a build, this builder may return a list of projects for
which it requires a resource delta the next time it is run. This
builder's project is implicitly included and need not be specified. The
build mechanism will attempt to maintain and compute deltas relative to
the identified projects when asked the next time this builder is run.
Builders must re-specify the list of interesting projects every time they
are run as this is not carried forward beyond the next build. Projects
mentioned in return value but which do not exist will be ignored and no
delta will be made available for them.
This method is long-running; progress and cancellation are provided by
the given progress monitor. All builders should report their progress and
honor cancel requests in a timely manner. Cancelation requests should be
propagated to the caller by throwing
OperationCanceledException
.
All builders should try to be robust in the face of trouble. In
situations where failing the build by throwing CoreException
is the only option, a builder has a choice of how best to communicate the
problem back to the caller. One option is to use the
IResourceStatus.BUILD_FAILED
status code along with a suitable message;
another is to use a MultiStatus
containing finer-grained problem
diagnoses.
- Specified by:
build
in class org.eclipse.core.resources.IncrementalProjectBuilder
- Parameters:
kind
- the kind of build being requested. Valid values are
IncrementalProjectBuilder.FULL_BUILD
- indicates a full build.
IncrementalProjectBuilder.INCREMENTAL_BUILD
- indicates an incremental build.
IncrementalProjectBuilder.AUTO_BUILD
- indicates an automatically triggered
incremental build (autobuilding on).
args
- a table of builder-specific arguments keyed by argument name
(key type: String
, value type: String
);
null
is equivalent to an empty mapmonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
- Returns:
- the list of projects for which this builder would like deltas the
next time it is run or
null
if none
- Throws:
org.eclipse.core.runtime.CoreException
- if this build fails.- See Also:
IProject.build(int, String, Map, IProgressMonitor)
incrementalBuild
protected void incrementalBuild(org.eclipse.core.resources.IResourceDelta delta,
org.eclipse.core.runtime.IProgressMonitor monitor)
throws org.eclipse.core.runtime.CoreException
- Parameters:
monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility
to call done() on the given monitor. Accepts null, indicating that no progress should be
reported and that the operation cannot be cancelled.
- Throws:
org.eclipse.core.runtime.CoreException
doBuild
protected void doBuild(ToBeBuilt toBeBuilt,
org.eclipse.core.runtime.IProgressMonitor monitor,
IXtextBuilderParticipant.BuildType type)
throws org.eclipse.core.runtime.CoreException
- Parameters:
monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility
to call done() on the given monitor. Accepts null, indicating that no progress should be
reported and that the operation cannot be cancelled.
- Throws:
org.eclipse.core.runtime.CoreException
fullBuild
protected void fullBuild(org.eclipse.core.runtime.IProgressMonitor monitor,
boolean isRecoveryBuild)
throws org.eclipse.core.runtime.CoreException
- Parameters:
monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility
to call done() on the given monitor. Accepts null, indicating that no progress should be
reported and that the operation cannot be cancelled.
- Throws:
org.eclipse.core.runtime.CoreException
isOpened
protected boolean isOpened(org.eclipse.core.resources.IResourceDelta delta)
clean
protected void clean(org.eclipse.core.runtime.IProgressMonitor monitor)
throws org.eclipse.core.runtime.CoreException
- Description copied from class:
org.eclipse.core.resources.IncrementalProjectBuilder
- Clean is an opportunity for a builder to discard any additional state that has
been computed as a result of previous builds. It is recommended that builders
override this method to delete all derived resources created by previous builds,
and to remove all markers of type
IMarker.PROBLEM
that
were created by previous invocations of the builder. The platform will
take care of discarding the builder's last built state (there is no need
to call forgetLastBuiltState
).
This method is called as a result of invocations of
IWorkspace.build
or IProject.build
where
the build kind is IncrementalProjectBuilder.CLEAN_BUILD
.
This default implementation does nothing. Subclasses may override.
This method is long-running; progress and cancellation are provided by
the given progress monitor. All builders should report their progress and
honor cancel requests in a timely manner. Cancelation requests should be
propagated to the caller by throwing
OperationCanceledException
.
- Overrides:
clean
in class org.eclipse.core.resources.IncrementalProjectBuilder
- Parameters:
monitor
- the progress monitor to use for reporting progress to the user. It is the implementors responsibility
to call done() on the given monitor. Accepts null, indicating that no progress should be
reported and that the operation cannot be cancelled.
- Throws:
org.eclipse.core.runtime.CoreException
- if this build fails.- See Also:
IWorkspace.build(int, IProgressMonitor)
,
IncrementalProjectBuilder.CLEAN_BUILD
doClean
protected void doClean(ToBeBuilt toBeBuilt,
org.eclipse.core.runtime.IProgressMonitor monitor)
throws org.eclipse.core.runtime.CoreException
- Parameters:
monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility
to call done() on the given monitor. Accepts null, indicating that no progress should be
reported and that the operation cannot be cancelled.
- Throws:
org.eclipse.core.runtime.CoreException