public interface IXtextBuilderParticipant
A builder participant allows to process resources that are built by an Eclipse incremental project builder.
A common implementation pattern is to filter the list of deltas
by
file extension and execute some logic on the respective resources. One main use case is to generate additional
artifacts from those resources, i.e. implement a code generator.
A sample implementation may look like this:
public void build(IBuildContext context, IProgressMonitor monitor) throws CoreException { for(IResourceDescription.Delta delta: context.getDeltas()) { Resource resource = context.getResourceSet().getResource(delta.getUri(), true); .. process resource here .. } }
Implementors should keep in mind that they share the resource set with other builder participants thus you shall not modify the state of the given resource set besides adding or removing resources. Removed resources should be unloaded properly or the resource set should be cleared.
Another important aspect is memory consumption. If you expect a very large number of resources in a single project, try to apply some clustering algorithm to the processing. The application may run out of memory otherwise.
Modifier and Type | Interface and Description |
---|---|
static class |
IXtextBuilderParticipant.BuildType |
static interface |
IXtextBuilderParticipant.IBuildContext
The build context provides information that may be used by the participant.
|
Modifier and Type | Method and Description |
---|---|
void |
build(IXtextBuilderParticipant.IBuildContext context,
org.eclipse.core.runtime.IProgressMonitor monitor)
Allows clients to perform additional steps in the build process such as code generation.
|
void build(IXtextBuilderParticipant.IBuildContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
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.org.eclipse.core.runtime.CoreException