Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/PropertyTester.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java874
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java25
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/LaunchNodePropertyTester.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml105
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeContentProvider.java36
10 files changed, 576 insertions, 540 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/PropertyTester.java
index a27ca43e7..6b36311ac 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/PropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/PropertyTester.java
@@ -10,6 +10,7 @@
package org.eclipse.tcf.te.launch.core.bindings.internal;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
@@ -41,6 +42,9 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
if (receiver instanceof IModelNodeProvider) {
selContext = new RemoteSelectionContext(((IModelNodeProvider)receiver).getModelNode(), true);
}
+ else if (receiver instanceof IResource) {
+ selContext = new ProjectSelectionContext(((IResource)receiver).getProject(), true);
+ }
else if (receiver instanceof IProject) {
selContext = new ProjectSelectionContext((IProject)receiver, true);
}
@@ -49,9 +53,17 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
if (project != null) {
selContext = new ProjectSelectionContext(project, true);
}
- IModelNode modelNode = (IModelNode)((IAdaptable)receiver).getAdapter(IModelNode.class);
- if (modelNode != null) {
- selContext = new RemoteSelectionContext(modelNode, true);
+ else {
+ IResource resource = (IResource)((IAdaptable)receiver).getAdapter(IResource.class);
+ if (resource != null) {
+ selContext = new ProjectSelectionContext(resource.getProject(), true);
+ }
+ else {
+ IModelNode modelNode = (IModelNode)((IAdaptable)receiver).getAdapter(IModelNode.class);
+ if (modelNode != null) {
+ selContext = new RemoteSelectionContext(modelNode, true);
+ }
+ }
}
}
if (selContext != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java
index 7ffb5d7de..23cb4e8bf 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java
@@ -1,437 +1,437 @@
-/*******************************************************************************
- * 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.lm;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.launch.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
-import org.eclipse.tcf.te.launch.core.exceptions.LaunchServiceException;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchAttribute;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
-import org.eclipse.tcf.te.launch.core.nls.Messages;
-
-/**
- * The Launch Manager is the management interface for the launch configuration storage layer.
- * Through the launch manager, launch configuration of the several types can be accessed, searched
- * and initialized. For every possible launch configuration type, a corresponding launch manager
- * delegate must be registered which is responsible for handling the corresponding attributes of the
- * specific launch configuration type. In the case the no launch manager delegate is registered for
- * a launch configuration type, the launch configuration will not be initialized and therefore will
- * not have any default attribute. If more than one launch manager delegates are contributed for the
- * same launch configuration type, the first registered launch manager delegates will be used and the
- * registration of any other delegate for this type will fail!
- */
-public class LaunchManager extends PlatformObject {
-
- /*
- * Thread save singleton instance creation.
- */
- private static class LazyInstanceHolder {
- public static LaunchManager instance = new LaunchManager();
- }
-
- /**
- * Returns the singleton instance for the manager.
- */
- public static LaunchManager getInstance() {
- return LazyInstanceHolder.instance;
- }
-
- /**
- * Constructor.
- */
- LaunchManager() {
- super();
- }
-
- /**
- * Returns the corresponding launch manager delegate instance responsible for the specified
- * launch configuration type. The method may return a default launch manager delegate if no
- * specific launch manager delegate is registered for the specified launch configuration type.
- *
- * @param launchConfigType The launch configuration type to get the launch manager delegate for.
- * Must not be <code>null</code>!
- * @param launchMode The launch mode to get the launch manager delegate for. Must not be
- * <code>null</code>.
- * @return The corresponding launch manager delegate instance.
- */
- public ILaunchManagerDelegate getLaunchManagerDelegate(ILaunchConfigurationType launchConfigType, String launchMode) {
- Assert.isNotNull(launchConfigType);
- Assert.isNotNull(launchMode);
- return LaunchConfigTypeBindingsManager.getInstance().getLaunchManagerDelegate(launchConfigType.getIdentifier(), launchMode);
- }
-
- /**
- * Returns the corresponding launch configuration type for the given launch configuration type
- * id and the given launch mode.
- *
- * @param launchConfigTypeId The unique id of the launch configuration type requested.
- * @param launchMode The launch mode the launch configuration type must support. See
- * <code>org.eclipse.debug.core.ILaunchManager</code> for details.
- * @return The corresponding launch configuration type instance or <code>null</code> if not
- * found or the specified mode is not supported.
- */
- public ILaunchConfigurationType getLaunchConfigType(String launchConfigTypeId, String launchMode) {
- ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager()
- .getLaunchConfigurationType(launchConfigTypeId);
- if (launchConfigType != null && !launchConfigType.supportsMode(launchMode)) {
- launchConfigType = null;
- }
- return launchConfigType;
- }
-
- /**
- * Returns an fully initialized launch configuration. The launch configuration type and the
- * launch mode required to create or look up the launch configuration, are specified through the
- * given launch specification. Any launch configuration attribute of the certain type which is
- * not explicitly overwritten by an attribute specified through the given launch specification
- * will be initialized with default values.
- * <p>
- * If <code>forceNewConfig</code> is <code>false</code>, the method tries to find a matching
- * existing launch configuration. If no existing launch configuration can be found, a new
- * launch configuration will created instead.
- *
- * @param launchSpec A set of non default launch configuration attributes. Must not be
- * <code>null</code>, but the list of attributes may empty to get an launch
- * configuration with all attributes initialized to default values.
- * @param createNew If <code>true</code>, a new launch configuration will be created if no
- * available is found.
- * @return The launch configuration instance matching the given parameters.
- * @throws <code>LaunchServiceException</code> in case the launch configuration instance
- * cannot be created, found and/or modified. The exception message describes the failure
- * details.
- */
- public ILaunchConfiguration getLaunchConfiguration(ILaunchSpecification launchSpec, boolean createNew) throws LaunchServiceException {
- Assert.isNotNull(launchSpec);
-
- ILaunchConfiguration launchConfig = null;
- try {
- // get all launch configurations for launch configuration type id and launch mode
- String launchConfigTypeId = launchSpec.getLaunchConfigurationTypeId();
- String launchMode = launchSpec.getLaunchMode();
- ILaunchConfigurationType launchConfigType = getLaunchConfigType(launchConfigTypeId, launchMode);
- ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
- .getLaunchConfigurations(launchConfigType);
-
- // get list of fully and closest matching launch configurations
- ILaunchConfiguration[] matchingConfigs = getLaunchManagerDelegate(launchConfigType, launchMode)
- .getMatchingLaunchConfigurations(launchSpec, configs);
-
- // return best matching launch configuration
- if (matchingConfigs.length > 0) {
- launchConfig = matchingConfigs[0];
- }
- }
- catch (LaunchServiceException e) {
- if (e.getType() == LaunchServiceException.TYPE_MISSING_LAUNCH_SPEC_ATTR) {
- throw e;
- }
- }
- catch (CoreException e) {
- throw new LaunchServiceException(e.getMessage());
- }
- // return new launch configuration if no matching or best matching configuration is found
- if (createNew && launchConfig == null) {
- launchConfig = createOrUpdateLaunchConfiguration(null, launchSpec);
- }
- return launchConfig;
- }
-
- /**
- * Create a new or updates an existing launch configuration of the requested type and initialize
- * the configuration with the given launch specification. Attributes not listed by the given
- * launch specification will be initialized with default values.
- *
- * @param launchConfig A launch configuration to update or <code>null</code> if a new launch
- * configuration should be created.
- * @param launchSpec A set of non default launch configuration attributes.
- * @return The newly create launch configuration instance.
- *
- * @throws <code>LaunchServiceException</code> in case the launch configuration instance
- * cannot be created or mandatory attributes are missing in the launch specification.
- * The exception message describes the failure details.
- */
- public ILaunchConfiguration createOrUpdateLaunchConfiguration(ILaunchConfiguration launchConfig, ILaunchSpecification launchSpec) throws LaunchServiceException {
- return this.createOrUpdateLaunchConfiguration(launchConfig, launchSpec, true);
- }
-
- /**
- * Create a new or updates an existing launch configuration of the requested type and initialize
- * the configuration with the given launch specification. Attributes not listed by the given
- * launch specification will be initialized with default values.
- *
- * @param launchConfig A launch configuration to update or <code>null</code> if a new launch
- * configuration should be created.
- * @param launchSpec A set of non default launch configuration attributes.
- * @param validateSpec Validate the launch specification in the <code>launchSpec</code>
- * parameter. If <code>false</code>, it will attempt to create the launch
- * configuration even if some of the mandatory parameters are missing.
- * @return The newly create launch configuration instance.
- *
- * @throws <code>LaunchServiceException</code> in case the launch configuration instance
- * cannot be created or mandatory attributes are missing in the launch specification.
- * The exception message describes the failure details.
- *
- * @since 3.2
- */
- public ILaunchConfiguration createOrUpdateLaunchConfiguration(ILaunchConfiguration launchConfig, ILaunchSpecification launchSpec, boolean validateSpec) throws LaunchServiceException {
- Assert.isNotNull(launchSpec);
-
- String launchConfigTypeId = launchSpec.getLaunchConfigurationTypeId();
- String launchMode = launchSpec.getLaunchMode();
-
- ILaunchConfigurationType launchConfigType = getLaunchConfigType(launchConfigTypeId, launchMode);
- try {
- if (launchConfigType != null) {
- // get the launch manager delegate instance for the requested launch configuration
- // type
- ILaunchManagerDelegate delegate = getLaunchManagerDelegate(launchConfigType, launchMode);
- if (validateSpec) {
- delegate.validate(launchSpec);
- }
- ILaunchConfigurationWorkingCopy wc = null;
- if (launchConfig == null || !launchConfig.getType().getIdentifier()
- .equals(launchConfigTypeId)) {
- try {
- // create the launch configuration working copy instance
- wc = launchConfigType.newInstance(null, DebugPlugin
- .getDefault()
- .getLaunchManager()
- .generateLaunchConfigurationName(launchSpec
- .getLaunchConfigName()));
- // initialize the launch configuration working copy
- delegate.initLaunchConfigAttributes(wc, launchSpec);
- // and save the launch configuration
- return wc.doSave();
- }
- catch (CoreException e) {
- throw new LaunchServiceException(Messages.LaunchManager_error_failedToCreateConfig);
- }
- }
- try {
- // get a launch configration working copy
- if (launchConfig instanceof ILaunchConfigurationWorkingCopy) {
- wc = (ILaunchConfigurationWorkingCopy) launchConfig;
- }
- else {
- wc = launchConfig.getWorkingCopy();
- }
- // update the launch configuration working copy
- delegate.updateLaunchConfigAttributes(wc, launchSpec);
- // and save the launch configuration
- return (wc.isDirty()) ? wc.doSave() : launchConfig;
- }
- catch (CoreException e) {
- throw new LaunchServiceException(NLS.bind(Messages.LaunchManager_error_failedToUpdateConfig, launchConfig.getName()));
- }
- }
- }
- catch (CoreException e) {
- // do nothing, because exception is thrown afterwards if this point is reached.
- }
- throw new LaunchServiceException(NLS.bind(Messages.LaunchManager_error_noLaunchConfigType, launchMode));
- }
-
- /**
- * Delete the specified launch configuration.
- * <p>
- * In case any error occurs during the delete, the exception is logged to the Eclipse error log.
- *
- * @param launchConfig The launch configuration to delete.
- */
- public void deleteLaunchConfiguration(ILaunchConfiguration launchConfig) {
- if (launchConfig != null) {
- try {
- launchConfig.delete();
- }
- catch (CoreException e) {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(),
- Messages.LaunchManager_error_deleteLaunchConfig, e);
- Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
- }
- }
- }
-
- /**
- * Creates an exact copy of the given launch specification.
- * <p>
- * <b>Note:</b> The method returns always an launch specification which has not locked out
- * modifications. The corresponding read-only flag from the original is not duplicated to the
- * copy!
- *
- * @param launchSpec The launch specification to duplication.
- * @return A new <code>ILaunchSpecification</code> instance containing the same data as the
- * original, or <code>null</code>.
- */
- public ILaunchSpecification duplicate(ILaunchSpecification launchSpec) {
- if (launchSpec != null) {
- ILaunchSpecification newLaunchSpec = new LaunchSpecification(launchSpec.getLaunchConfigurationTypeId(), launchSpec.getLaunchMode());
- if (!launchSpec.isEmpty()) {
- ILaunchAttribute[] attributes = launchSpec.getAllAttributes();
- for (ILaunchAttribute attribute : attributes) {
- newLaunchSpec.addAttribute(attribute.getKey(), attribute.getValue());
- }
- }
- return newLaunchSpec;
- }
- return null;
- }
-
- /**
- * Validates a launch configuration.
- *
- * @param launchConfig The launch configuration to validate.
- * @param launchMode The launch mode. Can be <code>null</code>, in this case the launch configuration
- * is valid when valid for all supported modes.
- * @return <code>true</code>, if the launch configuration is valid and can be executed (launched).
- */
- public boolean validate(ILaunchConfiguration launchConfig, String launchMode) {
- try {
- if (launchMode == null) {
- boolean valid = false;
- for (String mode : LaunchConfigHelper.getLaunchConfigTypeModes(launchConfig.getType(), false)) {
- if (launchConfig.supportsMode(mode) && validate(launchConfig, mode)) {
- valid = true;
- }
- }
- return valid;
- }
- ILaunchManagerDelegate delegate = getLaunchManagerDelegate(launchConfig.getType(), launchMode);
- try {
- delegate.validate(launchMode, launchConfig);
- }
- catch (LaunchServiceException e) {
- return false;
- }
-
- }
- catch (CoreException e) {
- }
- return true;
- }
-
- /**
- * Transform the specified launch configuration into a corresponding launch specification
- * object. If <code>withDefaultAttributes</code> is not set, the corresponding launch manager
- * delegate is called to determine if an attribute has a default value or not. If the attribute
- * has an default value, this attribute is not copied to the launch specification. If
- * <code>withDefaultAttributes</code> is set, all attributes are copied to the launch
- * specification object.
- *
- * @param launchConfig The launch configuration. Must not be <code>null</code>.
- * @param launchMode The launch mode the launch specification should be for. See
- * <code>ILaunchManager</code> for details.
- * @param withDefaultAttributes Set to <code>true</code> to copy attributes with default value
- * as well, <code>false</code> otherwise.
- *
- * @return The corresponding launch specification object or <code>null</code>.
- *
- * @throws <code>LaunchServiceException</code> in case the launch configuration could not be
- * transformed to a launch specification. The exception message describes the failure
- * details.
- */
- public ILaunchSpecification createSpecFromConfig(ILaunchConfiguration launchConfig, String launchMode, boolean withDefaultAttributes) throws LaunchServiceException {
- Assert.isNotNull(launchConfig);
-
- ILaunchSpecification spec = null;
- try {
- // extract the launch configuration type
- ILaunchConfigurationType type = launchConfig.getType();
- spec = new LaunchSpecification(type.getIdentifier(), launchMode);
- // get the launch manager delegate for the specific type
- ILaunchManagerDelegate delegate = getLaunchManagerDelegate(type, launchMode);
- // get all the launch configuration attributes
- Map<String, Object> attributes = launchConfig.getAttributes();
- // loop over all listed attributes and copy them to the specification
- Iterator<Entry<String, Object>> iterator = attributes.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry<String, Object> entry = iterator.next();
- if (withDefaultAttributes) {
- // include the default attributes. So, just copy the stuff over.
- spec.addAttribute(entry.getKey(), entry.getValue());
- }
- else {
- // exclude the default attributes. We have to find out if the attribute is
- // set with default value.
- Object attributeValue = entry.getValue();
- if (!delegate.isDefaultAttribute(entry.getKey(), attributeValue, launchConfig, launchMode)) {
- spec.addAttribute(entry.getKey(), attributeValue);
- }
- }
- }
- }
- catch (CoreException e) {
- spec = null;
- throw new LaunchServiceException(e);
- }
- return spec;
- }
-
- /**
- * Launch the specified launch configuration using the corresponding delegate for the specified
- * launch mode. If <code>buildBeforeLaunch</code> is set to <code>true</code>, the workspace
- * will be build before the launch.
- *
- * @param launchConfig The launch configuration to launch. Must not be <code>null</code>!
- * @param launchMode The launch mode (@see <code>org.eclipse.debug.core.ILaunchManager</code>.
- * Must not be <code>null</code>!
- * @param buildBeforeLaunch Specify <code>true</code> to build the workspace before launch,
- * <code>false</code> otherwise.
- *
- * @return The corresponding <code>ILaunch</code> object associated with this launch.
- *
- * @throws <code>LaunchServiceException</code> in case of any problem occurs during the launch sequence.
- */
- public ILaunch launch(ILaunchConfiguration launchConfig, String launchMode, boolean buildBeforeLaunch, IProgressMonitor monitor) throws LaunchServiceException {
- Assert.isNotNull(launchConfig);
- Assert.isNotNull(launchMode);
-
- try {
- ILaunchManagerDelegate delegate = getLaunchManagerDelegate(launchConfig.getType(), launchMode);
- delegate.validate(launchMode, launchConfig);
- return launchConfig.launch(launchMode, monitor, buildBeforeLaunch);
- }
- catch (CoreException e) {
- // re-pack into a launch service exception
- throw new LaunchServiceException(e);
- }
- }
-
- /**
- * Remove all illegal characters in the launch configuration name candidate.
- *
- * @param candidate The launch configuration name candidate.
- * @return The unified launch configuration name.
- */
- public static String getUnifiedLaunchConfigName(String candidate) {
- if (candidate != null) {
- candidate = candidate.replaceAll("[/\\\"&?:@*]", "_"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return candidate;
- }
-
-}
+/*******************************************************************************
+ * 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.lm;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.launch.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
+import org.eclipse.tcf.te.launch.core.exceptions.LaunchServiceException;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchAttribute;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
+import org.eclipse.tcf.te.launch.core.nls.Messages;
+
+/**
+ * The Launch Manager is the management interface for the launch configuration storage layer.
+ * Through the launch manager, launch configuration of the several types can be accessed, searched
+ * and initialized. For every possible launch configuration type, a corresponding launch manager
+ * delegate must be registered which is responsible for handling the corresponding attributes of the
+ * specific launch configuration type. In the case the no launch manager delegate is registered for
+ * a launch configuration type, the launch configuration will not be initialized and therefore will
+ * not have any default attribute. If more than one launch manager delegates are contributed for the
+ * same launch configuration type, the first registered launch manager delegates will be used and the
+ * registration of any other delegate for this type will fail!
+ */
+public class LaunchManager extends PlatformObject {
+
+ /*
+ * Thread save singleton instance creation.
+ */
+ private static class LazyInstanceHolder {
+ public static LaunchManager instance = new LaunchManager();
+ }
+
+ /**
+ * Returns the singleton instance for the manager.
+ */
+ public static LaunchManager getInstance() {
+ return LazyInstanceHolder.instance;
+ }
+
+ /**
+ * Constructor.
+ */
+ LaunchManager() {
+ super();
+ }
+
+ /**
+ * Returns the corresponding launch manager delegate instance responsible for the specified
+ * launch configuration type. The method may return a default launch manager delegate if no
+ * specific launch manager delegate is registered for the specified launch configuration type.
+ *
+ * @param launchConfigType The launch configuration type to get the launch manager delegate for.
+ * Must not be <code>null</code>!
+ * @param launchMode The launch mode to get the launch manager delegate for. Must not be
+ * <code>null</code>.
+ * @return The corresponding launch manager delegate instance.
+ */
+ public ILaunchManagerDelegate getLaunchManagerDelegate(ILaunchConfigurationType launchConfigType, String launchMode) {
+ Assert.isNotNull(launchConfigType);
+ Assert.isNotNull(launchMode);
+ return LaunchConfigTypeBindingsManager.getInstance().getLaunchManagerDelegate(launchConfigType.getIdentifier(), launchMode);
+ }
+
+ /**
+ * Returns the corresponding launch configuration type for the given launch configuration type
+ * id and the given launch mode.
+ *
+ * @param launchConfigTypeId The unique id of the launch configuration type requested.
+ * @param launchMode The launch mode the launch configuration type must support. See
+ * <code>org.eclipse.debug.core.ILaunchManager</code> for details.
+ * @return The corresponding launch configuration type instance or <code>null</code> if not
+ * found or the specified mode is not supported.
+ */
+ public ILaunchConfigurationType getLaunchConfigType(String launchConfigTypeId, String launchMode) {
+ ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager()
+ .getLaunchConfigurationType(launchConfigTypeId);
+ if (launchConfigType != null && !launchConfigType.supportsMode(launchMode)) {
+ launchConfigType = null;
+ }
+ return launchConfigType;
+ }
+
+ /**
+ * Returns an fully initialized launch configuration. The launch configuration type and the
+ * launch mode required to create or look up the launch configuration, are specified through the
+ * given launch specification. Any launch configuration attribute of the certain type which is
+ * not explicitly overwritten by an attribute specified through the given launch specification
+ * will be initialized with default values.
+ * <p>
+ * If <code>forceNewConfig</code> is <code>false</code>, the method tries to find a matching
+ * existing launch configuration. If no existing launch configuration can be found, a new
+ * launch configuration will created instead.
+ *
+ * @param launchSpec A set of non default launch configuration attributes. Must not be
+ * <code>null</code>, but the list of attributes may empty to get an launch
+ * configuration with all attributes initialized to default values.
+ * @param createNew If <code>true</code>, a new launch configuration will be created if no
+ * available is found.
+ * @return The launch configuration instance matching the given parameters.
+ * @throws <code>LaunchServiceException</code> in case the launch configuration instance
+ * cannot be created, found and/or modified. The exception message describes the failure
+ * details.
+ */
+ public ILaunchConfiguration getLaunchConfiguration(ILaunchSpecification launchSpec, boolean createNew) throws LaunchServiceException {
+ Assert.isNotNull(launchSpec);
+
+ ILaunchConfiguration launchConfig = null;
+ try {
+ // get all launch configurations for launch configuration type id and launch mode
+ String launchConfigTypeId = launchSpec.getLaunchConfigurationTypeId();
+ String launchMode = launchSpec.getLaunchMode();
+ ILaunchConfigurationType launchConfigType = getLaunchConfigType(launchConfigTypeId, launchMode);
+ ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
+ .getLaunchConfigurations(launchConfigType);
+
+ // get list of fully and closest matching launch configurations
+ ILaunchConfiguration[] matchingConfigs = getLaunchManagerDelegate(launchConfigType, launchMode)
+ .getMatchingLaunchConfigurations(launchSpec, configs);
+
+ // return best matching launch configuration
+ if (matchingConfigs.length > 0) {
+ launchConfig = matchingConfigs[0];
+ }
+ }
+ catch (LaunchServiceException e) {
+ if (e.getType() == LaunchServiceException.TYPE_MISSING_LAUNCH_SPEC_ATTR) {
+ throw e;
+ }
+ }
+ catch (CoreException e) {
+ throw new LaunchServiceException(e.getMessage());
+ }
+ // return new launch configuration if no matching or best matching configuration is found
+ if (createNew && launchConfig == null) {
+ launchConfig = createOrUpdateLaunchConfiguration(null, launchSpec);
+ }
+ return launchConfig;
+ }
+
+ /**
+ * Create a new or updates an existing launch configuration of the requested type and initialize
+ * the configuration with the given launch specification. Attributes not listed by the given
+ * launch specification will be initialized with default values.
+ *
+ * @param launchConfig A launch configuration to update or <code>null</code> if a new launch
+ * configuration should be created.
+ * @param launchSpec A set of non default launch configuration attributes.
+ * @return The newly create launch configuration instance.
+ *
+ * @throws <code>LaunchServiceException</code> in case the launch configuration instance
+ * cannot be created or mandatory attributes are missing in the launch specification.
+ * The exception message describes the failure details.
+ */
+ public ILaunchConfiguration createOrUpdateLaunchConfiguration(ILaunchConfiguration launchConfig, ILaunchSpecification launchSpec) throws LaunchServiceException {
+ return this.createOrUpdateLaunchConfiguration(launchConfig, launchSpec, true);
+ }
+
+ /**
+ * Create a new or updates an existing launch configuration of the requested type and initialize
+ * the configuration with the given launch specification. Attributes not listed by the given
+ * launch specification will be initialized with default values.
+ *
+ * @param launchConfig A launch configuration to update or <code>null</code> if a new launch
+ * configuration should be created.
+ * @param launchSpec A set of non default launch configuration attributes.
+ * @param validateSpec Validate the launch specification in the <code>launchSpec</code>
+ * parameter. If <code>false</code>, it will attempt to create the launch
+ * configuration even if some of the mandatory parameters are missing.
+ * @return The newly create launch configuration instance.
+ *
+ * @throws <code>LaunchServiceException</code> in case the launch configuration instance
+ * cannot be created or mandatory attributes are missing in the launch specification.
+ * The exception message describes the failure details.
+ *
+ * @since 3.2
+ */
+ public ILaunchConfiguration createOrUpdateLaunchConfiguration(ILaunchConfiguration launchConfig, ILaunchSpecification launchSpec, boolean validateSpec) throws LaunchServiceException {
+ Assert.isNotNull(launchSpec);
+
+ String launchConfigTypeId = launchSpec.getLaunchConfigurationTypeId();
+ String launchMode = launchSpec.getLaunchMode();
+
+ ILaunchConfigurationType launchConfigType = getLaunchConfigType(launchConfigTypeId, launchMode);
+ try {
+ if (launchConfigType != null) {
+ // get the launch manager delegate instance for the requested launch configuration
+ // type
+ ILaunchManagerDelegate delegate = getLaunchManagerDelegate(launchConfigType, launchMode);
+ if (validateSpec) {
+ delegate.validate(launchSpec);
+ }
+ ILaunchConfigurationWorkingCopy wc = null;
+ if (launchConfig == null || !launchConfig.getType().getIdentifier()
+ .equals(launchConfigTypeId)) {
+ try {
+ // create the launch configuration working copy instance
+ wc = launchConfigType.newInstance(null, DebugPlugin
+ .getDefault()
+ .getLaunchManager()
+ .generateLaunchConfigurationName(launchSpec
+ .getLaunchConfigName()));
+ // initialize the launch configuration working copy
+ delegate.initLaunchConfigAttributes(wc, launchSpec);
+ // and save the launch configuration
+ return wc.doSave();
+ }
+ catch (CoreException e) {
+ throw new LaunchServiceException(Messages.LaunchManager_error_failedToCreateConfig);
+ }
+ }
+ try {
+ // get a launch configration working copy
+ if (launchConfig instanceof ILaunchConfigurationWorkingCopy) {
+ wc = (ILaunchConfigurationWorkingCopy) launchConfig;
+ }
+ else {
+ wc = launchConfig.getWorkingCopy();
+ }
+ // update the launch configuration working copy
+ delegate.updateLaunchConfigAttributes(wc, launchSpec);
+ // and save the launch configuration
+ return (wc.isDirty()) ? wc.doSave() : launchConfig;
+ }
+ catch (CoreException e) {
+ throw new LaunchServiceException(NLS.bind(Messages.LaunchManager_error_failedToUpdateConfig, launchConfig.getName()));
+ }
+ }
+ }
+ catch (CoreException e) {
+ // do nothing, because exception is thrown afterwards if this point is reached.
+ }
+ throw new LaunchServiceException(NLS.bind(Messages.LaunchManager_error_noLaunchConfigType, launchMode));
+ }
+
+ /**
+ * Delete the specified launch configuration.
+ * <p>
+ * In case any error occurs during the delete, the exception is logged to the Eclipse error log.
+ *
+ * @param launchConfig The launch configuration to delete.
+ */
+ public void deleteLaunchConfiguration(ILaunchConfiguration launchConfig) {
+ if (launchConfig != null) {
+ try {
+ launchConfig.delete();
+ }
+ catch (CoreException e) {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(),
+ Messages.LaunchManager_error_deleteLaunchConfig, e);
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
+ }
+ }
+ }
+
+ /**
+ * Creates an exact copy of the given launch specification.
+ * <p>
+ * <b>Note:</b> The method returns always an launch specification which has not locked out
+ * modifications. The corresponding read-only flag from the original is not duplicated to the
+ * copy!
+ *
+ * @param launchSpec The launch specification to duplication.
+ * @return A new <code>ILaunchSpecification</code> instance containing the same data as the
+ * original, or <code>null</code>.
+ */
+ public ILaunchSpecification duplicate(ILaunchSpecification launchSpec) {
+ if (launchSpec != null) {
+ ILaunchSpecification newLaunchSpec = new LaunchSpecification(launchSpec.getLaunchConfigurationTypeId(), launchSpec.getLaunchMode());
+ if (!launchSpec.isEmpty()) {
+ ILaunchAttribute[] attributes = launchSpec.getAllAttributes();
+ for (ILaunchAttribute attribute : attributes) {
+ newLaunchSpec.addAttribute(attribute.getKey(), attribute.getValue());
+ }
+ }
+ return newLaunchSpec;
+ }
+ return null;
+ }
+
+ /**
+ * Validates a launch configuration.
+ *
+ * @param launchConfig The launch configuration to validate.
+ * @param launchMode The launch mode. Can be <code>null</code>, in this case the launch configuration
+ * is valid when valid for all supported modes.
+ * @return <code>true</code>, if the launch configuration is valid and can be executed (launched).
+ */
+ public boolean validate(ILaunchConfiguration launchConfig, String launchMode) {
+ try {
+ if (launchMode == null) {
+ boolean valid = false;
+ for (String mode : LaunchConfigHelper.getLaunchConfigTypeModes(launchConfig.getType(), false)) {
+ if (launchConfig.supportsMode(mode) && validate(launchConfig, mode)) {
+ valid = true;
+ }
+ }
+ return valid;
+ }
+ ILaunchManagerDelegate delegate = getLaunchManagerDelegate(launchConfig.getType(), launchMode);
+ try {
+ delegate.validate(launchMode, launchConfig);
+ }
+ catch (LaunchServiceException e) {
+ return false;
+ }
+
+ }
+ catch (CoreException e) {
+ }
+ return true;
+ }
+
+ /**
+ * Transform the specified launch configuration into a corresponding launch specification
+ * object. If <code>withDefaultAttributes</code> is not set, the corresponding launch manager
+ * delegate is called to determine if an attribute has a default value or not. If the attribute
+ * has an default value, this attribute is not copied to the launch specification. If
+ * <code>withDefaultAttributes</code> is set, all attributes are copied to the launch
+ * specification object.
+ *
+ * @param launchConfig The launch configuration. Must not be <code>null</code>.
+ * @param launchMode The launch mode the launch specification should be for. See
+ * <code>ILaunchManager</code> for details.
+ * @param withDefaultAttributes Set to <code>true</code> to copy attributes with default value
+ * as well, <code>false</code> otherwise.
+ *
+ * @return The corresponding launch specification object or <code>null</code>.
+ *
+ * @throws <code>LaunchServiceException</code> in case the launch configuration could not be
+ * transformed to a launch specification. The exception message describes the failure
+ * details.
+ */
+ public ILaunchSpecification createSpecFromConfig(ILaunchConfiguration launchConfig, String launchMode, boolean withDefaultAttributes) throws LaunchServiceException {
+ Assert.isNotNull(launchConfig);
+
+ ILaunchSpecification spec = null;
+ try {
+ // extract the launch configuration type
+ ILaunchConfigurationType type = launchConfig.getType();
+ spec = new LaunchSpecification(type.getIdentifier(), launchMode);
+ // get the launch manager delegate for the specific type
+ ILaunchManagerDelegate delegate = getLaunchManagerDelegate(type, launchMode);
+ // get all the launch configuration attributes
+ Map<String, Object> attributes = launchConfig.getAttributes();
+ // loop over all listed attributes and copy them to the specification
+ Iterator<Entry<String, Object>> iterator = attributes.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry<String, Object> entry = iterator.next();
+ if (withDefaultAttributes) {
+ // include the default attributes. So, just copy the stuff over.
+ spec.addAttribute(entry.getKey(), entry.getValue());
+ }
+ else {
+ // exclude the default attributes. We have to find out if the attribute is
+ // set with default value.
+ Object attributeValue = entry.getValue();
+ if (!delegate.isDefaultAttribute(entry.getKey(), attributeValue, attributeValue, spec, launchConfig, launchMode)) {
+ spec.addAttribute(entry.getKey(), attributeValue);
+ }
+ }
+ }
+ }
+ catch (CoreException e) {
+ spec = null;
+ throw new LaunchServiceException(e);
+ }
+ return spec;
+ }
+
+ /**
+ * Launch the specified launch configuration using the corresponding delegate for the specified
+ * launch mode. If <code>buildBeforeLaunch</code> is set to <code>true</code>, the workspace
+ * will be build before the launch.
+ *
+ * @param launchConfig The launch configuration to launch. Must not be <code>null</code>!
+ * @param launchMode The launch mode (@see <code>org.eclipse.debug.core.ILaunchManager</code>.
+ * Must not be <code>null</code>!
+ * @param buildBeforeLaunch Specify <code>true</code> to build the workspace before launch,
+ * <code>false</code> otherwise.
+ *
+ * @return The corresponding <code>ILaunch</code> object associated with this launch.
+ *
+ * @throws <code>LaunchServiceException</code> in case of any problem occurs during the launch sequence.
+ */
+ public ILaunch launch(ILaunchConfiguration launchConfig, String launchMode, boolean buildBeforeLaunch, IProgressMonitor monitor) throws LaunchServiceException {
+ Assert.isNotNull(launchConfig);
+ Assert.isNotNull(launchMode);
+
+ try {
+ ILaunchManagerDelegate delegate = getLaunchManagerDelegate(launchConfig.getType(), launchMode);
+ delegate.validate(launchMode, launchConfig);
+ return launchConfig.launch(launchMode, monitor, buildBeforeLaunch);
+ }
+ catch (CoreException e) {
+ // re-pack into a launch service exception
+ throw new LaunchServiceException(e);
+ }
+ }
+
+ /**
+ * Remove all illegal characters in the launch configuration name candidate.
+ *
+ * @param candidate The launch configuration name candidate.
+ * @return The unified launch configuration name.
+ */
+ public static String getUnifiedLaunchConfigName(String candidate) {
+ if (candidate != null) {
+ candidate = candidate.replaceAll("[/\\\"&?:@*]", "_"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return candidate;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
index 05ce493cd..7b1e152f7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
@@ -84,14 +84,15 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
validateLaunchSpecification(launchSpec);
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate#isDefaultAttribute(java.lang.String, java.lang.Object, org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
- */
@Override
- public boolean isDefaultAttribute(String attributeKey, Object attributeValue, ILaunchConfiguration launchConfig, String launchMode) {
+ public boolean isDefaultAttribute(String attributeKey, Object specValue, Object confValue, ILaunchSpecification launchSpec, ILaunchConfiguration launchConfig, String launchMode) {
Assert.isNotNull(attributeKey);
Assert.isNotNull(launchConfig);
+ Assert.isNotNull(launchSpec);
Assert.isNotNull(launchMode);
+ if (confValue == null && specValue != null) {
+ return true;
+ }
return false;
}
@@ -589,17 +590,13 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
if (specValue == null && confValue == null) {
return FULL_MATCH;
}
- // if launch specification value is null,
- // values are equal if launch configuration value is default
- else if (specValue == null) {
- Assert.isNotNull(confValue);
- return isDefaultAttribute(attributeKey, confValue, launchConfig, launchSpec.getLaunchMode()) ? FULL_MATCH : NO_MATCH;
+ // if a value is null, partial match if values are default
+ else if (specValue == null || confValue == null) {
+ return isDefaultAttribute(attributeKey, specValue, confValue, launchSpec, launchConfig, launchSpec.getLaunchMode()) ? PARTIAL_MATCH : NO_MATCH;
}
- // if launch configuration value is default,
- // values are equal if launch specification value is default too
- else if (isDefaultAttribute(attributeKey, confValue, launchConfig, launchSpec.getLaunchMode()) || confValue == null) {
- Assert.isNotNull(specValue);
- return isDefaultAttribute(attributeKey, specValue, launchConfig, launchSpec.getLaunchMode()) ? FULL_MATCH : NO_MATCH;
+ // full match if values are default
+ else if (isDefaultAttribute(attributeKey, specValue, confValue, launchSpec, launchConfig, launchSpec.getLaunchMode())) {
+ return FULL_MATCH;
}
// use object.equals as default
else {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java
index 5767955a6..2c8135f00 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ILaunchManagerDelegate.java
@@ -75,14 +75,15 @@ public interface ILaunchManagerDelegate extends IExecutableExtension {
* Test the specified attribute if or if not the specified attribute value is an default value or not.
*
* @param attributeKey The attribute key/name. Must not be <code>null</code>.
- * @param attributeValue The attribute value to test.
- * @param launchConfig The original launch configuration. Needed to access relevant attributes for default value
- * calculation. Must not be <code>null</code>!
+ * @param specValue The launch specification value.
+ * @param confValue The launch configuration value.
+ * @param launchSpec The launch specification which is the source of the <code>specValue</code>. Must not be <code>null</code>.
+ * @param launchConfig The launch configuration which is the source of the <code>confValue</code>. Must not be <code>null</code>.
* @param launchMode The launch mode. Default values may differ for different launch modes. Must not be
* <code>null</code>!
* @return <code>true</code> if the specified attribute value is the default value, <code>false</code> otherwise.
*/
- public boolean isDefaultAttribute(String attributeKey, Object attributeValue, ILaunchConfiguration launchConfig, String launchMode);
+ public boolean isDefaultAttribute(String attributeKey, Object specValue, Object confValue, ILaunchSpecification launchSpec, ILaunchConfiguration launchConfig, String launchMode);
/**
* Returns a ranked list of launch configurations that best matches the given launch specification. In case of no
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
index 38a3aed8e..70c3f82c7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
@@ -17,7 +17,7 @@
class="org.eclipse.tcf.te.launch.ui.internal.LaunchNodePropertyTester"
id="org.eclipse.tcf.te.launch.ui.propertytester.launchNode"
namespace="org.eclipse.tcf.te.launch.ui.model"
- properties="isLaunchConfig,isLaunchConfigType,canDelete,canRefresh,hasLaunchMode,isValidLaunchConfig"
+ properties="isLaunchConfig,isLaunchConfigType,canDelete,canRefresh,isValidLaunchConfig"
type="org.eclipse.tcf.te.launch.ui.model.LaunchNode">
</propertyTester>
</extension>
@@ -584,10 +584,7 @@
<iterate
operator="and"
ifEmpty="false">
- <and>
- <test property="org.eclipse.tcf.te.launch.ui.model.hasLaunchMode" value="run"/>
- <test property="org.eclipse.tcf.te.launch.ui.model.isValidLaunchConfig" value="run"/>
- </and>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isValidLaunchConfig" value="run"/>
</iterate>
</with>
</enabledWhen>
@@ -608,10 +605,7 @@
<iterate
operator="and"
ifEmpty="false">
- <and>
- <test property="org.eclipse.tcf.te.launch.ui.model.hasLaunchMode" value="debug"/>
- <test property="org.eclipse.tcf.te.launch.ui.model.isValidLaunchConfig" value="debug"/>
- </and>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isValidLaunchConfig" value="debug"/>
</iterate>
</with>
</enabledWhen>
@@ -720,10 +714,13 @@
<iterate
ifEmpty="false"
operator="and">
- <or>
- <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
- <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfigType"/>
- </or>
+ <and>
+ <instanceof value="org.eclipse.tcf.te.launch.ui.model.LaunchNode"/>
+ <or>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfigType"/>
+ </or>
+ </and>
</iterate>
</with>
</definition>
@@ -733,7 +730,10 @@
<iterate
ifEmpty="false"
operator="and">
- <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ <and>
+ <instanceof value="org.eclipse.tcf.te.launch.ui.model.LaunchNode"/>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ </and>
</iterate>
</with>
</definition>
@@ -742,7 +742,10 @@
<iterate
ifEmpty="false"
operator="and">
- <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ <and>
+ <instanceof value="org.eclipse.tcf.te.launch.ui.model.LaunchNode"/>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ </and>
</iterate>
</with>
</definition>
@@ -752,7 +755,10 @@
<iterate
ifEmpty="false"
operator="and">
- <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfigType"/>
+ <and>
+ <instanceof value="org.eclipse.tcf.te.launch.ui.model.LaunchNode"/>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfigType"/>
+ </and>
</iterate>
</with>
</definition>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/LaunchNodePropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/LaunchNodePropertyTester.java
index cca15c2c2..dc73b596d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/LaunchNodePropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/LaunchNodePropertyTester.java
@@ -43,11 +43,6 @@ public class LaunchNodePropertyTester extends PropertyTester {
else if (property.equals("canRefresh")) { //$NON-NLS-1$
return refreshHandler.canRefresh(receiver);
}
- else if (property.equals("hasLaunchMode")) { //$NON-NLS-1$
- if (expectedValue != null && LaunchNode.TYPE_LAUNCH_CONFIG.equals(node.getType())) {
- return node.getLaunchConfigurationType().supportsMode(expectedValue.toString());
- }
- }
else if (property.equals("isValidLaunchConfig")) { //$NON-NLS-1$
if (expectedValue instanceof String) {
return node.isValidFor((String)expectedValue);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
index e47f5c7ff..749a4ed50 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
@@ -132,6 +132,9 @@ public class LaunchNode extends ContainerModelNode {
modes = Arrays.asList(LaunchConfigHelper.getLaunchConfigTypeModes(getLaunchConfigurationType(), false));
}
for (String m : modes) {
+ if (!getLaunchConfigurationType().supportsMode(m)) {
+ return false;
+ }
ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(getLaunchConfigurationType(), m);
if (delegate != null) {
try {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
index 669566fad..6b34849b2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
@@ -77,8 +77,7 @@ public class FileTransferItem extends PropertiesContainer implements IFileTransf
if (obj instanceof IFileTransferItem) {
return getHostPath().equals(((IFileTransferItem)obj).getHostPath()) &&
getTargetPath().equals(((IFileTransferItem)obj).getTargetPath()) &&
- getDirection() == ((IFileTransferItem)obj).getDirection() &&
- getOptions().equals(((IFileTransferItem)obj).getOptions());
+ getDirection() == ((IFileTransferItem)obj).getDirection();
}
return super.equals(obj);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml
index 1671f2308..68b2e4799 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml
@@ -40,10 +40,7 @@
<contextualLaunch>
<enablement>
<with variable="selection">
- <count value="1"/>
- <iterate
- ifEmpty="false"
- operator="and">
+ <iterate ifEmpty="false">
<test
forcePluginActivation="true"
property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType"
@@ -65,14 +62,12 @@
<contextualLaunch>
<enablement>
<with variable="selection">
- <count value="1"/>
- <iterate
- ifEmpty="false"
- operator="and">
+ <iterate ifEmpty="false">
<test
+ forcePluginActivation="true"
property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType"
value="org.eclipse.tcf.te.tcf.launch.type.remote.app"
- args="debug"/>
+ args="run"/>
</iterate>
</with>
</enablement>
@@ -139,13 +134,20 @@
label="%LaunchShortcutHandler.Remote.App.run.name"
style="push">
<visibleWhen checkEnabled="false">
- <with variable="selection">
- <iterate
- operator="and"
- ifEmpty="false">
- <instanceof value="org.eclipse.core.resources.IResource"/>
- </iterate>
- </with>
+ <with variable="selection">
+ <iterate
+ operator="and"
+ ifEmpty="false">
+ <and>
+ <adapt type="org.eclipse.debug.ui.actions.ILaunchable"/>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType"
+ value="org.eclipse.tcf.te.tcf.launch.type.remote.app"
+ args="run"/>
+ </and>
+ </iterate>
+ </with>
</visibleWhen>
</command>
<command
@@ -156,13 +158,20 @@
label="%LaunchShortcutHandler.Remote.App.debug.name"
style="push">
<visibleWhen checkEnabled="false">
- <with variable="selection">
- <iterate
- operator="and"
- ifEmpty="false">
- <instanceof value="org.eclipse.core.resources.IResource"/>
- </iterate>
- </with>
+ <with variable="selection">
+ <iterate
+ operator="and"
+ ifEmpty="false">
+ <and>
+ <adapt type="org.eclipse.debug.ui.actions.ILaunchable"/>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType"
+ value="org.eclipse.tcf.te.tcf.launch.type.remote.app"
+ args="run"/>
+ </and>
+ </iterate>
+ </with>
</visibleWhen>
</command>
</menuContribution>
@@ -178,11 +187,17 @@
style="push">
<visibleWhen checkEnabled="false">
<with variable="selection">
- <iterate
- operator="and"
- ifEmpty="false">
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- </iterate>
+ <with variable="selection">
+ <iterate
+ operator="and"
+ ifEmpty="false">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType"
+ value="org.eclipse.tcf.te.tcf.launch.type.remote.app"
+ args="run"/>
+ </iterate>
+ </with>
</with>
</visibleWhen>
</command>
@@ -195,11 +210,17 @@
style="push">
<visibleWhen checkEnabled="false">
<with variable="selection">
- <iterate
- operator="and"
- ifEmpty="false">
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- </iterate>
+ <with variable="selection">
+ <iterate
+ operator="and"
+ ifEmpty="false">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType"
+ value="org.eclipse.tcf.te.tcf.launch.type.remote.app"
+ args="debug"/>
+ </iterate>
+ </with>
</with>
</visibleWhen>
</command>
@@ -238,10 +259,11 @@
<iterate
operator="and"
ifEmpty="false">
- <or>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <instanceof value="org.eclipse.core.resources.IResource"/>
- </or>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType"
+ value="org.eclipse.tcf.te.tcf.launch.type.remote.app"
+ args="run"/>
</iterate>
</with>
</enabledWhen>
@@ -264,10 +286,11 @@
<iterate
operator="and"
ifEmpty="false">
- <or>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <instanceof value="org.eclipse.core.resources.IResource"/>
- </or>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.launch.core.isValidLaunchConfigType"
+ value="org.eclipse.tcf.te.tcf.launch.type.remote.app"
+ args="debug"/>
</iterate>
</with>
</enabledWhen>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeContentProvider.java
index a0184c3f6..d1582d214 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeContentProvider.java
@@ -59,15 +59,15 @@ public abstract class TreeContentProvider implements ITreeContentProvider, Prope
*/
protected Pending getPending(Object parent) {
Pending pending = pendings.get(parent);
- if(pending == null) {
+ if(pending == null && viewer != null) {
pending = new Pending(viewer);
pendings.put(parent, pending);
}
return pending;
}
-
+
@Override
- public void propertyChange(PropertyChangeEvent evt) {
+ public void propertyChange(PropertyChangeEvent evt) {
String property = evt.getPropertyName();
if(property.equals("query_started")) { //$NON-NLS-1$
Object source = evt.getSource();
@@ -84,13 +84,13 @@ public abstract class TreeContentProvider implements ITreeContentProvider, Prope
}
}
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override
- public void dispose() {
+ public void dispose() {
for(IPropertyChangeProvider provider : providers) {
provider.removePropertyChangeListener(commonViewerListener);
provider.removePropertyChangeListener(this);
@@ -101,8 +101,8 @@ public abstract class TreeContentProvider implements ITreeContentProvider, Prope
pending.stopAnimation();
}
pendings.clear();
- }
-
+ }
+
/**
* Get the filtered children of the parent using the
* filters registered in the viewer.
@@ -123,13 +123,13 @@ public abstract class TreeContentProvider implements ITreeContentProvider, Prope
}
return result;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@Override
- public Object[] getChildren(Object parentElement) {
+ public Object[] getChildren(Object parentElement) {
Assert.isNotNull(parentElement);
if (parentElement instanceof IAdaptable) {
@@ -139,9 +139,9 @@ public abstract class TreeContentProvider implements ITreeContentProvider, Prope
installPropertyChangeListener(viewerInput);
}
}
-
+
return null;
- }
+ }
/*
* (non-Javadoc)
@@ -153,24 +153,24 @@ public abstract class TreeContentProvider implements ITreeContentProvider, Prope
this.viewer = (TreeViewer) viewer;
this.commonViewerListener = new CommonViewerListener(this.viewer, this);
}
-
+
/**
* Install a property change listener to the specified element.
*
* @param provider The element node.
*/
- private void installPropertyChangeListener(IPropertyChangeProvider provider) {
+ private void installPropertyChangeListener(IPropertyChangeProvider provider) {
if(provider != null && !providers.contains(provider) && commonViewerListener != null) {
provider.addPropertyChangeListener(commonViewerListener);
provider.addPropertyChangeListener(this);
providers.add(provider);
}
- }
+ }
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
@Override
public boolean hasChildren(Object element) {
Object[] children = getFilteredChildren(element);

Back to the top