Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Post-Generation Extension Point

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

< 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 PluginRunStatus run(GenerateCompletionStatus status, ITigerstripeModelProject project, PluginRunStatus[] runStatus); where: status is either GenerateCompletionStatus.SUCCESS or GenerateCompletionStatus.FAILURE - This is intended for listeners that listen ALWAYS project is the Tigerstripe project the generation was ran against runStatus is a list of statuses from all the generators that ran You can also return a PluginRunStatus object to show the user the status of your post-generate action. If you have no status to return than null is acceptable.

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

Sample Project: [[Media:File:PostgenerationSample.zip]] This sample is also available under Tigerstripe CVS: /samples/org.eclipse.tigerstripe.postgeneration.sample This sample project contains two post-generation actions as outlined below:

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

Back to the top