summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTobias Schwarz2012-07-19 07:05:38 (EDT)
committer Uwe Stieber2012-07-19 07:12:05 (EDT)
commitf32e7b0508a4b8dfaf11496957cfb8720a59a03e (patch)
tree71b6df8b6dff70dcfa30575bd903e0b15f1820b4
parentd5180015caac5bc65b5fa5948c3c5bd1508053e3 (diff)
downloadorg.eclipse.tcf-f32e7b0508a4b8dfaf11496957cfb8720a59a03e.zip
org.eclipse.tcf-f32e7b0508a4b8dfaf11496957cfb8720a59a03e.tar.gz
org.eclipse.tcf-f32e7b0508a4b8dfaf11496957cfb8720a59a03e.tar.bz2
Target Explorer: ADD change event listener to update attach launch configs when peer launch attributes are changing
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/internal/LaunchConfigurationDelegate.java)3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java278
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/peers/Peer.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java156
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/LaunchConfigurationDelegate.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java78
7 files changed, 321 insertions, 224 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/internal/LaunchConfigurationDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java
index 5b3fd9d..5612da6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/internal/LaunchConfigurationDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/delegates/LaunchConfigurationDelegate.java
@@ -7,7 +7,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.launch.core.lm.internal;
+package org.eclipse.tcf.te.launch.core.delegates;
import java.util.ArrayList;
import java.util.Date;
@@ -36,7 +36,6 @@ import org.eclipse.debug.core.model.IBreakpoint;
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.delegates.Launch;
import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java
index 2cec6cf..084e96f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigHelper.java
@@ -1,126 +1,152 @@
-/*******************************************************************************
- * 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.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.ILaunchMode;
-
-/**
- * Static launch configuration utility implementations.
- */
-public class LaunchConfigHelper {
-
- /**
- * Generate a unique launch config name.
- * @param name The suggested name.
- * @return The unique name.
- */
- public static String getUniqueLaunchConfigName(String name) {
- return DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name);
- }
-
- /**
- * Get a sorted list of all launch modes for the given launch configuration type.
- *
- * @param launchConfigType The launch configuration type.
- * @param reverse If <code>true</code> the sorted list order is reversed.
- *
- * @return Sorted list of supported launch modes.
- */
- public static String[] getLaunchConfigTypeModes(ILaunchConfigurationType launchConfigType, boolean reverse) {
- return getLaunchConfigTypeModes(new ILaunchConfigurationType[] { launchConfigType }, reverse);
- }
-
- /**
- * Get a sorted list of all launch modes for the given launch configuration types.
- *
- * @param launchConfigTypes The launch configuration types.
- * @param reverse If <code>true</code> the sorted list order is reversed.
- *
- * @return Sorted list of supported launch modes.
- */
- public static String[] getLaunchConfigTypeModes(ILaunchConfigurationType[] launchConfigTypes, boolean reverse) {
- List<String> modes = new ArrayList<String>();
- for (ILaunchConfigurationType launchConfigType : launchConfigTypes) {
- for (Object modeCombination : launchConfigType.getSupportedModeCombinations()) {
- if (((Set<?>) modeCombination).size() == 1) {
- String mode = (String) ((Set<?>) modeCombination).toArray()[0];
- if (!modes.contains(mode)) {
- modes.add(mode);
- }
- }
- }
- }
- return getLaunchModesSorted(modes.toArray(new String[modes.size()]), reverse);
- }
-
- /**
- * Gets a sorted list of launch mode identifiers.
- *
- * @param launchModes The launch modes. Must not be <code>null</code>.
- * @param reverse If <code>true</code> the sorted list order is reversed.
- *
- * @return Sorted list of launch mode identifiers.
- */
- public static String[] getLaunchModesSorted(ILaunchMode[] launchModes, boolean reverse) {
- Assert.isNotNull(launchModes);
-
- String[] modes = new String[launchModes.length];
- for (int i = 0; i < launchModes.length; i++) {
- modes[i] = launchModes[i].getIdentifier();
- }
- return getLaunchModesSorted(modes, reverse);
- }
-
- /**
- * Gets a sorted list of launch mode identifiers.
- *
- * @param launchModes The unsorted list of launch modes identifiers. Must not be <code>null</code>.
- * @param reverse If <code>true</code> the sorted list order is reversed.
- *
- * @return Sorted list of launch mode identifiers.
- */
- public static String[] getLaunchModesSorted(String[] launchModes, final boolean reverse) {
- Assert.isNotNull(launchModes);
-
- // sort the list of launch modes
- // Run is always the first, followed by Debug.
- // All other modes are sorted alphabetically at the end of the list.
- Arrays.sort(launchModes, new Comparator<String>() {
- @Override
- public int compare(String o1, String o2) {
- if (o1.equals(ILaunchManager.RUN_MODE) && !o2.equals(ILaunchManager.RUN_MODE)) {
- return reverse ? 1 : -1;
- }
- if (o2.equals(ILaunchManager.RUN_MODE) && !o1.equals(ILaunchManager.RUN_MODE)) {
- return reverse ? -1 : 1;
- }
- if (o1.equals(ILaunchManager.DEBUG_MODE) && !o2.equals(ILaunchManager.DEBUG_MODE)) {
- return reverse ? 1 : -1;
- }
- if (o2.equals(ILaunchManager.DEBUG_MODE) && !o1.equals(ILaunchManager.DEBUG_MODE)) {
- return reverse ? -1 : 1;
- }
- return reverse ? o2.compareTo(o1) : o1.compareTo(o2);
- }
- });
-
- return launchModes;
- }
-}
+/*******************************************************************************
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchMode;
+
+/**
+ * Static launch configuration utility implementations.
+ */
+public class LaunchConfigHelper {
+
+ /**
+ * Generate a unique launch config name.
+ * @param name The suggested name.
+ * @return The unique name.
+ */
+ public static String getUniqueLaunchConfigName(String name) {
+ return DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name);
+ }
+
+ public static void addLaunchConfigAttribute(ILaunchConfigurationWorkingCopy wc, String key, Object value) {
+ if (value instanceof String) {
+ wc.setAttribute(key, (String)value);
+ }
+ else if (value instanceof List) {
+ wc.setAttribute(key, (List<?>)value);
+ }
+ else if (value instanceof Map) {
+ wc.setAttribute(key, (Map<?,?>)value);
+ }
+ else if (value instanceof Set) {
+ wc.setAttribute(key, (Set<?>)value);
+ }
+ else if (value instanceof Boolean) {
+ wc.setAttribute(key, ((Boolean)value).booleanValue());
+ }
+ else if (value instanceof Number) {
+ wc.setAttribute(key, ((Number)value).intValue());
+ }
+ else {
+ throw new IllegalArgumentException("Unknown attribute type " + value.getClass().getName() + "(" + value.toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Get a sorted list of all launch modes for the given launch configuration type.
+ *
+ * @param launchConfigType The launch configuration type.
+ * @param reverse If <code>true</code> the sorted list order is reversed.
+ *
+ * @return Sorted list of supported launch modes.
+ */
+ public static String[] getLaunchConfigTypeModes(ILaunchConfigurationType launchConfigType, boolean reverse) {
+ return getLaunchConfigTypeModes(new ILaunchConfigurationType[] { launchConfigType }, reverse);
+ }
+
+ /**
+ * Get a sorted list of all launch modes for the given launch configuration types.
+ *
+ * @param launchConfigTypes The launch configuration types.
+ * @param reverse If <code>true</code> the sorted list order is reversed.
+ *
+ * @return Sorted list of supported launch modes.
+ */
+ public static String[] getLaunchConfigTypeModes(ILaunchConfigurationType[] launchConfigTypes, boolean reverse) {
+ List<String> modes = new ArrayList<String>();
+ for (ILaunchConfigurationType launchConfigType : launchConfigTypes) {
+ for (Object modeCombination : launchConfigType.getSupportedModeCombinations()) {
+ if (((Set<?>) modeCombination).size() == 1) {
+ String mode = (String) ((Set<?>) modeCombination).toArray()[0];
+ if (!modes.contains(mode)) {
+ modes.add(mode);
+ }
+ }
+ }
+ }
+ return getLaunchModesSorted(modes.toArray(new String[modes.size()]), reverse);
+ }
+
+ /**
+ * Gets a sorted list of launch mode identifiers.
+ *
+ * @param launchModes The launch modes. Must not be <code>null</code>.
+ * @param reverse If <code>true</code> the sorted list order is reversed.
+ *
+ * @return Sorted list of launch mode identifiers.
+ */
+ public static String[] getLaunchModesSorted(ILaunchMode[] launchModes, boolean reverse) {
+ Assert.isNotNull(launchModes);
+
+ String[] modes = new String[launchModes.length];
+ for (int i = 0; i < launchModes.length; i++) {
+ modes[i] = launchModes[i].getIdentifier();
+ }
+ return getLaunchModesSorted(modes, reverse);
+ }
+
+ /**
+ * Gets a sorted list of launch mode identifiers.
+ *
+ * @param launchModes The unsorted list of launch modes identifiers. Must not be <code>null</code>.
+ * @param reverse If <code>true</code> the sorted list order is reversed.
+ *
+ * @return Sorted list of launch mode identifiers.
+ */
+ public static String[] getLaunchModesSorted(String[] launchModes, final boolean reverse) {
+ Assert.isNotNull(launchModes);
+
+ // sort the list of launch modes
+ // Run is always the first, followed by Debug.
+ // All other modes are sorted alphabetically at the end of the list.
+ Arrays.sort(launchModes, new Comparator<String>() {
+ @Override
+ public int compare(String o1, String o2) {
+ if (o1.equals(ILaunchManager.RUN_MODE) && !o2.equals(ILaunchManager.RUN_MODE)) {
+ return reverse ? 1 : -1;
+ }
+ if (o2.equals(ILaunchManager.RUN_MODE) && !o1.equals(ILaunchManager.RUN_MODE)) {
+ return reverse ? -1 : 1;
+ }
+ if (o1.equals(ILaunchManager.DEBUG_MODE) && !o2.equals(ILaunchManager.DEBUG_MODE)) {
+ return reverse ? 1 : -1;
+ }
+ if (o2.equals(ILaunchManager.DEBUG_MODE) && !o1.equals(ILaunchManager.DEBUG_MODE)) {
+ return reverse ? -1 : 1;
+ }
+ return reverse ? o2.compareTo(o1) : o1.compareTo(o2);
+ }
+ });
+
+ return launchModes;
+ }
+}
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 0de4061..68fa6f0 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
@@ -28,6 +28,7 @@ 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.LaunchConfigHelper;
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.ICommonLaunchAttributes;
@@ -63,28 +64,7 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
protected void copySpecToConfig(ILaunchSpecification launchSpec, ILaunchConfigurationWorkingCopy wc) {
for (ILaunchAttribute attribute : launchSpec.getAllAttributes()) {
- Object value = attribute.getValue();
- if (value instanceof String) {
- wc.setAttribute(attribute.getKey(), (String)value);
- }
- else if (value instanceof List) {
- wc.setAttribute(attribute.getKey(), (List<?>)value);
- }
- else if (value instanceof Map) {
- wc.setAttribute(attribute.getKey(), (Map<?,?>)value);
- }
- else if (value instanceof Set) {
- wc.setAttribute(attribute.getKey(), (Set<?>)value);
- }
- else if (value instanceof Boolean) {
- wc.setAttribute(attribute.getKey(), ((Boolean)value).booleanValue());
- }
- else if (value instanceof Number) {
- wc.setAttribute(attribute.getKey(), ((Number)value).intValue());
- }
- else {
- throw new IllegalArgumentException("Unknown attribute type " + value.getClass().getName() + "(" + value.toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ LaunchConfigHelper.addLaunchConfigAttribute(wc, attribute.getKey(), attribute.getValue());
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/peers/Peer.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/peers/Peer.java
index 9d0d149..9312826 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/peers/Peer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/peers/Peer.java
@@ -13,6 +13,8 @@ import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.core.TransientPeer;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
/**
* Peer implementation.
@@ -40,6 +42,7 @@ public class Peer extends TransientPeer {
Assert.isTrue(attrs.get(ATTR_ID).equals(rw_attrs.get(ATTR_ID)));
rw_attrs.clear();
rw_attrs.putAll(attrs);
+ EventManager.getInstance().fireEvent(new ChangeEvent(this, "updateAttributes", ro_attrs, rw_attrs)); //$NON-NLS-1$
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java
index 8b573bf..6cb0267 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/activator/CoreBundleActivator.java
@@ -1,72 +1,84 @@
-/*******************************************************************************
- * 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.activator;
-
-import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class CoreBundleActivator implements BundleActivator {
- // The bundle context
- private static BundleContext context;
- // The trace handler instance
- private static volatile TraceHandler traceHandler;
-
- /**
- * Returns the bundle context
- *
- * @return the bundle context
- */
- public static BundleContext getContext() {
- return context;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getContext() != null && getContext().getBundle() != null) {
- return getContext().getBundle().getSymbolicName();
- }
- return "org.eclipse.tcf.te.tcf.launch.core"; //$NON-NLS-1$
- }
-
- /**
- * Returns the bundles trace handler.
- *
- * @return The bundles trace handler.
- */
- public static TraceHandler getTraceHandler() {
- if (traceHandler == null) {
- traceHandler = new TraceHandler(getUniqueIdentifier());
- }
- return traceHandler;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext bundleContext) throws Exception {
- CoreBundleActivator.context = bundleContext;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext bundleContext) throws Exception {
- CoreBundleActivator.context = null;
- traceHandler = null;
- }
-}
+/*******************************************************************************
+ * 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.activator;
+
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
+import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
+import org.eclipse.tcf.te.tcf.launch.core.internal.EventListenerDelegate;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CoreBundleActivator implements BundleActivator {
+ // The bundle context
+ private static BundleContext context;
+ // The trace handler instance
+ private static volatile TraceHandler traceHandler;
+ // The event listener to delegate peer attribute changes
+ private IEventListener eventListener;
+
+ /**
+ * Returns the bundle context
+ *
+ * @return the bundle context
+ */
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getContext() != null && getContext().getBundle() != null) {
+ return getContext().getBundle().getSymbolicName();
+ }
+ return "org.eclipse.tcf.te.tcf.launch.core"; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the bundles trace handler.
+ *
+ * @return The bundles trace handler.
+ */
+ public static TraceHandler getTraceHandler() {
+ if (traceHandler == null) {
+ traceHandler = new TraceHandler(getUniqueIdentifier());
+ }
+ return traceHandler;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ CoreBundleActivator.context = bundleContext;
+
+ eventListener = new EventListenerDelegate();
+ EventManager.getInstance().addEventListener(eventListener, ChangeEvent.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ CoreBundleActivator.context = null;
+ traceHandler = null;
+
+ EventManager.getInstance().removeEventListener(eventListener);
+ eventListener = null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/LaunchConfigurationDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/LaunchConfigurationDelegate.java
index 75e96c7..0828722 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/LaunchConfigurationDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/delegates/LaunchConfigurationDelegate.java
@@ -34,8 +34,7 @@ import org.eclipse.tcf.util.TCFTask;
* <li>The launch configuration delegate creates launches of type {@link Launch}.</li>
* </ul>
*/
-@SuppressWarnings("restriction")
-public class LaunchConfigurationDelegate extends org.eclipse.tcf.te.launch.core.lm.internal.LaunchConfigurationDelegate {
+public class LaunchConfigurationDelegate extends org.eclipse.tcf.te.launch.core.delegates.LaunchConfigurationDelegate {
/* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.core.delegates.LaunchConfigurationDelegate#getLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java
new file mode 100644
index 0000000..37fce2b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/EventListenerDelegate.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.tcf.launch.core.internal;
+
+import java.util.EventObject;
+import java.util.Map;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.te.launch.core.lm.LaunchConfigHelper;
+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.persistence.launchcontext.LaunchContextsPersistenceDelegate;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
+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.tcf.launch.core.interfaces.ILaunchTypes;
+import org.eclipse.tcf.te.tcf.launch.core.interfaces.IPeerModelProperties;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * EventListenerDelegate
+ */
+public class EventListenerDelegate implements IEventListener {
+
+ /**
+ * Constructor.
+ */
+ public EventListenerDelegate() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
+ */
+ @Override
+ public void eventFired(EventObject event) {
+ if (event instanceof ChangeEvent && event.getSource() instanceof IPeer) {
+ IPeer peer = (IPeer)event.getSource();
+ String launchConfigAttributes = peer.getAttributes().get(IPeerModelProperties.PROP_LAUNCH_CONFIG_ATTRIBUTES);
+ try {
+ for (ILaunchConfiguration config : DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(ILaunchTypes.ATTACH))) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(config);
+ if (contexts != null && contexts.length == 1 && contexts[0] instanceof IPeerModel && ((IPeerModel)contexts[0]).getPeerId().equalsIgnoreCase(peer.getID())) {
+ 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);
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ for (String key : attributes.keySet()) {
+ LaunchConfigHelper.addLaunchConfigAttribute(wc, key, attributes.get(key));
+ }
+ wc.doSave();
+ }
+ catch (Exception e) {
+ }
+
+ }
+ }
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+}