diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse')
4 files changed, 55 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java index d488a31da..f89c2af6f 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java @@ -70,6 +70,7 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { private boolean hidden; private boolean disable; private boolean singleton; + private boolean savePoint; private final List<String> dependencies = new ArrayList<String>(); private Expression expression; private Map<String,String> parameters = new HashMap<String, String>(); @@ -170,6 +171,15 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { } /** + * If a reference is marked as savepoint, the step or step group will not + * be rolled back if it was executed successfully. + * @return <code>true</code> if rollback should be done after successful execution. + */ + public boolean isSavePoint() { + return savePoint; + } + + /** * Returns the list of dependencies. * <p> * The step or step group id might be fully qualified using the form @@ -251,6 +261,11 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { this.singleton = Boolean.parseBoolean(value.trim()); } + value = config.getAttribute("savePoint"); //$NON-NLS-1$ + if (value != null && value.trim().length() > 0) { + this.savePoint = Boolean.parseBoolean(value.trim()); + } + // Read in the list of dependencies if specified. dependencies.clear(); IConfigurationElement[] requires = config.getChildren("requires"); //$NON-NLS-1$ @@ -330,6 +345,7 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { buffer.append(", hidden = " + isHidden()); //$NON-NLS-1$ buffer.append(", disable = " + isDisable()); //$NON-NLS-1$ buffer.append(", singleton = " + isSingleton()); //$NON-NLS-1$ + buffer.append(", savePoint = " + isSavePoint()); //$NON-NLS-1$ buffer.append(", parameters = " + getParameters()); //$NON-NLS-1$ return buffer.toString(); } @@ -705,6 +721,9 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { if (reference.isSingleton() && !groupable.isSingleton()) { groupable.setSingleton(reference.isSingleton()); } + if (reference.isSavePoint() && !groupable.isSavePoint()) { + groupable.setIsSavePoint(reference.isSavePoint()); + } } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java index 612130eb6..f84a63ab7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java @@ -26,6 +26,7 @@ public class StepGroupable implements IStepGroupable { private boolean hidden = false; private boolean removable = true; private boolean singleton = false; + private boolean savePoint = false; private final List<String> dependencies = new ArrayList<String>(); private IExecutableExtension extension; @@ -192,6 +193,22 @@ public class StepGroupable implements IStepGroupable { this.dependencies.addAll(Arrays.asList(dependencies)); } + /** + * Sets if or if not this reference is a savepoint. + * @param isSavePoint <code>true</code> if this reference should be a savepoint. + */ + public void setIsSavePoint(boolean isSavePoint) { + savePoint = isSavePoint; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupable#isSavePoint() + */ + @Override + public boolean isSavePoint() { + return savePoint; + } + /* (non-Javadoc) * @see java.lang.Object#toString() */ diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java index 03902f544..7a1cbc402 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java @@ -69,6 +69,13 @@ public interface IStepGroupable { public boolean isDisabled(); /** + * If a reference is marked as savepoint, the step or step group will not + * be rolled back if it was executed successfully. + * @return <code>true</code> if rollback should be done after successful execution. + */ + public boolean isSavePoint(); + + /** * Returns the list of dependencies. The dependencies of a groupable are checked on execution. * If one of the listed dependencies have not been executed before, the execution of the * groupable will fail. diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java index ab58e687b..d285f4955 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java @@ -514,6 +514,14 @@ public class Stepper implements IStepper { // If the passed in groupable is associated with a step group // -> get the groupable from that group and execute them executeStepGroup((IStepGroup) groupable.getExtension(), statusContainer, executedSteps, id); + + if (groupable.isSavePoint()) { + ExecutedContextStep last = executedSteps.isEmpty() ? null : executedSteps.get(executedSteps.size()-1); + while (last != null && last.id.toString().startsWith(id.toString())) { + executedSteps.remove(executedSteps.size()-1); + last = executedSteps.isEmpty() ? null : executedSteps.get(executedSteps.size()-1); + } + } } else if (groupable.getExtension() instanceof IStep) { // If the passed in groupable is associated with a step @@ -531,6 +539,10 @@ public class Stepper implements IStepper { executedSteps.add(new ExecutedContextStep(id, step)); // Invoke the executor now executor.execute(step, id, getContext(), getData(), getMonitor()); + + if (groupable.isSavePoint()) { + executedSteps.remove(executedSteps.size()-1); + } } catch (Exception e) { // Catch the CoreException first hand as we need to continue the |