Jump to: navigation, search

Post-Generation Extension Point

Revision as of 13:47, 5 November 2010 by Nmehrega.cisco.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< To: Tigerstripe Extension Points

  • 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:

            name="Post-generation custom action sample"

 * 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.