Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-04-09 07:03:28 +0000
committerTobias Schwarz2013-04-09 07:03:28 +0000
commit9042daf4c16e9bdc547056d76b0d5d2abe7887b7 (patch)
tree72653d4a73299d533b76a52f007456f8cdf13e40 /target_explorer/plugins/org.eclipse.tcf.te.launch.core
parentadeb4f2a4cbc9afb489cae44406cd10a6422e726 (diff)
downloadorg.eclipse.tcf-9042daf4c16e9bdc547056d76b0d5d2abe7887b7.tar.gz
org.eclipse.tcf-9042daf4c16e9bdc547056d76b0d5d2abe7887b7.tar.xz
org.eclipse.tcf-9042daf4c16e9bdc547056d76b0d5d2abe7887b7.zip
Target Explorer: rework stepper, reorder steps
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.launch.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchContextLaunchAttributes.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java183
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/RemoveLaunchStep.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/AbstractLaunchStepGroupIterator.java160
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java135
6 files changed, 265 insertions, 231 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java
index 41e5ba5cb..163fb8f76 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/IFileTransferLaunchAttributes.java
@@ -20,9 +20,4 @@ public interface IFileTransferLaunchAttributes {
* this attribute within a launch configuration.
*/
public static final String ATTR_FILE_TRANSFERS = ICommonLaunchAttributes.ATTR_PREFIX + ".file_transfers"; //$NON-NLS-1$
-
- /**
- * Launch attribute: The file transfer item the launch is currently operating with.
- */
- public static final String ATTR_ACTIVE_FILE_TRANSFER = ICommonLaunchAttributes.ATTR_PREFIX + ".file_transfer"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchContextLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchContextLaunchAttributes.java
index 76efd9f79..ef5fba737 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchContextLaunchAttributes.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchContextLaunchAttributes.java
@@ -15,11 +15,6 @@ package org.eclipse.tcf.te.launch.core.lm.interfaces;
public interface ILaunchContextLaunchAttributes {
/**
- * Launch configuration attribute: The active launch context the launch is operating with.
- */
- public static final String ATTR_ACTIVE_LAUNCH_CONTEXT = ICommonLaunchAttributes.ATTR_PREFIX + ".active_launch_context"; //$NON-NLS-1$
-
- /**
* Launch configuration attribute: The launch contexts the launch is operating with. Use
* {@link ContextSelectorPersistanceDelegate} to access
* this attribute within a launch configuration.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java
index c3a2b3cf4..2ba6e64a6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/AbstractLaunchStep.java
@@ -1,75 +1,108 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.launch.core.steps;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
-import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractStep;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-
-/**
- * Abstract launch step implementation.
- */
-public abstract class AbstractLaunchStep extends AbstractStep {
-
- /**
- * Returns the launch object for the given step context.
- *
- * @param context The step context.
- * @return The launch or <code>null</code>.
- */
- protected ILaunch getLaunch(IStepContext context) {
- Assert.isNotNull(context);
- return (ILaunch)context.getAdapter(ILaunch.class);
- }
-
- /**
- * Returns the current launch mode.
- *
- * @param context The step context.
- * @return The launch mode or <code>null</code>.
- */
- protected String getLaunchMode(IStepContext context) {
- ILaunch launch = getLaunch(context);
- return launch != null ? launch.getLaunchMode() : null;
- }
-
- /**
- * Returns the active launch context model node that is currently used.
- *
- * @param data The data giving object. Must not be <code>null</code>.
- * @return The active launch context model node.
- */
- protected IModelNode getActiveLaunchContext(IFullQualifiedId fullQualifiedId, IPropertiesContainer data) {
- Assert.isNotNull(data);
- Assert.isNotNull(fullQualifiedId);
- Object context = StepperAttributeUtil.getProperty(ILaunchContextLaunchAttributes.ATTR_ACTIVE_LAUNCH_CONTEXT, fullQualifiedId, data);
- Assert.isTrue(context instanceof IModelNode);
- return (IModelNode)context;
- }
-
- /**
- * Returns the uses launch configuration.
- *
- * @param context The step context.
- * @return
- */
- protected ILaunchConfiguration getLaunchConfiguration(IStepContext context) {
- ILaunch launch = getLaunch(context);
- Assert.isNotNull(launch);
- return launch.getLaunchConfiguration();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.launch.core.steps;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.tcf.te.launch.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep;
+
+/**
+ * Abstract launch step implementation.
+ */
+public abstract class AbstractLaunchStep extends AbstractStep {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ if (getLaunch(context) == null) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing launch context")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Returns the launch object for the given step context.
+ *
+ * @param context The step context.
+ * @return The launch or <code>null</code>.
+ */
+ protected ILaunch getLaunch(IStepContext context) {
+ Assert.isNotNull(context);
+ return (ILaunch)context.getAdapter(ILaunch.class);
+ }
+
+ /**
+ * Returns the launch configuration for the given step context.
+ *
+ * @param context The step context.
+ * @return The launch configuration or <code>null</code>.
+ */
+ protected ILaunchConfiguration getLaunchConfiguration(IStepContext context) {
+ Assert.isNotNull(context);
+ return (ILaunchConfiguration)context.getAdapter(ILaunchConfiguration.class);
+ }
+
+ /**
+ * Returns the launch configuration type for the given step context.
+ *
+ * @param context The step context.
+ * @return The launch configuration type or <code>null</code>.
+ */
+ protected ILaunchConfigurationType getLaunchConfigurationType(IStepContext context) {
+ Assert.isNotNull(context);
+ return (ILaunchConfigurationType)context.getAdapter(ILaunchConfigurationType.class);
+ }
+
+ /**
+ * Returns the current launch mode.
+ *
+ * @param context The step context.
+ * @return The launch mode or <code>null</code>.
+ */
+ protected String getLaunchMode(IStepContext context) {
+ ILaunch launch = getLaunch(context);
+ return launch != null ? launch.getLaunchMode() : null;
+ }
+
+ /**
+ * Returns the active model node context that is currently used.
+ *
+ * @param context The step context. Must not be <code>null</code>.
+ * @param data The data giving object. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualfied id for this step. Must not be <code>null</code>.
+ * @return The active model node context.
+ */
+ protected IModelNode getActiveModelNodeContext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId) {
+ Object activeContext = getActiveContext(context, data, fullQualifiedId);
+ IModelNode modelNode = null;
+ if (activeContext instanceof IModelNode)
+ return (IModelNode)activeContext;
+ if (activeContext instanceof IAdaptable)
+ modelNode = (IModelNode)((IAdaptable)activeContext).getAdapter(IModelNode.class);
+ if (modelNode == null)
+ modelNode = (IModelNode)Platform.getAdapterManager().getAdapter(activeContext, IModelNode.class);
+
+ return modelNode;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/RemoveLaunchStep.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/RemoveLaunchStep.java
index 978018fbb..3f5d7ffa2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/RemoveLaunchStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/RemoveLaunchStep.java
@@ -9,7 +9,6 @@
*******************************************************************************/
package org.eclipse.tcf.te.launch.core.steps;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
@@ -30,13 +29,6 @@ public class RemoveLaunchStep extends AbstractLaunchStep {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- }
-
- /* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
*/
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/AbstractLaunchStepGroupIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/AbstractLaunchStepGroupIterator.java
index 37d5c8860..8f574e1f6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/AbstractLaunchStepGroupIterator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/AbstractLaunchStepGroupIterator.java
@@ -1,66 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.launch.core.steps.iterators;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
-import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator;
-
-/**
- * Abstract launch stepgroup iterator.
- */
-public abstract class AbstractLaunchStepGroupIterator extends ExecutableExtension implements IStepGroupIterator {
-
- /**
- * Returns the launch object for the given step context.
- *
- * @param context The step context.
- * @return The launch or <code>null</code>.
- */
- protected ILaunch getLaunch(IStepContext context) {
- Assert.isNotNull(context);
- return (ILaunch)context.getAdapter(ILaunch.class);
- }
-
- /**
- * Returns the active launch context model node that is currently used.
- *
- * @param data The data giving object. Must not be <code>null</code>.
- * @return The active launch context model node.
- */
- protected IModelNode getActiveLaunchContext(IFullQualifiedId fullQualifiedId, IPropertiesContainer data) {
- Assert.isNotNull(data);
- Assert.isNotNull(fullQualifiedId);
- Object context = StepperAttributeUtil.getProperty(ILaunchContextLaunchAttributes.ATTR_ACTIVE_LAUNCH_CONTEXT, fullQualifiedId, data);
- Assert.isTrue(context instanceof IModelNode);
- return (IModelNode)context;
- }
-
- /**
- * Returns the uses launch configuration.
- *
- * @param context The step context.
- * @return
- */
- protected ILaunchConfiguration getLaunchConfiguration(IStepContext context) {
- ILaunch launch = getLaunch(context);
- Assert.isNotNull(launch);
- return launch.getLaunchConfiguration();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.launch.core.steps.iterators;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator;
+
+/**
+ * Abstract launch stepgroup iterator.
+ */
+public abstract class AbstractLaunchStepGroupIterator extends AbstractStepGroupIterator {
+
+ /**
+ * Returns the launch object for the given step context.
+ *
+ * @param context The step context.
+ * @return The launch or <code>null</code>.
+ */
+ protected ILaunch getLaunch(IStepContext context) {
+ Assert.isNotNull(context);
+ return (ILaunch)context.getAdapter(ILaunch.class);
+ }
+
+ /**
+ * Returns the launch configuration for the given step context.
+ *
+ * @param context The step context.
+ * @return The launch configuration or <code>null</code>.
+ */
+ protected ILaunchConfiguration getLaunchConfiguration(IStepContext context) {
+ Assert.isNotNull(context);
+ return (ILaunchConfiguration)context.getAdapter(ILaunchConfiguration.class);
+ }
+
+ /**
+ * Returns the launch configuration type for the given step context.
+ *
+ * @param context The step context.
+ * @return The launch configuration type or <code>null</code>.
+ */
+ protected ILaunchConfigurationType getLaunchConfigurationType(IStepContext context) {
+ Assert.isNotNull(context);
+ return (ILaunchConfigurationType)context.getAdapter(ILaunchConfigurationType.class);
+ }
+
+ /**
+ * Returns the current launch mode.
+ *
+ * @param context The step context.
+ * @return The launch mode or <code>null</code>.
+ */
+ protected String getLaunchMode(IStepContext context) {
+ ILaunch launch = getLaunch(context);
+ return launch != null ? launch.getLaunchMode() : null;
+ }
+
+ /**
+ * Returns the active model node context that is currently used.
+ *
+ * @param context The step context. Must not be <code>null</code>.
+ * @param data The data giving object. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualfied id for this step. Must not be <code>null</code>.
+ * @return The active model node context.
+ */
+ protected IModelNode getActiveModelNodeContext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId) {
+ Object activeContext = getActiveContext(context, data, fullQualifiedId);
+ IModelNode modelNode = null;
+ if (activeContext instanceof IModelNode)
+ return (IModelNode)activeContext;
+ if (activeContext instanceof IAdaptable)
+ modelNode = (IModelNode)((IAdaptable)activeContext).getAdapter(IModelNode.class);
+ if (modelNode == null)
+ modelNode = (IModelNode)Platform.getAdapterManager().getAdapter(activeContext, IModelNode.class);
+
+ return modelNode;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java
index 9f046984d..424a154a6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java
@@ -1,72 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.launch.core.steps.iterators;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.te.launch.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
-import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-
-/**
- * LaunchContextIterator
- */
-public class LaunchContextIterator extends AbstractLaunchStepGroupIterator {
-
- private IModelNode[] contexts = null;
- private int iteration = -1;
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
- contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(getLaunchConfiguration(context));
- iteration = 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#getNumIterations()
- */
- @Override
- public int getNumIterations() {
- return contexts != null ? contexts.length : 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#hasNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public boolean hasNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
- return iteration < getNumIterations();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- if (iteration < 0) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "iterator not initialized")); //$NON-NLS-1$
- }
- if (iteration >= getNumIterations()) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "no more iterations")); //$NON-NLS-1$
- }
- StepperAttributeUtil.setProperty(ILaunchContextLaunchAttributes.ATTR_ACTIVE_LAUNCH_CONTEXT, fullQualifiedId, data, contexts[iteration++]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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.launch.core.steps.iterators;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.launch.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+
+/**
+ * LaunchContextIterator
+ */
+public class LaunchContextIterator extends AbstractLaunchStepGroupIterator {
+
+ private IModelNode[] contexts = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
+ super.initialize(context, data, fullQualifiedId, monitor);
+ contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(getLaunchConfiguration(context));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#getNumIterations()
+ */
+ @Override
+ public int getNumIterations() {
+ return contexts != null ? contexts.length : 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ if (getIteration() < 0) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "iterator not initialized")); //$NON-NLS-1$
+ }
+ if (getIteration() >= getNumIterations()) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "no more iterations")); //$NON-NLS-1$
+ }
+ setActiveContext(contexts[getIteration()], data, fullQualifiedId);
+
+ super.next(context, data, fullQualifiedId, monitor);
+ }
+}

Back to the top