Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-07-18 06:56:05 +0000
committerUwe Stieber2012-07-18 07:08:33 +0000
commitb818bd7fa3801c8d25e7f5447567064b10b6756e (patch)
tree0a01ee1062effe30c5f2912d72f9509cb4e2294f /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core
parentd1d63a37e70906b8047a95b2225a40f27842b581 (diff)
downloadorg.eclipse.tcf-b818bd7fa3801c8d25e7f5447567064b10b6756e.tar.gz
org.eclipse.tcf-b818bd7fa3801c8d25e7f5447567064b10b6756e.tar.xz
org.eclipse.tcf-b818bd7fa3801c8d25e7f5447567064b10b6756e.zip
Target Explorer: ADD launch tab handling in editor
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IPeerModelProperties.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java35
2 files changed, 51 insertions, 6 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IPeerModelProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IPeerModelProperties.java
new file mode 100644
index 000000000..8814fd406
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IPeerModelProperties.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.tcf.launch.core.interfaces;
+
+
+/**
+ * Default set of custom peer properties.
+ */
+public interface IPeerModelProperties {
+
+ /**
+ * Property: The peers launch configuration "Template" for new attach launch.
+ */
+ public static final String PROP_LAUNCH_CONFIG_ATTRIBUTES = "LaunchConfigAttributes"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java
index 23e9a4c03..d2995d54a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/AttachLaunchManagerDelegate.java
@@ -13,19 +13,25 @@ package org.eclipse.tcf.te.tcf.launch.core.lm.delegates;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.selection.interfaces.IRemoteSelectionContext;
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.persistence.PersistenceManager;
+import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
import org.eclipse.tcf.te.runtime.services.interfaces.constants.IPropertiesAccessServiceConstants;
+import org.eclipse.tcf.te.tcf.launch.core.interfaces.IPeerModelProperties;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
/**
* RemoteAppLaunchManagerDelegate
@@ -43,13 +49,14 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
super();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#updateLaunchConfigAttributes(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification)
+ */
@Override
public void updateLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
super.updateLaunchConfigAttributes(wc, launchSpec);
- if (launchSpec.hasAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS)) {
- wc.setAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)launchSpec.getAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS).getValue());
- }
+ copySpecToConfig(launchSpec, wc);
wc.rename(getDefaultLaunchName(wc));
}
@@ -61,9 +68,7 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
public void initLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
super.initLaunchConfigAttributes(wc, launchSpec);
- if (launchSpec.hasAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS)) {
- wc.setAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)launchSpec.getAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS).getValue());
- }
+ copySpecToConfig(launchSpec, wc);
wc.rename(getDefaultLaunchName(wc));
}
@@ -96,6 +101,24 @@ public class AttachLaunchManagerDelegate extends DefaultLaunchManagerDelegate {
LaunchContextsPersistenceDelegate.setLaunchContexts(launchSpec, launchContexts.toArray(new IModelNode[launchContexts.size()]));
}
+ if (remoteCtx instanceof IPeerModel) {
+ String launchConfigAttributes = ((IPeerModel)remoteCtx).getPeer().getAttributes().get(IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES);
+ if (launchConfigAttributes != null) {
+ IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(Map.class, launchConfigAttributes, false);
+ try {
+ Map<String, String> attributes = (Map<String,String>)delegate.read(Map.class, launchConfigAttributes, null);
+ attributes.remove(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS);
+ attributes.remove(ICommonLaunchAttributes.ATTR_UUID);
+ attributes.remove(ICommonLaunchAttributes.ATTR_LAST_LAUNCHED);
+ for (String key : attributes.keySet()) {
+ launchSpec.addAttribute(key, attributes.get(key), true);
+ }
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+
launchSpec.setLaunchConfigName(getDefaultLaunchName(launchSpec));
}

Back to the top