Post-Generation Extension Point
- Full name : org.eclipse.tigerstripe.workbench.base.generateComplete
Purpose : This extension point is fired when a Tigerstripe project "Generate" is completed allowing post-generate actions to be ran.
- Usage : Post-generate extensions can subscribe to one of three notification modes:
ALWAYS will run your extension upon generation whether the generation was successful or not.
ON_SUCCESS_ONLY will run your extension only if generation is successful.
ON_FAILURE_ONLY will run your extension only if one or more plugin fails to generate successfully. NOTE: The runStatus object passed to the run method will be from all the generated plugins, it is up to you to pick out only the ones that failed.
The listener class must implement the IGenerateCompleteListener interface which has one method:
public GenerateCompleteListenerRunStatus run( GenerateCompletionStatus status, ITigerstripeModelProject project, PluginRunStatus runStatus);
status - Either GenerateCompletionStatus.SUCCESS or GenerateCompletionStatus.FAILURE project - The Tigerstripe project the generation was ran against runStatus - A list of statuses from all the generators that ran Return - A GenerateCompleteListenerRunStatus object to show the user the status of your post-generate action. If you have no status to return than null is acceptable.
- Example :
Sample Project: Media:PostgenerationSamplev1.zip
This sample is also available under Tigerstripe CVS: /samples/org.eclipse.tigerstripe.postgeneration.sample
This project contains two post-generation actions as outlined below:
<plugin> <extension id="postGenerationSample" name="Post-generation custom action sample" point="org.eclipse.tigerstripe.workbench.base.generateComplete"> <generateCompleteListener class="org.eclipse.tigerstripe.postgeneration.sample.PostSuccessfulGeneration" notificationMode="ON_SUCCESS_ONLY"> </generateCompleteListener> <generateCompleteListener class="org.eclipse.tigerstripe.postgeneration.sample.PostFailedGeneration" notificationMode="ON_FAILURE_ONLY"> </generateCompleteListener> </extension> </plugin>
/** * Invoked on a successful generation * This class moves the following file from user's workspace: * /SampleProject/Source/source.xml TO /SampleProject/Target * * If the project or folders do not exist, they're created. If 'source.xml' already * exists under /Sample/Target, it's removed before the move. * */ public class PostSuccessfulGeneration
/** * Invoked on a generation that fails * This class generates an error dialog upon generation failure. * */ public class PostFailedGeneration
- Some important notes :
A "Generate" with no generators will still fire this extension passing GenerateCompletionStatus.SUCCESS as a status.