summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-03-14 09:15:32 (EST)
committer pelder2006-03-14 09:15:32 (EST)
commit6807a84758de9c3d7b3c8a514eb919d7aecf3296 (patch)
tree7330a01e2616a724a846a4bf907878e35a5d22dd
parentcebaeea57095ef478b65253f019e396897532bce (diff)
downloadorg.eclipse.jet-6807a84758de9c3d7b3c8a514eb919d7aecf3296.zip
org.eclipse.jet-6807a84758de9c3d7b3c8a514eb919d7aecf3296.tar.gz
org.eclipse.jet-6807a84758de9c3d7b3c8a514eb919d7aecf3296.tar.bz2
[131568] Added method addFinalAction(IWorkspaceAction) to permit definition of a stream of actions that will follow actions added with addAction(IWorkspaceAction).
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java38
1 files changed, 30 insertions, 8 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java
index b02fda0..9a3eb93 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java
@@ -56,6 +56,8 @@ public class WorkspaceContextExtender extends AbstractContextExtender
private final Stack containerStack = new Stack();
+ private final List finalWorkspaceActions = new ArrayList();
+
public ContextData()
{
// do nothing
@@ -63,13 +65,19 @@ public class WorkspaceContextExtender extends AbstractContextExtender
public void commit(final JET2Context context, IProgressMonitor monitor) throws JET2TagException
{
- TransformContextExtender tce = new TransformContextExtender(context);
- monitor.beginTask(JET2Messages.WorkspaceContextExtender_Commiting, 1 + workspaceActions.size());
+ final int actionsToExecuteCount = workspaceActions.size() + finalWorkspaceActions.size();
+ final List actionsToExecute = new ArrayList(actionsToExecuteCount);
+ actionsToExecute.addAll(workspaceActions);
+ actionsToExecute.addAll(finalWorkspaceActions);
+
+ TransformContextExtender tce = TransformContextExtender.getInstance(context);
+ monitor.beginTask(JET2Messages.WorkspaceContextExtender_Commiting, 1 + actionsToExecuteCount);
+
try
{
monitor.subTask(JET2Messages.WorkspaceContextExtender_ConfirmingTeamAccess);
- final List filesToValidateEdit = new ArrayList(workspaceActions.size());
- for (Iterator i = workspaceActions.iterator(); i.hasNext();)
+ final List filesToValidateEdit = new ArrayList(actionsToExecute.size());
+ for (Iterator i = actionsToExecute.iterator(); i.hasNext();)
{
final IWorkspaceAction action = (IWorkspaceAction)i.next();
Platform.run(new ISafeRunnable() {
@@ -103,10 +111,10 @@ public class WorkspaceContextExtender extends AbstractContextExtender
public void run(final IProgressMonitor submon) throws CoreException
{
- submon.beginTask(null, workspaceActions.size());
+ submon.beginTask(null, actionsToExecute.size());
try
{
- for (Iterator i = workspaceActions.iterator(); i.hasNext();)
+ for (Iterator i = actionsToExecute.iterator(); i.hasNext();)
{
final IWorkspaceAction action = (IWorkspaceAction)i.next();
@@ -130,7 +138,7 @@ public class WorkspaceContextExtender extends AbstractContextExtender
submon.done();
}
}
- }, new SubProgressMonitor(monitor, workspaceActions.size()));
+ }, new SubProgressMonitor(monitor, actionsToExecute.size()));
}
catch (CoreException e)
{
@@ -171,7 +179,7 @@ public class WorkspaceContextExtender extends AbstractContextExtender
/**
* Add a new action to be executed when the JET2 transform commits.
- * @param action
+ * @param action the action to execute
*/
public void addAction(IWorkspaceAction action)
{
@@ -179,6 +187,20 @@ public class WorkspaceContextExtender extends AbstractContextExtender
}
/**
+ * Add a new action to be executed after all actions added view {@link #addAction(IWorkspaceAction)}
+ * are executed when the JET2 transform commits. Final actions behave identically to other actions,
+ * except that the occur after all 'normal' actions. In particular, final actions:
+ * <bl>
+ * <li>participate in the team environment validateEdit phase.</li>
+ * <li>are performed within the same Eclipse workspace operation as other actions.</li>
+ * </bl>
+ * @param action the action to execute
+ */
+ public void addFinalAction(IWorkspaceAction action)
+ {
+ getData().finalWorkspaceActions.add(action);
+ }
+ /**
* Push a default container onto the stack of default containers.
* @param container
*/