public abstract class TransformUtility extends AbstractTransform
CODE_OTHER, CODE_PROPERTY, CODE_SOURCE, CODE_TARGET, CODE_TARGET_CONTAINER, PROGRESS_MONITOR_WORK_UNITS| Constructor and Description |
|---|
TransformUtility(ITransformUtilityDescriptor descriptor)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
ITransformContext |
createContext(ITransformContext parentContext)
Create an execution context associated with this transform.
|
abstract void |
doExecute(ITransformContext context)
The specific task that this TransformUtility performs based on the data
contained within the execution context.
|
void |
execute(ITransformContext context)
Execute the transform with the given context.
|
protected java.lang.String |
getWorkUnitsPropertyId()
Returns the property id that stores the progress monitor work units in
the transform context.
|
protected void |
handle(java.lang.Exception exception,
ITransformContext context)
Handle exceptions in the transformation engine.
|
protected void |
internalExecute(ITransformContext context)
The internal execution of the TransformUtility on the context.
|
static void |
setPropertyInContext(ITransformContext context,
java.lang.String propertyId,
java.lang.Object propertyValue)
Set a property in the transform context for the transform utility to use.
|
org.eclipse.core.runtime.IStatus |
validateContext(ITransformContext context)
Validate the context for the transformation.
|
getProgressMonitorWorkUnits, getTransformationDescriptorcanAccept, getAcceptCondition, getDescription, getId, getName, getProgressMonitor, setAcceptCondition, setDescription, setId, setNamepublic TransformUtility(ITransformUtilityDescriptor descriptor)
descriptor - the ITransformUtilityDescriptor that describes this utilitypublic static void setPropertyInContext(ITransformContext context, java.lang.String propertyId, java.lang.Object propertyValue)
context - the ITransformContext into which to set the propertypropertyId - the id of the property to setpropertyValue - the value of the property to setpublic ITransformContext createContext(ITransformContext parentContext)
AbstractTransformcreateContext in class AbstractTransformparentContext - the current context of the transformation executionpublic void execute(ITransformContext context) throws java.lang.Exception
AbstractTransformexecute in class AbstractTransformcontext - the current context of the transformation executionjava.lang.Exceptionprotected void handle(java.lang.Exception exception,
ITransformContext context)
Because of the recursive nature of the engine, an exception can be caught while quite deeping the execution hierarchy of the transformation. The goal is to catch the real exception and wrap it up in a special transform exception. This special exception is then rethrown and caught by all of the transforms executing in the trasform context stack. The root transform will simply throw the exception, which must be caught by the client executing the transformation.
When the execution is first caught, it is logged and traced. It is up to the client executing the transformation to display an error dialog if necessary.
exception - the exception that was throwncontext - the execute context in which the exception occurredprotected void internalExecute(ITransformContext context)
context - The execution context.public org.eclipse.core.runtime.IStatus validateContext(ITransformContext context)
AbstractTransformThis method can return either a single status object or multiple status objects depending upon the validation performed. If multiple warnings/errors are to be returned use a MultiStatus object. If one of its child status objects has a severity of ERROR, the multi-status is assumed to be an error.
A valid context should return a single status object with a severity of OK. A "null" return value indicates a major error (e.g., the service could not locate or load the provider).
validateContext in class AbstractTransformcontext - the context to be validatedMultiStatus,
Statuspublic abstract void doExecute(ITransformContext context) throws java.lang.Exception
context - The execution context.java.lang.Exceptionprotected java.lang.String getWorkUnitsPropertyId()
AbstractTransformgetWorkUnitsPropertyId in class AbstractTransform