Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-04-26 14:38:19 +0000
committerUwe Stieber2012-04-26 14:38:19 +0000
commit56d62eb7a0653edcc6a187ba7f81f89c6420ae67 (patch)
treefe6810ffbb71d8fb2ffaeb237c5ae534334f5bf6 /target_explorer/plugins/org.eclipse.tcf.te.launch.core
parentae2e2e5fc68024ad74014f0ba2978292c10e28d8 (diff)
downloadorg.eclipse.tcf-56d62eb7a0653edcc6a187ba7f81f89c6420ae67.tar.gz
org.eclipse.tcf-56d62eb7a0653edcc6a187ba7f81f89c6420ae67.tar.xz
org.eclipse.tcf-56d62eb7a0653edcc6a187ba7f81f89c6420ae67.zip
Target Explorer: ADD Launches to target explorer, editor and context menus
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.launch.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/LaunchConfigTypeBinding.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/PropertyTester.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/interfaces/IReferencedProjectItem.java10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchManager.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java91
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java26
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/AbstractSelectionContext.java26
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/ProjectSelectionContext.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/RemoteSelectionContext.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/ISelectionContext.java7
12 files changed, 218 insertions, 68 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml
index 8504730de..8a1b0d5a8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/plugin.xml
@@ -32,6 +32,13 @@
properties="launchMode,launchConfigTypeId"
type="org.eclipse.debug.core.ILaunch">
</propertyTester>
+ <propertyTester
+ class="org.eclipse.tcf.te.launch.core.bindings.internal.PropertyTester"
+ id="org.eclipse.tcf.te.launch.core.PropertyTester"
+ namespace="org.eclipse.tcf.te.launch.core"
+ properties="isValidLaunchConfigType"
+ type="java.lang.Object">
+ </propertyTester>
</extension>
<!-- Launch Step contributions -->
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java
index 1d55155a1..4439b2540 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/LaunchConfigTypeBindingsManager.java
@@ -100,7 +100,7 @@ public class LaunchConfigTypeBindingsManager {
ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId);
return (launchConfigType != null && launchConfigType.isPublic() &&
(selection.getLaunchMode() == null || launchConfigType.supportsMode(selection.getLaunchMode())) &&
- binding != null && binding.validate(selection) != EvaluationResult.FALSE);
+ binding != null && binding.validate(selection) == EvaluationResult.TRUE);
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/LaunchConfigTypeBinding.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/LaunchConfigTypeBinding.java
index 73df9b5aa..fb0d4ae68 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/LaunchConfigTypeBinding.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/bindings/internal/LaunchConfigTypeBinding.java
@@ -10,6 +10,8 @@
package org.eclipse.tcf.te.launch.core.bindings.internal;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.expressions.EvaluationContext;
@@ -191,8 +193,10 @@ public class LaunchConfigTypeBinding {
for (Expression expression : expressions) {
// Set the default variable and "selection" is the selection context
EvaluationContext evalContext = new EvaluationContext(null, context);
- evalContext.addVariable("selection", context); //$NON-NLS-1$
- evalContext.addVariable("mode", mode); //$NON-NLS-1$
+ evalContext.addVariable("context", context.getContext()); //$NON-NLS-1$
+ evalContext.addVariable("selection", context.getSelections() != null ? Arrays.asList(context.getSelections()) : Collections.EMPTY_LIST); //$NON-NLS-1$
+ evalContext.addVariable("type", context.getType() != null ? context.getType() : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ evalContext.addVariable("mode", mode != null ? mode : ""); //$NON-NLS-1$ //$NON-NLS-2$
// Allow plugin activation
evalContext.setAllowPluginActivation(true);
// Evaluate the expression
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 3d55f1c07..24c364e7a 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
@@ -9,8 +9,17 @@
*******************************************************************************/
package org.eclipse.tcf.te.launch.core.bindings.internal;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.ILaunch;
+import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
+import org.eclipse.tcf.te.launch.core.selection.LaunchSelection;
+import org.eclipse.tcf.te.launch.core.selection.ProjectSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNodeProvider;
/**
* Launch property tester.
@@ -23,11 +32,13 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
@Override
public boolean test(final Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof ILaunch) {
- if ("launchMode".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
+ if ("launchMode".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
+ if (receiver instanceof ILaunch) {
return ((ILaunch)receiver).getLaunchMode().equalsIgnoreCase((String)expectedValue);
}
- if ("launchConfigTypeid".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
+ }
+ else if ("launchConfigTypeid".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
+ if (receiver instanceof ILaunch) {
try {
return ((ILaunch)receiver).getLaunchConfiguration().getType().getIdentifier().equalsIgnoreCase((String)expectedValue);
}
@@ -35,6 +46,32 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
}
}
}
+ else if ("isValidLaunchConfigType".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
+ ISelectionContext selContext = null;
+ if (receiver instanceof IModelNodeProvider) {
+ selContext = new RemoteSelectionContext(((IModelNodeProvider)receiver).getModelNode(), true);
+ }
+ else if (receiver instanceof IProject) {
+ selContext = new ProjectSelectionContext((IProject)receiver, true);
+ }
+ else if (receiver instanceof IAdaptable) {
+ IProject project = (IProject)((IAdaptable)receiver).getAdapter(IProject.class);
+ if (project != null) {
+ selContext = new ProjectSelectionContext(project, true);
+ }
+ IModelNode modelNode = (IModelNode)((IAdaptable)receiver).getAdapter(IModelNode.class);
+ if (modelNode != null) {
+ selContext = new RemoteSelectionContext(modelNode, true);
+ }
+ }
+ if (selContext != null) {
+ return LaunchConfigTypeBindingsManager.getInstance().isValidLaunchConfigType(
+ (String)expectedValue,
+ new LaunchSelection(
+ (args != null && args.length > 0 ? args[0].toString() : null),
+ selContext));
+ }
+ }
return false;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/interfaces/IReferencedProjectItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/interfaces/IReferencedProjectItem.java
index eac93701f..8411aeeee 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/interfaces/IReferencedProjectItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/interfaces/IReferencedProjectItem.java
@@ -19,4 +19,14 @@ public interface IReferencedProjectItem extends IPropertiesContainer {
public static final String PROPERTY_ENABLED = "enabled"; //$NON-NLS-1$
public static final String PROPERTY_PROJECT_NAME = "project_name"; //$NON-NLS-1$
+
+ /**
+ * Return <code>true</code> if the item is enabled.
+ */
+ public boolean isEnabled();
+
+ /**
+ * Return the project name.
+ */
+ public String getProjectName();
}
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 22381c728..7ffb5d7de 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
@@ -10,7 +10,6 @@
package org.eclipse.tcf.te.launch.core.lm;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -34,7 +33,6 @@ 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;
-import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
/**
* The Launch Manager is the management interface for the launch configuration storage layer.
@@ -99,7 +97,7 @@ public class LaunchManager extends PlatformObject {
*/
public ILaunchConfigurationType getLaunchConfigType(String launchConfigTypeId, String launchMode) {
ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager()
- .getLaunchConfigurationType(launchConfigTypeId);
+ .getLaunchConfigurationType(launchConfigTypeId);
if (launchConfigType != null && !launchConfigType.supportsMode(launchMode)) {
launchConfigType = null;
}
@@ -217,38 +215,16 @@ public class LaunchManager extends PlatformObject {
}
ILaunchConfigurationWorkingCopy wc = null;
if (launchConfig == null || !launchConfig.getType().getIdentifier()
- .equals(launchConfigTypeId)) {
+ .equals(launchConfigTypeId)) {
try {
// create the launch configuration working copy instance
wc = launchConfigType.newInstance(null, DebugPlugin
- .getDefault()
- .getLaunchManager()
- .generateLaunchConfigurationName(launchSpec
- .getLaunchConfigName()));
+ .getDefault()
+ .getLaunchManager()
+ .generateLaunchConfigurationName(launchSpec
+ .getLaunchConfigName()));
// initialize the launch configuration working copy
delegate.initLaunchConfigAttributes(wc, launchSpec);
- // copy all additional attributes set in the launch spec to the working copy
- ILaunchAttribute[] allAttributes = launchSpec.getAllAttributes();
- for (ILaunchAttribute attribute : allAttributes) {
- if (!wc.hasAttribute(attribute.getKey())) {
- Object value = attribute.getValue();
- if (value instanceof Boolean) {
- DefaultPersistenceDelegate.setAttribute(wc, attribute.getKey(), ((Boolean) value).booleanValue());
- }
- else if (value instanceof Integer) {
- DefaultPersistenceDelegate.setAttribute(wc, attribute.getKey(), ((Integer) value).intValue());
- }
- else if (value instanceof List<?>) {
- DefaultPersistenceDelegate.setAttribute(wc, attribute.getKey(), (List<?>) value);
- }
- else if (value instanceof Map<?, ?>) {
- DefaultPersistenceDelegate.setAttribute(wc, attribute.getKey(), (Map<?, ?>) value);
- }
- else if (value instanceof String) {
- DefaultPersistenceDelegate.setAttribute(wc, attribute.getKey(), (String) value);
- }
- }
- }
// and save the launch configuration
return wc.doSave();
}
@@ -294,7 +270,7 @@ public class LaunchManager extends PlatformObject {
}
catch (CoreException e) {
IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(),
- Messages.LaunchManager_error_deleteLaunchConfig, e);
+ Messages.LaunchManager_error_deleteLaunchConfig, e);
Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
}
}
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 3905a4d54..4fd39ee2d 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
@@ -10,6 +10,7 @@
package org.eclipse.tcf.te.launch.core.lm.delegates;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -25,18 +26,26 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
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.interfaces.IReferencedProjectItem;
import org.eclipse.tcf.te.launch.core.interfaces.tracing.ITraceIds;
import org.eclipse.tcf.te.launch.core.lm.LaunchConfigSorter;
import org.eclipse.tcf.te.launch.core.lm.LaunchSpecification;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchAttribute;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
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.lm.interfaces.IReferencedProjectLaunchAttributes;
import org.eclipse.tcf.te.launch.core.nls.Messages;
+import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectsPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.preferences.IPreferenceKeys;
import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection;
import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
/**
* Default launch manager delegate implementation.
@@ -168,12 +177,14 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
// for full validation.
// otherwise "not preferred" contexts are valid even if they are not for a give
// launch configuration type id.
+ boolean oldPref = selectionContext.isPreferredContext();
selectionContext.setIsPreferredContext(true);
if (LaunchConfigTypeBindingsManager
.getInstance()
.isValidLaunchConfigType(launchConfigTypeId, launchSelection.getLaunchMode(), selectionContext)) {
spec = addLaunchSpecAttributes(spec, launchConfigTypeId, selectionContext);
}
+ selectionContext.setIsPreferredContext(oldPref);
}
// If the number of selected contexts is 0, we have to call addLaunchSpecAttributes
@@ -618,17 +629,80 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
Assert.isNotNull(specValue);
Assert.isNotNull(confValue);
+ if (ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS.equals(attributeKey)) {
+ // get match of list objects
+ int match = specValue.equals(confValue) ? FULL_MATCH : NO_MATCH;
+ // compare objects in the list when they are not already equal
+ if (match != FULL_MATCH) {
+ List<IModelNode> confItems = Arrays.asList(LaunchContextsPersistenceDelegate.decodeLaunchContexts(confValue.toString()));
+ IModelNode[] specItems = LaunchContextsPersistenceDelegate.decodeLaunchContexts(specValue.toString());
+ int i = 0;
+ for (IModelNode item : specItems) {
+ if (confItems.contains(item)) {
+ // spec object can be found in the configuration
+ if (match == NO_MATCH) {
+ // full match on first element in the spec list,
+ // otherwise partial match
+ match = (i == 0) ? FULL_MATCH : PARTIAL_MATCH;
+ }
+ }
+ else if (match == FULL_MATCH) {
+ // reduce full to partial match when spec object wasn't found
+ match = PARTIAL_MATCH;
+ }
+ i++;
+ }
+ // reduce full to partial match when list size is not equal
+ // but all spec values where found in the configuration project list
+ if (match == FULL_MATCH && specItems.length != confItems.size()) {
+ match = PARTIAL_MATCH;
+ }
+ }
+ return match;
+ }
+
+ if (IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS.equals(attributeKey)) {
+ // get match of list objects
+ int match = specValue.equals(confValue) ? FULL_MATCH : NO_MATCH;
+ // compare objects in the list when they are not already equal
+ if (match != FULL_MATCH) {
+ List<IFileTransferItem> confItems = Arrays.asList(FileTransfersPersistenceDelegate.decodeFileTransferItems(confValue.toString()));
+ IFileTransferItem[] specItems = FileTransfersPersistenceDelegate.decodeFileTransferItems(specValue.toString());
+ int i = 0;
+ for (IFileTransferItem item : specItems) {
+ if (confItems.contains(item)) {
+ // spec object can be found in the configuration
+ if (match == NO_MATCH) {
+ // full match on first element in the spec list,
+ // otherwise partial match
+ match = (i == 0) ? FULL_MATCH : PARTIAL_MATCH;
+ }
+ }
+ else if (match == FULL_MATCH) {
+ // reduce full to partial match when spec object wasn't found
+ match = PARTIAL_MATCH;
+ }
+ i++;
+ }
+ // reduce full to partial match when list size is not equal
+ // but all spec values where found in the configuration project list
+ if (match == FULL_MATCH && specItems.length != confItems.size()) {
+ match = PARTIAL_MATCH;
+ }
+ }
+ return match;
+ }
+
if (IReferencedProjectLaunchAttributes.ATTR_REFERENCED_PROJECTS.equals(attributeKey)) {
// get match of list objects
int match = specValue.equals(confValue) ? FULL_MATCH : NO_MATCH;
// compare objects in the list when they are not already equal
- if (match != FULL_MATCH && specValue instanceof List<?> && confValue instanceof List<?>) {
- List<?> specProject = (List<?>) specValue;
- List<?> confProject = (List<?>) confValue;
- match = (specProject.isEmpty() || confProject.isEmpty()) ? PARTIAL_MATCH : NO_MATCH;
- for (int i = 0; i < specProject.size(); i++) {
- Object specObject = specProject.get(i);
- if (specObject != null && confProject.contains(specObject)) {
+ if (match != FULL_MATCH) {
+ List<IReferencedProjectItem> confItems = Arrays.asList(ReferencedProjectsPersistenceDelegate.decodeReferencedProjectItems(confValue.toString()));
+ IReferencedProjectItem[] specItems = ReferencedProjectsPersistenceDelegate.decodeReferencedProjectItems(specValue.toString());
+ int i = 0;
+ for (IReferencedProjectItem item : specItems) {
+ if (confItems.contains(item)) {
// spec object can be found in the configuration
if (match == NO_MATCH) {
// full match on first element in the spec list,
@@ -640,10 +714,11 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
// reduce full to partial match when spec object wasn't found
match = PARTIAL_MATCH;
}
+ i++;
}
// reduce full to partial match when list size is not equal
// but all spec values where found in the configuration project list
- if (match == FULL_MATCH && specProject.size() != confProject.size()) {
+ if (match == FULL_MATCH && specItems.length != confItems.size()) {
match = PARTIAL_MATCH;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
index 41077646c..efb156188 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
@@ -24,4 +24,30 @@ public class ReferencedProjectItem extends PropertiesContainer implements IRefer
public ReferencedProjectItem() {
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ return getBooleanProperty(PROPERTY_ENABLED);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem#getProjectName()
+ */
+ @Override
+ public String getProjectName() {
+ return getStringProperty(PROPERTY_PROJECT_NAME);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.properties.PropertiesContainer#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof IReferencedProjectItem) {
+ return getProjectName().equals(((IReferencedProjectItem)obj).getProjectName());
+ }
+ return super.equals(obj);
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/AbstractSelectionContext.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/AbstractSelectionContext.java
index ab2d0193e..46eb193b6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/AbstractSelectionContext.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/AbstractSelectionContext.java
@@ -15,6 +15,8 @@ import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext;
* Abstract selection context implementation.
*/
public abstract class AbstractSelectionContext implements ISelectionContext {
+ // The context
+ protected final Object context;
// The selection context type
protected String type = null;
// The selected objects
@@ -25,11 +27,13 @@ public abstract class AbstractSelectionContext implements ISelectionContext {
/**
* Constructor.
*
+ * @param The context object.
* @param selections The selected objects or <code>null</code>.
* @param isPreferred <code>True</code> to mark the selection context the preferred context,
* <code>false</code> otherwise.
*/
- public AbstractSelectionContext(Object[] selections, boolean isPreferred) {
+ public AbstractSelectionContext(Object context, Object[] selections, boolean isPreferred) {
+ this.context = context;
this.selections = selections != null ? selections : new Object[0];
this.isPreferred = isPreferred;
}
@@ -37,22 +41,32 @@ public abstract class AbstractSelectionContext implements ISelectionContext {
/**
* Constructor.
*
+ * @param The context object.
* @param type The selection context type or <code>null</code>.
* @param selections The selected objects or <code>null</code>.
* @param isPreferred <code>True</code> to mark the selection context the preferred context,
* <code>false</code> otherwise.
*/
- public AbstractSelectionContext(String type, Object[] selections, boolean isPreferred) {
+ public AbstractSelectionContext(Object context, String type, Object[] selections, boolean isPreferred) {
+ this.context = context;
this.type = type;
this.selections = selections != null ? selections : new Object[0];
this.isPreferred = isPreferred;
}
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext#getContext()
+ */
+ @Override
+ public Object getContext() {
+ return context;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext#getType()
*/
@Override
- public String getType() {
+ public String getType() {
return type;
}
@@ -60,7 +74,7 @@ public abstract class AbstractSelectionContext implements ISelectionContext {
* @see org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext#getSelections()
*/
@Override
- public Object[] getSelections() {
+ public Object[] getSelections() {
return selections;
}
@@ -68,7 +82,7 @@ public abstract class AbstractSelectionContext implements ISelectionContext {
* @see org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext#setIsPreferredContext(boolean)
*/
@Override
- public void setIsPreferredContext(boolean isPreferred) {
+ public void setIsPreferredContext(boolean isPreferred) {
this.isPreferred = isPreferred;
}
@@ -76,7 +90,7 @@ public abstract class AbstractSelectionContext implements ISelectionContext {
* @see org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext#isPreferredContext()
*/
@Override
- public boolean isPreferredContext() {
+ public boolean isPreferredContext() {
return isPreferred;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/ProjectSelectionContext.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/ProjectSelectionContext.java
index eb40a2e31..83e37ac6b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/ProjectSelectionContext.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/ProjectSelectionContext.java
@@ -14,10 +14,8 @@ import org.eclipse.tcf.te.launch.core.selection.interfaces.IProjectSelectionCont
/**
* Project launch selection context implementation.
-*/
+ */
public class ProjectSelectionContext extends AbstractSelectionContext implements IProjectSelectionContext {
- // The projectCtx context
- private IProject projectCtx;
/**
* Constructor.
@@ -27,7 +25,7 @@ public class ProjectSelectionContext extends AbstractSelectionContext implements
* <code>false</code> otherwise.
*/
public ProjectSelectionContext(IProject project, boolean isPreferred) {
- this(project, null, isPreferred);
+ this(project, new Object[]{project}, isPreferred);
}
/**
@@ -39,8 +37,7 @@ public class ProjectSelectionContext extends AbstractSelectionContext implements
* <code>false</code> otherwise.
*/
public ProjectSelectionContext(IProject project, Object[] selections, boolean isPreferred) {
- super(selections, isPreferred);
- this.projectCtx = project;
+ super(project, selections, isPreferred);
}
/* (non-Javadoc)
@@ -48,7 +45,7 @@ public class ProjectSelectionContext extends AbstractSelectionContext implements
*/
@Override
public IProject getProjectCtx() {
- return projectCtx;
+ return (IProject)getContext();
}
/* (non-Javadoc)
@@ -58,8 +55,8 @@ public class ProjectSelectionContext extends AbstractSelectionContext implements
public String toString() {
StringBuffer toString = new StringBuffer();
- if (projectCtx != null) {
- toString.append(projectCtx.getName());
+ if (getProjectCtx() != null) {
+ toString.append(getProjectCtx().getName());
}
toString.append(toString.length() > 0 ? " " : ""); //$NON-NLS-1$ //$NON-NLS-2$
toString.append(super.toString());
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/RemoteSelectionContext.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/RemoteSelectionContext.java
index b7f40337f..4065bb6b8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/RemoteSelectionContext.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/RemoteSelectionContext.java
@@ -16,8 +16,6 @@ import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
* Step context selection context implementation.
*/
public class RemoteSelectionContext extends AbstractSelectionContext implements IRemoteSelectionContext {
- // The step context
- private IModelNode remoteCtx = null;
/**
* Constructor.
@@ -27,7 +25,7 @@ public class RemoteSelectionContext extends AbstractSelectionContext implements
* <code>false</code> otherwise.
*/
public RemoteSelectionContext(IModelNode remoteCtx, boolean isPreferred) {
- this(remoteCtx, null, isPreferred);
+ this(remoteCtx, new Object[]{remoteCtx}, isPreferred);
}
/**
@@ -39,8 +37,7 @@ public class RemoteSelectionContext extends AbstractSelectionContext implements
* <code>false</code> otherwise.
*/
public RemoteSelectionContext(IModelNode remoteCtx, Object[] selections, boolean isPreferred) {
- super(selections, isPreferred);
- this.remoteCtx = remoteCtx;
+ super(remoteCtx, selections, isPreferred);
}
/* (non-Javadoc)
@@ -48,7 +45,7 @@ public class RemoteSelectionContext extends AbstractSelectionContext implements
*/
@Override
public IModelNode getRemoteCtx() {
- return remoteCtx;
+ return (IModelNode)getContext();
}
/* (non-Javadoc)
@@ -58,8 +55,8 @@ public class RemoteSelectionContext extends AbstractSelectionContext implements
public String toString() {
StringBuffer toString = new StringBuffer();
- if (remoteCtx != null) {
- toString.append(remoteCtx.toString());
+ if (getContext() != null) {
+ toString.append(getContext().toString());
}
toString.append(toString.length() > 0 ? " " : ""); //$NON-NLS-1$ //$NON-NLS-2$
toString.append(super.toString());
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/ISelectionContext.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/ISelectionContext.java
index 67b4b5549..959510901 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/ISelectionContext.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/selection/interfaces/ISelectionContext.java
@@ -15,6 +15,13 @@ package org.eclipse.tcf.te.launch.core.selection.interfaces;
public interface ISelectionContext {
/**
+ * Returns the context object of the selection.
+ *
+ * @return The context object.
+ */
+ public Object getContext();
+
+ /**
* Returns all selected objects within the selected context.
*
* @param An array containing all selected objects, or <code>null</code>.

Back to the top