public class Reporter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NEW_REPORTER_ISSUE
The property id used to specify if a new issue has been reported since
the last time the reporter was asked for the list of issues.
|
static java.lang.String |
USES_REPORTING
The id of the property that transformations must define to indicate they
use the reporting tool.
|
Constructor and Description |
---|
Reporter(ITransformContext context)
Constructs a new reporter.
|
Modifier and Type | Method and Description |
---|---|
void |
addErrorStatus(ITransformContext context,
int statusCode,
java.lang.String message,
java.lang.String actionTaken,
java.lang.Throwable exception)
Adds an error status to reported issues.
|
void |
addInfoStatus(ITransformContext context,
int statusCode,
java.lang.String message,
java.lang.String actionTaken,
java.lang.Throwable exception)
Adds a info status to reported issues.
|
void |
addTransformation(ITransformContext parentContext,
ITransformContext childContext)
Starts tracking issues for the child context.
|
void |
addUniqueErrorStatus(ITransformContext context,
int statusCode,
java.lang.String message,
java.lang.String actionTaken,
java.lang.Throwable exception)
Adds an error status to reported issues.
|
void |
addUniqueInfoStatus(ITransformContext context,
int statusCode,
java.lang.String message,
java.lang.String actionTaken,
java.lang.Throwable exception)
Adds an info status to reported issues.
|
void |
addUniqueWarningStatus(ITransformContext context,
int statusCode,
java.lang.String message,
java.lang.String actionTaken,
java.lang.Throwable exception)
Adds a warning status to reported issues.
|
void |
addWarningStatus(ITransformContext context,
int statusCode,
java.lang.String message,
java.lang.String actionTaken,
java.lang.Throwable exception)
Adds a warning status to reported issues.
|
static Reporter |
getReporter(ITransformContext context)
Returns the reporter from the specified context.
|
ITransformContext |
getRootTransformationContext()
Returns the root transformation context.
|
org.eclipse.core.runtime.MultiStatus |
getStatus(ITransformContext context)
Returns the
MultiStatus that contains the reported issues
for the given context. |
void |
reportToErrorLog()
Report all issues to the error log.
|
public static final java.lang.String USES_REPORTING
public static final java.lang.String NEW_REPORTER_ISSUE
public Reporter(ITransformContext context)
context
- The context used to run the root transformation.java.lang.IllegalArgumentException
- if context is null.public static Reporter getReporter(ITransformContext context)
context
- The context to extract the reporter from.java.lang.IllegalArgumentException
- if context is null.public void addTransformation(ITransformContext parentContext, ITransformContext childContext)
parentContext
- The context corresponding to the parent
transformation.childContext
- The context corresponding to the child
transformation.java.lang.IllegalArgumentException
- if either context is null.public void addErrorStatus(ITransformContext context, int statusCode, java.lang.String message, java.lang.String actionTaken, java.lang.Throwable exception)
context
- The transformation context used to run the transformation
when the issue occurred.statusCode
- The code of the status.message
- The message of the status.actionTaken
- A message indicating what action was taken to handle
the issue being logged. This can be null. If it is not null, a child
status will be created under the newly created status.exception
- The exception of the status.java.lang.IllegalArgumentException
- if context is null.public void addUniqueErrorStatus(ITransformContext context, int statusCode, java.lang.String message, java.lang.String actionTaken, java.lang.Throwable exception)
context
- The transformation context used to run the transformation
when the issue occurred.statusCode
- The code of the status.message
- The message of the status.actionTaken
- A message indicating what action was taken to handle
the issue being logged. This can be null. If it is not null, a child
status will be created under the newly created status.exception
- The exception of the status.java.lang.IllegalArgumentException
- if context is null.public void addWarningStatus(ITransformContext context, int statusCode, java.lang.String message, java.lang.String actionTaken, java.lang.Throwable exception)
context
- The transformation context used to run the transformation
when the issue occurred.statusCode
- The code of the status.message
- The message of the status.actionTaken
- A message indicating what action was taken to handle
the issue being logged. This can be null. If it is not null, a child
status will be created under the newly created status.exception
- The exception of the status.java.lang.IllegalArgumentException
- if context is null.public void addUniqueWarningStatus(ITransformContext context, int statusCode, java.lang.String message, java.lang.String actionTaken, java.lang.Throwable exception)
context
- The transformation context used to run the transformation
when the issue occurred.statusCode
- The code of the status.message
- The message of the status.actionTaken
- A message indicating what action was taken to handle
the issue being logged. This can be null. If it is not null, a child
status will be created under the newly created status.exception
- The exception of the status.java.lang.IllegalArgumentException
- if context is null.public void addInfoStatus(ITransformContext context, int statusCode, java.lang.String message, java.lang.String actionTaken, java.lang.Throwable exception)
context
- The transformation context used to run the transformation
when the issue occurred.statusCode
- The code of the status.message
- The message of the status.actionTaken
- A message indicating what action was taken to handle
the issue being logged. This can be null. If it is not null, a child
status will be created under the newly created status.exception
- The exception of the status.java.lang.IllegalArgumentException
- if context is null.public void addUniqueInfoStatus(ITransformContext context, int statusCode, java.lang.String message, java.lang.String actionTaken, java.lang.Throwable exception)
context
- The transformation context used to run the transformation
when the issue occurred.statusCode
- The code of the status.message
- The message of the status.actionTaken
- A message indicating what action was taken to handle
the issue being logged. This can be null. If it is not null, a child
status will be created under the newly created status.exception
- The exception of the status.java.lang.IllegalArgumentException
- if context is null.public org.eclipse.core.runtime.MultiStatus getStatus(ITransformContext context)
MultiStatus
that contains the reported issues
for the given context.context
- The context to extract issues for.MultiStatus
that contains all the reported
issues for the given context. null if no issues have been reported for
the given context.java.lang.IllegalArgumentException
- if context is null.public ITransformContext getRootTransformationContext()
public void reportToErrorLog()