Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruwe2013-08-27 09:23:16 -0400
committeruwe2013-08-27 09:23:43 -0400
commit02426d4443e31f0943c4b71ee46a1157cc8bbbc6 (patch)
tree62835c1a4eed1f5a5d9793ddfa7f25ab894c561b /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core
parentf4e721a6e6c20f7f99a72bd2f77ff7a8909e8b0d (diff)
downloadorg.eclipse.tcf-02426d4443e31f0943c4b71ee46a1157cc8bbbc6.tar.gz
org.eclipse.tcf-02426d4443e31f0943c4b71ee46a1157cc8bbbc6.tar.xz
org.eclipse.tcf-02426d4443e31f0943c4b71ee46a1157cc8bbbc6.zip
Target Explorer: Add path map handling to channel manager
If a channel is opened to a peer, and there is a configured path map for that peer, IPathMap.set will be called automatically for the newly opened channel.
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/plugin.xml11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties3
5 files changed, 81 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml
index caf8d4540..b83757d2d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/plugin.xml
@@ -15,6 +15,12 @@
<adapter type="org.eclipse.debug.core.ILaunchConfiguration"/>
<adapter type="org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"/>
</factory>
+ <factory
+ adaptableType="org.eclipse.tcf.protocol.IPeer"
+ class="org.eclipse.tcf.te.tcf.launch.core.internal.adapters.AdapterFactory">
+ <adapter type="org.eclipse.debug.core.ILaunchConfiguration"/>
+ <adapter type="org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"/>
+ </factory>
</extension>
<!-- Service contributions -->
@@ -29,6 +35,11 @@
class="org.eclipse.tcf.te.tcf.launch.core.internal.services.ExportPersistenceService">
<serviceType class="org.eclipse.tcf.te.tcf.core.interfaces.IExportPersistenceService"/>
</service>
+ <service
+ id="org.eclipse.tcf.te.tcf.launch.services.pathmap"
+ class="org.eclipse.tcf.te.tcf.launch.core.internal.services.PathMapService">
+ <serviceType class="org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService"/>
+ </service>
</extension>
<!-- Launch Configuration Type contributions -->
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
index 4460b12e1..44fdd98b3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
@@ -18,10 +18,13 @@ import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService;
+import org.eclipse.tcf.te.tcf.locator.model.Model;
/**
* Adapter factory implementation.
@@ -107,6 +110,11 @@ public class AdapterFactory implements IAdapterFactory {
}
}
}
+ else if (adaptableObject instanceof IPeer) {
+ ILocatorModelLookupService service = Model.getModel().getService(ILocatorModelLookupService.class);
+ IPeerModel peerModel = service != null ? service.lkupPeerModelById(((IPeer)adaptableObject).getID()) : null;
+ if (peerModel != null) return getAdapter(peerModel, adapterType);
+ }
return null;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
new file mode 100644
index 000000000..435452816
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.services;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate;
+import org.eclipse.tcf.services.IPathMap.PathMapRule;
+import org.eclipse.tcf.te.runtime.services.AbstractService;
+import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService;
+
+/**
+ * Path map service implementation.
+ */
+public class PathMapService extends AbstractService implements IPathMapService {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService#getPathMap(java.lang.Object)
+ */
+ @Override
+ public PathMapRule[] getPathMap(Object context) {
+ Assert.isNotNull(context);
+
+ PathMapRule[] rules = null;
+
+ // Get the launch configuration for that peer model
+ ILaunchConfiguration config = (ILaunchConfiguration) Platform.getAdapterManager().getAdapter(context, ILaunchConfiguration.class);
+ if (config == null) {
+ config = (ILaunchConfiguration) Platform.getAdapterManager().loadAdapter(context, "org.eclipse.debug.core.ILaunchConfiguration"); //$NON-NLS-1$
+ }
+
+ if (config != null) {
+ try {
+ String path_map_cfg = config.getAttribute(TCFLaunchDelegate.ATTR_PATH_MAP, ""); //$NON-NLS-1$
+ ArrayList<org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.PathMapRule> map = TCFLaunchDelegate.parsePathMapAttribute(path_map_cfg);
+ if (map != null && !map.isEmpty()) {
+ rules = map.toArray(new PathMapRule[map.size()]);
+ }
+ } catch (CoreException e) { /* ignored on purpose */ }
+ }
+
+ return rules;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java
index 513446a6f..1934cf60a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.java
@@ -35,4 +35,7 @@ public class Messages extends NLS {
public static String FileTransferItemValidator_notExistingFileOrDirectory;
public static String FileTransferItemValidator_invalidFile;
public static String FileTransferItemValidator_invalidFileOrDirectory;
+
+ public static String SetPathMapStep_error_missingChannel;
+ public static String SetPathMapStep_error_missingLaunchConfig;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties
index 90ef201a0..2527fc788 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/nls/Messages.properties
@@ -14,3 +14,6 @@ FileTransferItemValidator_notExistingFile = File does not exist or is not readab
FileTransferItemValidator_notExistingFileOrDirectory = File or directory does not exist or is not writeable
FileTransferItemValidator_invalidFile = File is not valid
FileTransferItemValidator_invalidFileOrDirectory = File or directory is not valid
+
+SetPathMapStep_error_missingChannel=Missing TCF channel or channel not open.
+SetPathMapStep_error_missingLaunchConfig=Failed to get launch configuration for connection ''{0}''.

Back to the top