From 10ae6658d7cc152ec5c2f0c4e76704120e4c3f3e Mon Sep 17 00:00:00 2001 From: Tobias Schwarz Date: Thu, 22 Aug 2013 14:46:55 +0200 Subject: Target Explorer: rework ProcessesV1 support --- .../schema/stepGroups.exsd | 7 ++++++ .../te/runtime/stepper/extensions/StepGroup.java | 25 ++++++++++++++++++++++ .../runtime/stepper/extensions/StepGroupable.java | 9 ++++++++ 3 files changed, 41 insertions(+) (limited to 'target_explorer') diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd index ff76c8206..20a5e7ce3 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd @@ -280,6 +280,13 @@ Use the form <i>&quot;id##secondaryId&quot;</i> to identify + + + + Optional references will be ignored if not available. + + + 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 f89c2af6f..601b4246e 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 @@ -71,6 +71,7 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { private boolean disable; private boolean singleton; private boolean savePoint; + private boolean optional; private final List dependencies = new ArrayList(); private Expression expression; private Map parameters = new HashMap(); @@ -179,6 +180,15 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { return savePoint; } + /** + * If a reference is marked as optional, the step or step group will be + * ignored if not known. + * @return true if reference should be ignored when not known. + */ + public boolean isOptional() { + return optional; + } + /** * Returns the list of dependencies. *

@@ -266,6 +276,11 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { this.savePoint = Boolean.parseBoolean(value.trim()); } + value = config.getAttribute("optional"); //$NON-NLS-1$ + if (value != null && value.trim().length() > 0) { + this.optional = Boolean.parseBoolean(value.trim()); + } + // Read in the list of dependencies if specified. dependencies.clear(); IConfigurationElement[] requires = config.getChildren("requires"); //$NON-NLS-1$ @@ -346,6 +361,7 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { buffer.append(", disable = " + isDisable()); //$NON-NLS-1$ buffer.append(", singleton = " + isSingleton()); //$NON-NLS-1$ buffer.append(", savePoint = " + isSavePoint()); //$NON-NLS-1$ + buffer.append(", optional = " + isOptional()); //$NON-NLS-1$ buffer.append(", parameters = " + getParameters()); //$NON-NLS-1$ return buffer.toString(); } @@ -645,6 +661,12 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { // If the candidate is null here, that's an error as a referenced step is missing. if (candidate == null) { + if (reference.isOptional()) { + CoreBundleActivator.getTraceHandler().trace( + "StepGroup#getSteps: SKIPPED optional not existing reference = '" + reference.getId(), //$NON-NLS-1$ + 0, ITraceIds.TRACE_STEPPING, IStatus.WARNING, this); + continue; + } throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), MessageFormat.format(Messages.StepGroup_error_missingReferencedStep, @@ -724,6 +746,9 @@ public class StepGroup extends ExecutableExtension implements IStepGroup { if (reference.isSavePoint() && !groupable.isSavePoint()) { groupable.setIsSavePoint(reference.isSavePoint()); } + if (reference.isOptional() && !groupable.isOptional()) { + groupable.setOptional(reference.isOptional()); + } } } 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 f84a63ab7..f447061fb 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 @@ -27,6 +27,7 @@ public class StepGroupable implements IStepGroupable { private boolean removable = true; private boolean singleton = false; private boolean savePoint = false; + private boolean optional = false; private final List dependencies = new ArrayList(); private IExecutableExtension extension; @@ -209,6 +210,14 @@ public class StepGroupable implements IStepGroupable { return savePoint; } + public void setOptional(boolean optional) { + this.optional = optional; + } + + public boolean isOptional() { + return optional; + } + /* (non-Javadoc) * @see java.lang.Object#toString() */ -- cgit v1.2.3