diff options
author | Uwe Stieber | 2011-12-04 13:15:21 +0000 |
---|---|---|
committer | Uwe Stieber | 2011-12-04 13:15:21 +0000 |
commit | 4b8218fb63d221ee6e869510ef2eb9ef2acdc84d (patch) | |
tree | 20270a545daa04cf8e32d0278a8154215fa02cd5 /target_explorer | |
parent | 5074dafdd71e2905db0160f82326900aa1a60215 (diff) | |
download | org.eclipse.tcf-4b8218fb63d221ee6e869510ef2eb9ef2acdc84d.tar.gz org.eclipse.tcf-4b8218fb63d221ee6e869510ef2eb9ef2acdc84d.tar.xz org.eclipse.tcf-4b8218fb63d221ee6e869510ef2eb9ef2acdc84d.zip |
Target Explorer: Added step bindings extension point manager and fixed bugs revealed by the unit tests for the stepper engine
Diffstat (limited to 'target_explorer')
28 files changed, 761 insertions, 91 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/plugin.properties index 3399d316b..ee1c54216 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/plugin.properties @@ -13,5 +13,5 @@ providerName = Eclipse.org # ***** Extension Points ***** -ExtensionPoint.handlers.name=Target Explorer Status Handlers Extension Point -ExtensionPoint.bindings.name=Target Explorer Status Handler Bindings Extension Point +ExtensionPoint.handlers.name=Status Handlers Extension Point +ExtensionPoint.bindings.name=Status Handler Bindings Extension Point diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/schema/bindings.exsd b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/schema/bindings.exsd index ba81a8563..1265f1a70 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/schema/bindings.exsd +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/schema/bindings.exsd @@ -3,7 +3,7 @@ <schema targetNamespace="org.eclipse.tcf.te.runtime.statushandler" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.eclipse.tcf.te.runtime.statushandler" id="bindings" name="%ExtensionPoint.handlers.name"/>
+ <meta.schema plugin="org.eclipse.tcf.te.runtime.statushandler" id="bindings" name="Status Handler Bindings Extension Point"/>
</appinfo>
<documentation>
This extension point is used to declare the Target Explorer status handler bindings.
@@ -99,7 +99,7 @@ <extension point="org.eclipse.tcf.te.runtime.statushandler.bindings">
<binding
id="org.eclipse.tcf.te.ui.statushandler.binding.NotificationPopupStatusHandler"
- pageId="org.eclipse.tcf.te.ui.statushandler.NotificationPopupStatusHandler">
+ handlerId="org.eclipse.tcf.te.ui.statushandler.NotificationPopupStatusHandler">
<enablement>
...
</enablement>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/schema/handlers.exsd b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/schema/handlers.exsd index 59c3afaf4..faf5d9fb4 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/schema/handlers.exsd +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/schema/handlers.exsd @@ -3,7 +3,7 @@ <schema targetNamespace="org.eclipse.tcf.te.runtime.statushandler" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.eclipse.tcf.te.runtime.statushandler" id="handlers" name="Target Explorer Status Handler Extension Point"/>
+ <meta.schema plugin="org.eclipse.tcf.te.runtime.statushandler" id="handlers" name="Status Handler Extension Point"/>
</appinfo>
<documentation>
This extension point is used to allow the contribution of new Target Explorer status handler.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/internal/StatusHandlerBindingExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/internal/StatusHandlerBindingExtensionPointManager.java index 897747e35..fe8fd2462 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/internal/StatusHandlerBindingExtensionPointManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/internal/StatusHandlerBindingExtensionPointManager.java @@ -21,9 +21,9 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; -import org.eclipse.tcf.te.runtime.statushandler.activator.CoreBundleActivator; import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager; import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy; +import org.eclipse.tcf.te.runtime.statushandler.activator.CoreBundleActivator; /** @@ -104,8 +104,7 @@ public class StatusHandlerBindingExtensionPointManager extends AbstractExtension for (StatusHandlerBinding binding : getBindings()) { Expression enablement = binding.getEnablement(); - // The page binding is applicable by default if no expression - // is specified. + // The binding is applicable by default if no expression is specified. boolean isApplicable = enablement == null; if (enablement != null) { @@ -121,13 +120,12 @@ public class StatusHandlerBindingExtensionPointManager extends AbstractExtension Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status); } } else { - // The enablement is false by definition if no - // handler context is not given. + // The enablement is false by definition if no handler context is given. isApplicable = false; } } - // Add the page if applicable + // Add the binding if applicable if (isApplicable) applicable.add(binding); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/META-INF/MANIFEST.MF index 3f7e01ead..250316d93 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Bundle-Localization: plugin Export-Package: org.eclipse.tcf.te.runtime.stepper, org.eclipse.tcf.te.runtime.stepper.activator;x-internal:=true, org.eclipse.tcf.te.runtime.stepper.extensions, + org.eclipse.tcf.te.runtime.stepper.extensions.manager, org.eclipse.tcf.te.runtime.stepper.interfaces, org.eclipse.tcf.te.runtime.stepper.interfaces.tracing, - org.eclipse.tcf.te.runtime.stepper.internal.extensions;x-internal:=true, - org.eclipse.tcf.te.runtime.stepper.nls;x-internal:=true + org.eclipse.tcf.te.runtime.stepper.nls;x-internal:=true, + org.eclipse.tcf.te.runtime.stepper.stepper diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/plugin.xml index ab060df6e..e9191deca 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/plugin.xml @@ -6,6 +6,7 @@ <extension-point id="steppers" name="Steppers" schema="schema/steppers.exsd"/>
<extension-point id="steps" name="Steps" schema="schema/steps.exsd"/>
<extension-point id="stepGroups" name="Step Groups" schema="schema/stepGroups.exsd"/>
+ <extension-point id="stepBindings" name="Step Bindings" schema="schema/stepBindings.exsd"/>
<!-- Stepper contributions -->
<extension point="org.eclipse.tcf.te.runtime.stepper.steppers">
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepBindings.exsd b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepBindings.exsd new file mode 100644 index 000000000..fcb6b1ff4 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepBindings.exsd @@ -0,0 +1,129 @@ +<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tcf.te.runtime.stepper" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.tcf.te.runtime.stepper" id="stepBindings" name="Step Bindings Extension Point"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to declare step bindings.
+<p>
+<b>Note:</b> For the enablement expression evaluation, the default variable is the same as "activeContexts", and the variable is iterable. The variable is set to the list of contexts the executing stepper is associated with.
+ </documentation>
+ </annotation>
+
+ <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="binding" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="binding">
+ <annotation>
+ <documentation>
+ Declares a step binding.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="enablement" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique id of the step binding contribution.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="stepId" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique id of the referenced step.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.tcf.te.runtime.stepper.steps/step/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ Target Explorer 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ <pre>
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepBindings">
+ <binding
+ id="org.eclipse.tcf.te.ui.stepper.step.binding.OpenChannelStep"
+ stepId="org.eclipse.tcf.te.ui.stepper.step.OpenChannelStep">
+ <enablement>
+ ...
+ </enablement>
+ </binding>
+ </extension>
+</pre>
+ </documentation>
+ </annotation>
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2011 Wind River Systems, Inc. and others.
+
+All rights reserved.
+
+This program and the accompanying materials are made available under the terms
+of the Eclipse Public License v1.0 which accompanies this distribution, and is
+available at http://www.eclipse.org/legal/epl-v10.html.
+ </documentation>
+ </annotation>
+
+</schema>
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 c845f2f94..36e1c1b35 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 @@ -3,7 +3,7 @@ <schema targetNamespace="org.eclipse.tcf.te.runtime.stepper" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.eclipse.tcf.te.runtime.stepper" id="stepGroups" name="Step Groups"/>
+ <meta.schema plugin="org.eclipse.tcf.te.runtime.stepper" id="stepGroups" name="Step Groups Extension Point"/>
</appinfo>
<documentation>
This extension point is used to contribute step groups.
@@ -191,7 +191,7 @@ The step group iterator implementation class can be specified either by the iter <complexType>
<sequence>
<element ref="requires" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="enablement"/>
+ <element ref="enablement" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/steppers.exsd b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/steppers.exsd index b26e3eab9..ad434a8ab 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/steppers.exsd +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/steppers.exsd @@ -3,7 +3,7 @@ <schema targetNamespace="org.eclipse.tcf.te.runtime.stepper" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.eclipse.tcf.te.runtime.stepper" id="steppers" name="Steppers"/>
+ <meta.schema plugin="org.eclipse.tcf.te.runtime.stepper" id="steppers" name="Steppers Extension Point"/>
</appinfo>
<documentation>
This extension point is used to contribute stepper.
@@ -81,12 +81,12 @@ Stepper must be runnable in worker threads. <attribute name="class" type="string">
<annotation>
<documentation>
- The class that implements <code>org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper</code> or extends <code>org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper</code>.
+ The class that implements <code>org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper</code> or extends <code>org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper</code>.
<p>
The stepper implementation class must be specified either by the class attribute or the class child element!
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper:org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper"/>
+ <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper:org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper"/>
</appinfo>
</annotation>
</attribute>
@@ -114,12 +114,12 @@ The stepper implementation class must be specified either by the class attribute <attribute name="class" type="string">
<annotation>
<documentation>
- The class that implements <code>org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper</code> or extends <code>org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper</code>.
+ The class that implements <code>org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper</code> or extends <code>org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper</code>.
<p>
The stepper implementation class must be specified either by the class attribute or the class child element!
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper:org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper"/>
+ <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper:org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper"/>
</appinfo>
</annotation>
</attribute>
@@ -183,7 +183,7 @@ The stepper implementation class must be specified either by the class attribute <meta.section type="apiinfo"/>
</appinfo>
<documentation>
- The provider of a stepper must implement <samp>org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper</samp>.
+ The provider of a stepper must implement <samp>org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper</samp>.
</documentation>
</annotation>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/steps.exsd b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/steps.exsd index 54b8e55a8..deafedb30 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/steps.exsd +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/steps.exsd @@ -3,7 +3,7 @@ <schema targetNamespace="org.eclipse.tcf.te.runtime.stepper" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
- <meta.schema plugin="org.eclipse.tcf.te.runtime.stepper" id="steps" name="Steps"/>
+ <meta.schema plugin="org.eclipse.tcf.te.runtime.stepper" id="steps" name="Steps Extension Point"/>
</appinfo>
<documentation>
This extension point is used to contribute steps.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperManager.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperManager.java index c84d3da7a..9789297d4 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/StepperManager.java @@ -9,9 +9,10 @@ *******************************************************************************/
package org.eclipse.tcf.te.runtime.stepper;
-import org.eclipse.tcf.te.runtime.stepper.internal.extensions.StepExtensionPointManager;
-import org.eclipse.tcf.te.runtime.stepper.internal.extensions.StepGroupExtensionPointManager;
-import org.eclipse.tcf.te.runtime.stepper.internal.extensions.StepperExtensionPointManager;
+import org.eclipse.tcf.te.runtime.stepper.extensions.manager.StepBindingsExtensionPointManager;
+import org.eclipse.tcf.te.runtime.stepper.extensions.manager.StepExtensionPointManager;
+import org.eclipse.tcf.te.runtime.stepper.extensions.manager.StepGroupExtensionPointManager;
+import org.eclipse.tcf.te.runtime.stepper.extensions.manager.StepperExtensionPointManager;
/**
* Central manager providing access to the stepper, steps and step groups
@@ -20,6 +21,7 @@ import org.eclipse.tcf.te.runtime.stepper.internal.extensions.StepperExtensionPo public final class StepperManager {
// References to the extension point managers
private final StepExtensionPointManager stepExtManager = new StepExtensionPointManager();
+ private final StepBindingsExtensionPointManager stepBindingsExtManager = new StepBindingsExtensionPointManager();
private final StepperExtensionPointManager stepperExtManager = new StepperExtensionPointManager();
private final StepGroupExtensionPointManager stepGroupExtManager = new StepGroupExtensionPointManager();
@@ -70,4 +72,13 @@ public final class StepperManager { public StepGroupExtensionPointManager getStepGroupExtManager() {
return stepGroupExtManager;
}
+
+ /**
+ * Returns the step bindings extension point manager instance.
+ *
+ * @return The step bindings extension point manager instance.
+ */
+ public StepBindingsExtensionPointManager getStepBindingsExtManager() {
+ return stepBindingsExtManager;
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/AbstractContextStepper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/AbstractContextStepper.java index 5d430056f..48bea514b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/AbstractContextStepper.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/AbstractContextStepper.java @@ -37,9 +37,9 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepExecutor; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroupIterator; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroupable; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper; import org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedContextStep; import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId; -import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper; import org.eclipse.tcf.te.runtime.stepper.interfaces.tracing.ITraceIds; import org.eclipse.tcf.te.runtime.stepper.nls.Messages; import org.eclipse.tcf.te.runtime.utils.ProgressHelper; @@ -48,7 +48,7 @@ import org.eclipse.tcf.te.runtime.utils.StatusHelper; /** * An abstract stepper implementation. */ -public abstract class AbstractContextStepper extends ExecutableExtension implements IStepper, IContextManipulator { +public abstract class AbstractContextStepper extends ExecutableExtension implements IContextStepper, IContextManipulator { private boolean initialized = false; private boolean finished = false; @@ -87,7 +87,7 @@ public abstract class AbstractContextStepper extends ExecutableExtension impleme protected abstract String getName(); /** - * Returns the contexts the stepper is working with. + * Returns the contexts the stepper is associated with. * * @return An array of context objects or an empty list. */ @@ -120,7 +120,7 @@ public abstract class AbstractContextStepper extends ExecutableExtension impleme protected abstract IContextStepGroup getStepGroup(String id); /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper#initialize(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper#initialize(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor) */ @Override public final void initialize(IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws IllegalStateException { @@ -176,7 +176,7 @@ public abstract class AbstractContextStepper extends ExecutableExtension impleme } /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper#isInitialized() + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper#isInitialized() */ @Override public final boolean isInitialized() { @@ -315,7 +315,7 @@ public abstract class AbstractContextStepper extends ExecutableExtension impleme } /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper#isFinished() + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper#isFinished() */ @Override public final boolean isFinished() { @@ -323,7 +323,7 @@ public abstract class AbstractContextStepper extends ExecutableExtension impleme } /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper#cleanup() + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper#cleanup() */ @Override public void cleanup() { @@ -355,7 +355,7 @@ public abstract class AbstractContextStepper extends ExecutableExtension impleme } /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper#execute() + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper#execute() */ @Override public final void execute() throws CoreException { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/ContextStepGroup.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/ContextStepGroup.java index 59b8d3160..f61d8d0db 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/ContextStepGroup.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/ContextStepGroup.java @@ -58,6 +58,7 @@ public class ContextStepGroup extends AbstractContextStepGroup { private boolean singleton; private final List<String> dependencies = new ArrayList<String>(); + /** * Returns the id of the referenced step or step group. * @@ -590,7 +591,7 @@ public class ContextStepGroup extends AbstractContextStepGroup { )); } - // Check if the step is valid for the current launch configuration type and mode. + // Check if the step is valid for the current contexts. if (candidate instanceof IContextStep) { boolean valid = isValidStep(candidate.getId(), contexts); @@ -801,18 +802,16 @@ public class ContextStepGroup extends AbstractContextStepGroup { } /** - * Returns if or if not the step identified by the given id is valid. - * <p> - * <b>Note:</b> The default implementation returns always <code>true</code>. + * Returns if or if not the step identified by the given id is valid for + * the given contexts. * * @param id The step id. Must not be <code>null</code>. - * @param contexts The array of context objects. Must be not <code>null</code>. + * @param contexts The array of context objects or <code>null</code>. * * @return <code>True</code> if the step is valid, <code>false</code> otherwise. */ protected boolean isValidStep(String id, IContext[] contexts) { Assert.isNotNull(id); - Assert.isNotNull(contexts); - return true; + return StepperManager.getInstance().getStepBindingsExtManager().isStepEnabled(id, contexts); } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/ContextStepGroupable.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/ContextStepGroupable.java index 9486f248b..e52246d5c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/ContextStepGroupable.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/ContextStepGroupable.java @@ -14,8 +14,8 @@ import java.util.Arrays; import java.util.List; import org.eclipse.core.runtime.Assert; -import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroupable; import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroupable; /** * Context step groupable implementation. @@ -158,7 +158,7 @@ public class ContextStepGroupable implements IContextStepGroupable { } /** - * Sets if or if not the launch step is a singleton. Singleton steps can occur in step groups + * Sets if or if not the step is a singleton. Singleton steps can occur in step groups * only once. Multiple occurrences are forbidden. * * @param singleton Specify <code>true</code> if the step is a singleton, <code>false</code> otherwise. diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepBinding.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepBinding.java new file mode 100644 index 000000000..575602d27 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepBinding.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.runtime.stepper.extensions.manager; + +import org.eclipse.core.expressions.Expression; +import org.eclipse.core.expressions.ExpressionConverter; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension; + +/** + * Step binding implementation. + */ +public final class StepBinding extends ExecutableExtension { + // The mandatory step identifier + private String stepId; + // The converted expression + private Expression expression; + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.ExecutableExtension#doSetInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object) + */ + @Override + public void doSetInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { + super.doSetInitializationData(config, propertyName, data); + + // Initialize the step id field. + // Throws an exception if the step id is empty or null. + stepId = config != null ? config.getAttribute("stepId") : null; //$NON-NLS-1$ + if (stepId == null || (stepId != null && "".equals(stepId.trim()))) { //$NON-NLS-1$ + throw createMissingMandatoryAttributeException("stepId", config.getContributor().getName()); //$NON-NLS-1$ + } + + // Read the sub elements of the extension + IConfigurationElement[] children = config != null ? config.getChildren() : null; + // The "enablement" element is the only expected one + if (children != null && children.length > 0) { + expression = ExpressionConverter.getDefault().perform(children[0]); + } + } + + /** + * Returns the step id which is associated with this binding. + * + * @return The step id. + */ + public String getStepId() { + return stepId; + } + + /** + * Returns the enablement expression which is associated with this binding. + * + * @return The enablement expression or <code>null</code>. + */ + public Expression getEnablement() { + return expression; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepBindingsExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepBindingsExtensionPointManager.java new file mode 100644 index 000000000..3b491727c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepBindingsExtensionPointManager.java @@ -0,0 +1,185 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.runtime.stepper.extensions.manager; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.expressions.EvaluationContext; +import org.eclipse.core.expressions.EvaluationResult; +import org.eclipse.core.expressions.Expression; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager; +import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy; +import org.eclipse.tcf.te.runtime.stepper.activator.CoreBundleActivator; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContext; + + +/** + * Step bindings extension point manager implementation. + */ +public final class StepBindingsExtensionPointManager extends AbstractExtensionPointManager<StepBinding> { + + /** + * Constructor. + */ + public StepBindingsExtensionPointManager() { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId() + */ + @Override + protected String getExtensionPointId() { + return "org.eclipse.tcf.te.runtime.stepper.stepBindings"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getConfigurationElementName() + */ + @Override + protected String getConfigurationElementName() { + return "binding"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#doCreateExtensionProxy(org.eclipse.core.runtime.IConfigurationElement) + */ + @Override + protected ExecutableExtensionProxy<StepBinding> doCreateExtensionProxy(IConfigurationElement element) throws CoreException { + return new ExecutableExtensionProxy<StepBinding>(element) { + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy#newInstance() + */ + @Override + public StepBinding newInstance() { + StepBinding instance = new StepBinding(); + try { + instance.setInitializationData(getConfigurationElement(), null, null); + } catch (CoreException e) { + IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), + e.getLocalizedMessage(), e); + Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status); + } + return instance; + } + }; + } + + /** + * Returns if or if not the step identified by the given step id is enabled for the + * given context. + * <p> + * <b>Note:</b> A step is considered enabled if + * <ul> + * <li>There is no step binding contribution for the given step id. Or</li> + * <li>At least one of the bindings has not enablement sub element. Or</li> + * <li>At least one of the bindings enablement sub element evaluates to <code>true</code>.</li> + * </ul> + * + * @param stepId The step id. Must not be <code>null</code>. + * @param contexts The context objects or <code>null</code>. + * @return The list of applicable editor page bindings or an empty array. + */ + public boolean isStepEnabled(String stepId, IContext[] contexts) { + Assert.isNotNull(stepId); + + // Flag is set to true at the first binding matching the given step id + boolean hasStepBinding = false; + boolean enabled = false; + + for (StepBinding binding : getStepBindings()) { + // Ignore all bindings not matching the given step id. + if (!stepId.equals(binding.getStepId())) continue; + + // OK. There is at least one binding contribution for the given step id. + hasStepBinding = true; + + // Get the enablement. + Expression enablement = binding.getEnablement(); + + // The binding is applicable by default if no expression is specified. + enabled = enablement == null; + + if (enablement != null) { + if (contexts != null) { + // To satisfy the "isIterable" and "isCountable" needs of the expression + // evaluator, pass on the contexts as collection. + List<IContext> variableValue = Arrays.asList(contexts); + // Set the default variable to the context. + EvaluationContext evalContext = new EvaluationContext(null, variableValue); + // Initialize the evaluation context named variables + evalContext.addVariable("activeContexts", variableValue); //$NON-NLS-1$ + // Evaluate the expression + try { + enabled = enablement.evaluate(evalContext).equals(EvaluationResult.TRUE); + } catch (CoreException e) { + IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), + e.getLocalizedMessage(), e); + Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status); + } + } else { + // The enablement is false by definition if no context is given. + enabled = false; + } + } + + // Break the loop if the step is found enabled + if (enabled) break; + } + + return !hasStepBinding || enabled; + } + + /** + * Returns the list of all contributed step bindings. + * + * @return The list of contributed step bindings, or an empty array. + */ + public StepBinding[] getStepBindings() { + List<StepBinding> contributions = new ArrayList<StepBinding>(); + Collection<ExecutableExtensionProxy<StepBinding>> statusHandlerBindings = getExtensions().values(); + for (ExecutableExtensionProxy<StepBinding> statusHandlerBinding : statusHandlerBindings) { + StepBinding instance = statusHandlerBinding.getInstance(); + if (instance != null && !contributions.contains(instance)) { + contributions.add(instance); + } + } + + return contributions.toArray(new StepBinding[contributions.size()]); + } + + /** + * Returns the step binding identified by its unique id. If no step + * binding with the specified id is registered, <code>null</code> is returned. + * + * @param id The unique id of the step binding or <code>null</code> + * + * @return The step binding instance or <code>null</code>. + */ + public StepBinding getBinding(String id) { + StepBinding contribution = null; + if (getExtensions().containsKey(id)) { + ExecutableExtensionProxy<StepBinding> proxy = getExtensions().get(id); + // Get the extension instance + contribution = proxy.getInstance(); + } + + return contribution; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/extensions/StepExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepExtensionPointManager.java index 55fb31408..268dd214f 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/extensions/StepExtensionPointManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepExtensionPointManager.java @@ -7,21 +7,21 @@ * Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.stepper.internal.extensions;
+package org.eclipse.tcf.te.runtime.stepper.extensions.manager;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep;
import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep;
/**
* Step extension point manager implementation.
*/
-public class StepExtensionPointManager extends AbstractExtensionPointManager<IContextStep> {
+public final class StepExtensionPointManager extends AbstractExtensionPointManager<IContextStep> {
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId()
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/extensions/StepGroupExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepGroupExtensionPointManager.java index aaa9a55a8..589cc86ed 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/extensions/StepGroupExtensionPointManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepGroupExtensionPointManager.java @@ -7,21 +7,24 @@ * Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.stepper.internal.extensions;
+package org.eclipse.tcf.te.runtime.stepper.extensions.manager;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup;
import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup;
/**
* Step group extension manager implementation.
*/
-public class StepGroupExtensionPointManager extends AbstractExtensionPointManager<IContextStepGroup> {
+public final class StepGroupExtensionPointManager extends AbstractExtensionPointManager<IContextStepGroup> {
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId()
@@ -48,6 +51,27 @@ public class StepGroupExtensionPointManager extends AbstractExtensionPointManage }
/**
+ * Returns the list of all contributed step groups.
+ *
+ * @param unique If <code>true</code>, the method returns new instances for each
+ * contributed step group.
+ *
+ * @return The list of contributed step groups, or an empty array.
+ */
+ public IContextStepGroup[] getStepGroups(boolean unique) {
+ List<IContextStepGroup> contributions = new ArrayList<IContextStepGroup>();
+ Collection<ExecutableExtensionProxy<IContextStepGroup>> delegates = getExtensions().values();
+ for (ExecutableExtensionProxy<IContextStepGroup> delegate : delegates) {
+ IContextStepGroup instance = unique ? delegate.newInstance() : delegate.getInstance();
+ if (instance != null && !contributions.contains(instance)) {
+ contributions.add(instance);
+ }
+ }
+
+ return contributions.toArray(new IContextStepGroup[contributions.size()]);
+ }
+
+ /**
* Returns the step group identified by its unique id. If no step group with the specified id is
* registered, <code>null</code> is returned.
*
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/extensions/StepGroupExtensionProxy.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepGroupExtensionProxy.java index 91839ff4c..d7e97fe22 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/extensions/StepGroupExtensionProxy.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepGroupExtensionProxy.java @@ -7,7 +7,7 @@ * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ -package org.eclipse.tcf.te.runtime.stepper.internal.extensions; +package org.eclipse.tcf.te.runtime.stepper.extensions.manager; import java.util.ArrayList; import java.util.List; @@ -16,15 +16,15 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.Platform; +import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy; import org.eclipse.tcf.te.runtime.stepper.activator.CoreBundleActivator; import org.eclipse.tcf.te.runtime.stepper.extensions.ContextStepGroup; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup; -import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy; /** * Step group extension proxy implementation. */ -public class StepGroupExtensionProxy extends ExecutableExtensionProxy<IContextStepGroup> { +public final class StepGroupExtensionProxy extends ExecutableExtensionProxy<IContextStepGroup> { private List<IConfigurationElement> groupExtensions = new ArrayList<IConfigurationElement>(); /** diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/extensions/StepperExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepperExtensionPointManager.java index f7d46cec0..bc8e6484b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/extensions/StepperExtensionPointManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/manager/StepperExtensionPointManager.java @@ -7,21 +7,21 @@ * Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.runtime.stepper.internal.extensions;
+package org.eclipse.tcf.te.runtime.stepper.extensions.manager;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper;
import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper;
/**
* Stepper extension point manager implementation.
*/
-public class StepperExtensionPointManager extends AbstractExtensionPointManager<IStepper> {
+public final class StepperExtensionPointManager extends AbstractExtensionPointManager<IContextStepper> {
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId()
@@ -47,17 +47,17 @@ public class StepperExtensionPointManager extends AbstractExtensionPointManager< *
* @return The list of contributed stepper, or an empty array.
*/
- public IStepper[] getStepper(boolean unique) {
- List<IStepper> contributions = new ArrayList<IStepper>();
- Collection<ExecutableExtensionProxy<IStepper>> delegates = getExtensions().values();
- for (ExecutableExtensionProxy<IStepper> delegate : delegates) {
- IStepper instance = unique ? delegate.newInstance() : delegate.getInstance();
+ public IContextStepper[] getStepper(boolean unique) {
+ List<IContextStepper> contributions = new ArrayList<IContextStepper>();
+ Collection<ExecutableExtensionProxy<IContextStepper>> delegates = getExtensions().values();
+ for (ExecutableExtensionProxy<IContextStepper> delegate : delegates) {
+ IContextStepper instance = unique ? delegate.newInstance() : delegate.getInstance();
if (instance != null && !contributions.contains(instance)) {
contributions.add(instance);
}
}
- return contributions.toArray(new IStepper[contributions.size()]);
+ return contributions.toArray(new IContextStepper[contributions.size()]);
}
/**
@@ -69,11 +69,11 @@ public class StepperExtensionPointManager extends AbstractExtensionPointManager< *
* @return The stepper instance or <code>null</code>.
*/
- public IStepper getStepper(String id, boolean unique) {
+ public IContextStepper getStepper(String id, boolean unique) {
Assert.isNotNull(id);
- IStepper contribution = null;
+ IContextStepper contribution = null;
if (getExtensions().containsKey(id)) {
- ExecutableExtensionProxy<IStepper> proxy = getExtensions().get(id);
+ ExecutableExtensionProxy<IContextStepper> proxy = getExtensions().get(id);
// Get the extension instance
contribution = unique ? proxy.newInstance() : proxy.getInstance();
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStep.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStep.java index f7a1e359e..ee2f428bc 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStep.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStep.java @@ -22,8 +22,8 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; * finished, the passed in <b>callback must be invoked</b>. The parent launch * stepper suspend the step sequence execution till the callback is invoked. * <p> - * Context steps signals the execution state to the parent launch stepper via - * the <code>IStatus</code> object passed to the callback as first argument. + * Context steps signals the execution state to the parent stepper via the + * <code>IStatus</code> object passed to the callback as first argument. * The status object is mandatory and cannot be <code>null</code>. If the step * execution succeeds, an status with severity {@link IStatus#OK} is expected. */ diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStepGroupable.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStepGroupable.java index 89e21f93a..723dfde91 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStepGroupable.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStepGroupable.java @@ -73,7 +73,7 @@ public interface IContextStepGroupable { * If one of the listed dependencies have not been executed before, the execution of the * groupable will fail. * <p> - * The launch step or launch step group id might be fully qualified using the form + * The step or step group id might be fully qualified using the form * <code>"primaryId##secondaryId</code>. The <code>secondaryId</code> is optional. * * @return The list of dependencies or an empty list. diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStepper.java index 346181568..4e48b1e80 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepper.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStepper.java @@ -20,15 +20,14 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; /** * A stepper. * <p> - * Stepper are executing a set of steps and/or step groups read from a given type for the current - * sub type. The stepper is responsible for handling any exceptions which occurred during step - * execution. + * Stepper are executing a set of steps and/or step groups for the given context(s). The stepper is + * responsible for handling any exceptions which occurred during step execution. * <p> - * Stepper are synchronous where steps are asynchronous. + * <b>Note:</b> Stepper are synchronous where steps are asynchronous. * <p> * Stepper must run in worker threads. */ -public interface IStepper extends IExecutableExtension { +public interface IContextStepper extends IExecutableExtension { public static final String ID_TYPE_STEPPER_ID = "Stepper"; //$NON-NLS-1$ public static final String ID_TYPE_CONTEXT_ID = "Context"; //$NON-NLS-1$ @@ -40,14 +39,14 @@ public interface IStepper extends IExecutableExtension { * Condition Tester to test for finished execution of the associated stepper. */ public static class ExecutionFinishedConditionTester implements IConditionTester { - private final IStepper stepper; + private final IContextStepper stepper; /** * Constructor. * * @param stepper The stepper. Must not be <code>null</code>. */ - public ExecutionFinishedConditionTester(IStepper stepper) { + public ExecutionFinishedConditionTester(IContextStepper stepper) { Assert.isNotNull(stepper); this.stepper = stepper; } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStepperProperties.java index e4e1b694f..d648584c8 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperProperties.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IContextStepperProperties.java @@ -13,10 +13,10 @@ package org.eclipse.tcf.te.runtime.stepper.interfaces; * Common stepper configuration property definitions.
* <p>
* Stepper are configured by setting properties within the properties container passed to the stepper via the
- * {@link IStepper#initialize(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)}
+ * {@link IContextStepper#initialize(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)}
* call.
*/
-public interface IStepperProperties {
+public interface IContextStepperProperties {
/**
* The id of the step group to execute by the stepper.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/MultiContextStepper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/MultiContextStepper.java index e4181aa2a..52efff779 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/MultiContextStepper.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/MultiContextStepper.java @@ -21,7 +21,7 @@ import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContext; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextManipulator; import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId; -import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper; /** * A stepper implementation capable of handling multiple contexts. @@ -31,7 +31,7 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper; */ public class MultiContextStepper extends SingleContextStepper { - private List<IStepper> steppers = new ArrayList<IStepper>(); + private List<IContextStepper> steppers = new ArrayList<IContextStepper>(); public static final String CONTEXT_COUNT = "contextCount"; //$NON-NLS-1$ public static final String CONTEXT_INDEX = "contextIndex"; //$NON-NLS-1$ @@ -55,7 +55,7 @@ public class MultiContextStepper extends SingleContextStepper { if (context == null) continue; // Get the stepper to be used for this context object - IStepper stepper = getStepper(context); + IContextStepper stepper = getStepper(context); Assert.isNotNull(stepper); // Build up a new fully qualified id @@ -85,7 +85,7 @@ public class MultiContextStepper extends SingleContextStepper { * @param context The context. Must not be <code>null</code>. * @return The stepper instance. */ - protected IStepper getStepper(IContext context) { + protected IContextStepper getStepper(IContext context) { Assert.isNotNull(context); return new SingleContextStepper(); } @@ -97,7 +97,7 @@ public class MultiContextStepper extends SingleContextStepper { protected void internalExecute(List<IStatus> statusContainer) throws CoreException { int i = 0; StepperAttributeUtil.setProperty(CONTEXT_COUNT, null, getData(), steppers.size()); - for (IStepper stepper : steppers) { + for (IContextStepper stepper : steppers) { StepperAttributeUtil.setProperty(CONTEXT_INDEX, null, getData(), i++); try { stepper.execute(); @@ -118,7 +118,7 @@ public class MultiContextStepper extends SingleContextStepper { public void cleanup() { super.cleanup(); - for (IStepper stepper : steppers) { + for (IContextStepper stepper : steppers) { stepper.cleanup(); } steppers.clear(); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/SingleContextStepper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/SingleContextStepper.java index bea886638..6dabc167c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/SingleContextStepper.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/SingleContextStepper.java @@ -19,8 +19,8 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IContext; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepExecutor; import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepperProperties; import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId; -import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperProperties; import org.eclipse.tcf.te.runtime.stepper.interfaces.tracing.ITraceIds; /** @@ -31,7 +31,7 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.tracing.ITraceIds; * <li>The step group to execute needs to be passed to the stepper via the properties container * given by the {@link #onInitialize(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)} * call.</li> - * <li>The stepper executes single launch steps through {@link DefaultStepExecutor}. + * <li>The stepper executes single steps through {@link DefaultStepExecutor}. * <li>The stepper stops the step group execution if the progress monitor is set to canceled * or a status with severity {@link IStatus#CANCEL} is thrown by a single step. * <li>The stepper stops the step group execution on first error.</li> @@ -61,7 +61,7 @@ public class SingleContextStepper extends AbstractContextStepper { */ @Override protected String getName() { - return getData() != null ? getData().getStringProperty(IStepperProperties.PROP_NAME) : null; + return getData() != null ? getData().getStringProperty(IContextStepperProperties.PROP_NAME) : null; } /* (non-Javadoc) @@ -69,7 +69,7 @@ public class SingleContextStepper extends AbstractContextStepper { */ @Override protected IContext[] getContexts() { - return getData() != null && getData().getProperty(IStepperProperties.PROP_CONTEXTS) != null ? (IContext[])getData().getProperty(IStepperProperties.PROP_CONTEXTS) : new IContext[0]; + return getData() != null && getData().getProperty(IContextStepperProperties.PROP_CONTEXTS) != null ? (IContext[])getData().getProperty(IContextStepperProperties.PROP_CONTEXTS) : new IContext[0]; } /* (non-Javadoc) @@ -77,7 +77,7 @@ public class SingleContextStepper extends AbstractContextStepper { */ @Override protected String getStepGroupId() { - return getData() != null ? getData().getStringProperty(IStepperProperties.PROP_STEP_GROUP_ID) : null; + return getData() != null ? getData().getStringProperty(IContextStepperProperties.PROP_STEP_GROUP_ID) : null; } /* (non-Javadoc) diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml index 6229ad25f..364e7dd70 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/plugin.xml @@ -52,6 +52,7 @@ </parameter>
</class>
</step>
+
<step
class="org.eclipse.tcf.te.tests.stepper.TestStep"
id="org.eclipse.tcf.te.tests.stepper.step3"
@@ -60,6 +61,7 @@ Just another test step
</description>
</step>
+
<step
class="org.eclipse.tcf.te.tests.stepper.TestStep"
id="org.eclipse.tcf.te.tests.stepper.step4"
@@ -68,7 +70,119 @@ id="org.eclipse.tcf.te.tests.stepper.step1">
</requires>
</step>
+
+ <step
+ class="org.eclipse.tcf.te.tests.stepper.TestStep"
+ id="org.eclipse.tcf.te.tests.stepper.step5"
+ label="Test Step 5">
+ </step>
</extension>
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepBindings">
+ <binding
+ id="org.eclipse.tcf.te.tests.stepper.steps.binding1"
+ stepId="org.eclipse.tcf.te.tests.stepper.step5">
+ <enablement>
+ <with variable="activeContexts">
+ <count value="1"/>
+ </with>
+ </enablement>
+ </binding>
+ </extension>
+
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.stepper.stepGroup1"
+ label="Test Step Group 1"
+ locked="false">
+ </stepGroup>
+
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.stepper.stepGroup2"
+ label="Test Step Group 2"
+ locked="true">
+ <description>
+ Just a step group description
+ </description>
+ </stepGroup>
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.stepper.stepGroup3"
+ label="Test Step Group 3"
+ locked="false">
+ <references>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step1"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step2"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step3"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step4"
+ removable="true"
+ singleton="true">
+ </reference>
+ </references>
+ </stepGroup>
+
+ <stepGroup
+ id="org.eclipse.tcf.te.tests.stepper.stepGroup4"
+ label="Test Step Group 4"
+ locked="false">
+ <references>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step1"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step2"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step3"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step4"
+ removable="true"
+ singleton="true">
+ </reference>
+ <reference
+ disable="false"
+ hidden="false"
+ id="org.eclipse.tcf.te.tests.stepper.step5"
+ removable="true"
+ singleton="true">
+ </reference>
+ </references>
+ </stepGroup>
+ </extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTestCase.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTestCase.java index a4453a33a..8b3b96ed7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTestCase.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/stepper/StepperTestCase.java @@ -14,9 +14,13 @@ import java.util.Map; import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.tcf.te.runtime.stepper.StepperManager;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IContext;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroupable;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepper;
import org.eclipse.tcf.te.tests.CoreTestCase;
/**
@@ -50,8 +54,8 @@ public class StepperTestCase extends CoreTestCase { boolean multiContext = false;
boolean singleContext = false;
- IStepper[] steppers = StepperManager.getInstance().getStepperExtManager().getStepper(false);
- for (IStepper stepper : steppers) {
+ IContextStepper[] steppers = StepperManager.getInstance().getStepperExtManager().getStepper(false);
+ for (IContextStepper stepper : steppers) {
if (stepper.getId().equals("org.eclipse.tcf.te.runtime.stepper.multiContext")) { //$NON-NLS-1$
multiContext = true;
}
@@ -64,6 +68,9 @@ public class StepperTestCase extends CoreTestCase { assertTrue("Default single context stepper contribution not found.", singleContext); //$NON-NLS-1$
}
+ /**
+ * Test the steps extension point mechanism.
+ */
public void testStepContributions() {
assertNotNull("Unexpected return value 'null'.", StepperManager.getInstance()); //$NON-NLS-1$
assertNotNull("Unexpected return value 'null'.", StepperManager.getInstance().getStepExtManager()); //$NON-NLS-1$
@@ -83,6 +90,10 @@ public class StepperTestCase extends CoreTestCase { assertEquals("Unexpected step description found.", "", step.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue("Unexpected step class type found.", step instanceof TestStep); //$NON-NLS-1$
assertEquals("Unexpected number of dependencies found.", 0, step.getDependencies().length); //$NON-NLS-1$
+
+ assertTrue("Step is not enabled but should.", StepperManager.getInstance().getStepBindingsExtManager().isStepEnabled(step.getId(), null)); //$NON-NLS-1$
+ assertTrue("Step is not enabled but should.", StepperManager.getInstance().getStepBindingsExtManager().isStepEnabled(step.getId(), new IContext[0])); //$NON-NLS-1$
+ assertTrue("Step is not enabled but should.", StepperManager.getInstance().getStepBindingsExtManager().isStepEnabled(step.getId(), new IContext[1])); //$NON-NLS-1$
}
if (step.getId().endsWith(".step2")) { //$NON-NLS-1$
@@ -113,10 +124,142 @@ public class StepperTestCase extends CoreTestCase { assertEquals("Unexpected number of dependencies found.", 1, step.getDependencies().length); //$NON-NLS-1$
}
- }
+ if (step.getId().endsWith(".step5")) { //$NON-NLS-1$
+ assertEquals("Unexpected step label found.", "Test Step 5", step.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step description found.", "", step.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Unexpected step class type found.", step instanceof TestStep); //$NON-NLS-1$
+ assertEquals("Unexpected number of dependencies found.", 0, step.getDependencies().length); //$NON-NLS-1$
- assertEquals("Unexpected number of test steps found.", 4, testStepCount); //$NON-NLS-1$
+ assertFalse("Step is enabled but should not.", StepperManager.getInstance().getStepBindingsExtManager().isStepEnabled(step.getId(), null)); //$NON-NLS-1$
+ assertFalse("Step is enabled but should not.", StepperManager.getInstance().getStepBindingsExtManager().isStepEnabled(step.getId(), new IContext[0])); //$NON-NLS-1$
+ assertTrue("Step is not enabled but should.", StepperManager.getInstance().getStepBindingsExtManager().isStepEnabled(step.getId(), new IContext[1])); //$NON-NLS-1$
+ }
+ }
+ assertEquals("Unexpected number of test steps found.", 5, testStepCount); //$NON-NLS-1$
}
+ /**
+ * Test the step group extension point mechanism.
+ */
+ public void testStepGroupContributions() {
+ assertNotNull("Unexpected return value 'null'.", StepperManager.getInstance()); //$NON-NLS-1$
+ assertNotNull("Unexpected return value 'null'.", StepperManager.getInstance().getStepGroupExtManager()); //$NON-NLS-1$
+
+ IContextStepGroup[] stepGroups = StepperManager.getInstance().getStepGroupExtManager().getStepGroups(false);
+ int testStepGroupCount = 0;
+
+ for (IContextStepGroup stepGroup : stepGroups) {
+ if (stepGroup.getId().startsWith("org.eclipse.tcf.te.tests.stepper.stepGroup")) { //$NON-NLS-1$
+ testStepGroupCount++;
+ } else {
+ continue;
+ }
+
+ Throwable error = null;
+ String message = null;
+ IContextStepGroupable[] steps = null;
+
+ if (stepGroup.getId().endsWith(".stepGroup1")) { //$NON-NLS-1$
+ assertEquals("Unexpected step group label found.", "Test Step Group 1", stepGroup.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step description found.", "", stepGroup.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertFalse("Step group is locked but should not.", stepGroup.isLocked()); //$NON-NLS-1$
+ assertNull("Unexpected non-null value.", stepGroup.getStepGroupIterator()); //$NON-NLS-1$
+
+ try {
+ steps = stepGroup.getSteps(new IContext[0]);
+ } catch (CoreException e) {
+ error = e;
+ message = e.getLocalizedMessage();
+ }
+ assertNull("Failed to determine steps from step group. Possible cause: " + message, error); //$NON-NLS-1$
+ assertNotNull("Unexpected return value 'null'.", steps); //$NON-NLS-1$
+ assertEquals("Unexpected number of steps returned.", 0, steps.length); //$NON-NLS-1$
+ }
+
+ if (stepGroup.getId().endsWith(".stepGroup2")) { //$NON-NLS-1$
+ assertEquals("Unexpected step group label found.", "Test Step Group 2", stepGroup.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step description found.", "Just a step group description", stepGroup.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Step group is not locked but should.", stepGroup.isLocked()); //$NON-NLS-1$
+ assertNull("Unexpected non-null value.", stepGroup.getStepGroupIterator()); //$NON-NLS-1$
+
+ error = null; message = null; steps = null;
+ try {
+ steps = stepGroup.getSteps(new IContext[0]);
+ } catch (CoreException e) {
+ error = e;
+ message = e.getLocalizedMessage();
+ }
+ assertNull("Failed to determine steps from step group. Possible cause: " + message, error); //$NON-NLS-1$
+ assertNotNull("Unexpected return value 'null'.", steps); //$NON-NLS-1$
+ assertEquals("Unexpected number of steps returned.", 0, steps.length); //$NON-NLS-1$
+ }
+
+ if (stepGroup.getId().endsWith(".stepGroup3")) { //$NON-NLS-1$
+ assertEquals("Unexpected step group label found.", "Test Step Group 3", stepGroup.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step description found.", "", stepGroup.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertFalse("Step group is locked but should not.", stepGroup.isLocked()); //$NON-NLS-1$
+ assertNull("Unexpected non-null value.", stepGroup.getStepGroupIterator()); //$NON-NLS-1$
+
+ error = null; message = null; steps = null;
+ try {
+ steps = stepGroup.getSteps(new IContext[0]);
+ } catch (CoreException e) {
+ error = e;
+ message = e.getLocalizedMessage();
+ }
+ assertNull("Failed to determine steps from step group. Possible cause: " + message, error); //$NON-NLS-1$
+ assertNotNull("Unexpected return value 'null'.", steps); //$NON-NLS-1$
+ assertEquals("Unexpected number of steps returned.", 4, steps.length); //$NON-NLS-1$
+
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step1", steps[0].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step2", steps[1].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step3", steps[2].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step4", steps[3].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+ if (stepGroup.getId().endsWith(".stepGroup4")) { //$NON-NLS-1$
+ assertEquals("Unexpected step group label found.", "Test Step Group 4", stepGroup.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step description found.", "", stepGroup.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertFalse("Step group is locked but should not.", stepGroup.isLocked()); //$NON-NLS-1$
+ assertNull("Unexpected non-null value.", stepGroup.getStepGroupIterator()); //$NON-NLS-1$
+
+ error = null; message = null; steps = null;
+ try {
+ steps = stepGroup.getSteps(new IContext[0]);
+ } catch (CoreException e) {
+ error = e;
+ message = e.getLocalizedMessage();
+ }
+ assertNull("Failed to determine steps from step group. Possible cause: " + message, error); //$NON-NLS-1$
+ assertNotNull("Unexpected return value 'null'.", steps); //$NON-NLS-1$
+ assertEquals("Unexpected number of steps returned.", 4, steps.length); //$NON-NLS-1$
+
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step1", steps[0].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step2", steps[1].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step3", steps[2].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step4", steps[3].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ error = null; message = null; steps = null;
+ try {
+ steps = stepGroup.getSteps(new IContext[1]);
+ } catch (CoreException e) {
+ error = e;
+ message = e.getLocalizedMessage();
+ }
+ assertNull("Failed to determine steps from step group. Possible cause: " + message, error); //$NON-NLS-1$
+ assertNotNull("Unexpected return value 'null'.", steps); //$NON-NLS-1$
+ assertEquals("Unexpected number of steps returned.", 5, steps.length); //$NON-NLS-1$
+
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step1", steps[0].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step2", steps[1].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step3", steps[2].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step4", steps[3].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Unexpected step order.", "org.eclipse.tcf.te.tests.stepper.step5", steps[4].getExtension().getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ assertEquals("Unexpected number of test step groups found.", 4, testStepGroupCount); //$NON-NLS-1$
+ }
}
|