Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IChannelManager.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java53
-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
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java124
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java76
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/help/IContextHelpIds.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java4
16 files changed, 312 insertions, 83 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IChannelManager.java
index cfc9e44fc..2d742def0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IChannelManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IChannelManager.java
@@ -32,7 +32,7 @@ public interface IChannelManager extends IAdaptable {
public static final String FLAG_FORCE_NEW = "forceNew"; //$NON-NLS-1$
/**
- * If set to <code>true</code>, a new and not reference counted channel is is opened,
+ * If set to <code>true</code>, a new and not reference counted channel is opened,
* and no value add is launched and associated with the channel. This option should
* be used with extreme caution.
* <p>
@@ -45,6 +45,18 @@ public interface IChannelManager extends IAdaptable {
public static final String FLAG_NO_VALUE_ADD = "noValueAdd"; //$NON-NLS-1$
/**
+ * If set to <code>true</code>, a new and not reference counted channel is opened,
+ * and the configured path map is not auto applied to the opened channel.
+ * <p>
+ * The returned channel must be closed by the caller himself. The channel manager
+ * is not keeping track of non reference counted channels.
+ * <p>
+ * If not present in the flags map passed in to open channel, the default value is
+ * <code>false</code>.
+ */
+ public static final String FLAG_NO_PATH_MAP = "noPathMap"; //$NON-NLS-1$
+
+ /**
* Client call back interface for openChannel(...).
*/
interface DoneOpenChannel {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java
new file mode 100644
index 000000000..e6a49de86
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IPathMapService.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.core.interfaces;
+
+import org.eclipse.tcf.services.IPathMap;
+import org.eclipse.tcf.te.runtime.services.interfaces.IService;
+
+/**
+ * Path map service.
+ * <p>
+ * Allow the access to the configured path maps for a given context.
+ */
+public interface IPathMapService extends IService {
+
+ /**
+ * Return the configured (object) path mappings for the given context.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @return The configured path map or <code>null</code>.
+ */
+ public IPathMap.PathMapRule[] getPathMap(Object context);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
index 7b7496f49..b5e26a170 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
@@ -26,10 +26,15 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.tcf.core.AbstractPeer;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IPathMap;
+import org.eclipse.tcf.services.IPathMap.PathMapRule;
import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService;
import org.eclipse.tcf.te.tcf.core.interfaces.tracing.ITraceIds;
import org.eclipse.tcf.te.tcf.core.nls.Messages;
import org.eclipse.tcf.te.tcf.core.peers.Peer;
@@ -68,6 +73,43 @@ public final class ChannelManager extends PlatformObject implements IChannelMana
}
}
+ DoneOpenChannel innerDone = null;
+ boolean noPathMap = flags != null && flags.containsKey(IChannelManager.FLAG_NO_PATH_MAP) ? flags.get(IChannelManager.FLAG_NO_PATH_MAP).booleanValue() : false;
+ if (noPathMap) {
+ innerDone = done;
+ } else {
+ innerDone = new DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(final Throwable error, final IChannel channel) {
+ // If open channel failed, pass on to the original done
+ if (error != null || channel == null || channel.getState() != IChannel.STATE_OPEN) {
+ done.doneOpenChannel(error, channel);
+ } else {
+ // Take care of the path map
+ final IPathMapService service = ServiceManager.getInstance().getService(peer, IPathMapService.class);
+ final IPathMap svc = channel.getRemoteService(IPathMap.class);
+ if (service != null && svc != null) {
+ // Get the configured path maps
+ final PathMapRule[] map = service.getPathMap(peer);
+ if (map != null && map.length > 0) {
+ svc.set(map, new IPathMap.DoneSet() {
+ @Override
+ public void doneSet(IToken token, Exception e) {
+ done.doneOpenChannel(error, channel);
+ }
+ });
+ } else {
+ done.doneOpenChannel(error, channel);
+ }
+ } else {
+ done.doneOpenChannel(error, channel);
+ }
+ }
+ }
+ };
+ }
+ final DoneOpenChannel finInnerDone = innerDone;
+
Runnable runnable = new Runnable() {
@Override
public void run() {
@@ -82,16 +124,16 @@ public final class ChannelManager extends PlatformObject implements IChannelMana
// Do we have any value add in the chain?
if (valueAdds != null && valueAdds.length > 0) {
// There are value-add's -> chain them now
- internalChainValueAdds(valueAdds, peer, flags, done);
+ internalChainValueAdds(valueAdds, peer, flags, finInnerDone);
} else {
// No value-add's -> open a channel to the target peer directly
- internalOpenChannel(peer, flags, done);
+ internalOpenChannel(peer, flags, finInnerDone);
}
} else {
// Shutdown the value-add's launched
internalShutdownValueAdds(peer, valueAdds);
// Fail the channel opening
- done.doneOpenChannel(error, null);
+ finInnerDone.doneOpenChannel(error, null);
}
}
});
@@ -846,8 +888,9 @@ public final class ChannelManager extends PlatformObject implements IChannelMana
// Extract the flags of interest form the given flags map
boolean forceNew = flags != null && flags.containsKey(IChannelManager.FLAG_FORCE_NEW) ? flags.get(IChannelManager.FLAG_FORCE_NEW).booleanValue() : false;
boolean noValueAdd = flags != null && flags.containsKey(IChannelManager.FLAG_NO_VALUE_ADD) ? flags.get(IChannelManager.FLAG_NO_VALUE_ADD).booleanValue() : false;
- // If noValueAdd == true -> forceNew has to be true as well
- if (noValueAdd) forceNew = true;
+ boolean noPathMap = flags != null && flags.containsKey(IChannelManager.FLAG_NO_PATH_MAP) ? flags.get(IChannelManager.FLAG_NO_PATH_MAP).booleanValue() : false;
+ // If noValueAdd == true or noPathMap == true -> forceNew has to be true as well
+ if (noValueAdd || noPathMap) forceNew = true;
// Check if there is already a channel opened to this peer
IChannel channel = !forceNew ? channels.get(id) : null;
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}''.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
index fb74320cc..70069a929 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/META-INF/MANIFEST.MF
@@ -19,6 +19,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.tcf.te.runtime.model;bundle-version="1.2.0",
org.eclipse.tcf.te.runtime.persistence;bundle-version="1.2.0",
org.eclipse.tcf.te.runtime.services;bundle-version="1.2.0",
+ org.eclipse.tcf.te.runtime.statushandler;bundle-version="1.2.0",
org.eclipse.tcf.te.tcf.core;bundle-version="1.2.0",
org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.2.0",
org.eclipse.tcf.te.tcf.filesystem.ui;bundle-version="1.2.0",
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
index 154fb7861..de8dee592 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/AbstractTcfLaunchTabContainerEditorPage.java
@@ -45,10 +45,8 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
return (IPeerModel) ((IAdaptable) input).getAdapter(IPeerModel.class);
}
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#hasApplyAction()
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#hasApplyAction()
*/
@Override
protected boolean hasApplyAction() {
@@ -69,29 +67,22 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
public static ILaunchConfigurationWorkingCopy getLaunchConfig(final IPeerModel peerModel) {
ILaunchConfigurationWorkingCopy wc = null;
if (peerModel != null) {
- IPropertiesAccessService service = ServiceManager.getInstance()
- .getService(peerModel, IPropertiesAccessService.class);
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
Assert.isNotNull(service);
if (service.getProperty(peerModel, PROP_LAUNCH_CONFIG_WC) instanceof ILaunchConfigurationWorkingCopy) {
- wc = (ILaunchConfigurationWorkingCopy) service
- .getProperty(peerModel, PROP_LAUNCH_CONFIG_WC);
+ wc = (ILaunchConfigurationWorkingCopy) service.getProperty(peerModel, PROP_LAUNCH_CONFIG_WC);
}
else {
- wc = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager()
- .getAdapter(peerModel, ILaunchConfigurationWorkingCopy.class);
+ wc = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().getAdapter(peerModel, ILaunchConfigurationWorkingCopy.class);
if (wc == null) {
- wc = (ILaunchConfigurationWorkingCopy) Platform
- .getAdapterManager()
- .loadAdapter(peerModel, "org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"); //$NON-NLS-1$
+ wc = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().loadAdapter(peerModel, "org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"); //$NON-NLS-1$
}
Assert.isNotNull(wc);
service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, wc);
- IPersistenceDelegate delegate = PersistenceManager.getInstance()
- .getDelegate(wc, String.class);
+ IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(wc, String.class);
String launchConfigAttributes = null;
try {
- launchConfigAttributes = delegate != null ? (String) delegate
- .write(wc, String.class) : null;
+ launchConfigAttributes = delegate != null ? (String) delegate.write(wc, String.class) : null;
}
catch (Exception e) {
/* ignored on purpose */
@@ -102,11 +93,8 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
return wc;
}
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setupData(java.lang
- * .Object)
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setupData(java.lang.Object)
*/
@Override
public boolean setupData(Object input) {
@@ -119,8 +107,7 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
return false;
}
- /*
- * (non-Javadoc)
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#extractData()
*/
@Override
@@ -132,12 +119,12 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
if (wc != null && checkLaunchConfigDirty()) {
getLaunchConfigurationTab().performApply(wc);
try {
- wc.doSave();
IPeerModel peerModel = getPeerModel(getEditorInput());
- IPropertiesAccessService service = ServiceManager.getInstance()
- .getService(peerModel, IPropertiesAccessService.class);
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
Assert.isNotNull(service);
service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, null);
+ wc.doSave();
+ onPostSave(wc);
checkLaunchConfigDirty();
return true;
}
@@ -155,16 +142,12 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
public boolean checkLaunchConfigDirty() {
boolean dirty = false;
IPeerModel peerModel = getPeerModel(getEditorInput());
- IPropertiesAccessService service = ServiceManager.getInstance()
- .getService(peerModel, IPropertiesAccessService.class);
- String oldLaunchConfigAttributes = (String) service
- .getProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES);
- IPersistenceDelegate delegate = PersistenceManager.getInstance()
- .getDelegate(getLaunchConfig(peerModel), String.class);
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
+ String oldLaunchConfigAttributes = (String) service.getProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES);
+ IPersistenceDelegate delegate = PersistenceManager.getInstance().getDelegate(getLaunchConfig(peerModel), String.class);
String launchConfigAttributes = null;
try {
- launchConfigAttributes = (String) delegate
- .write(getLaunchConfig(peerModel), String.class);
+ launchConfigAttributes = (String) delegate.write(getLaunchConfig(peerModel), String.class);
dirty = !launchConfigAttributes.equals(oldLaunchConfigAttributes);
}
catch (Exception e) {
@@ -173,24 +156,23 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
return dirty;
}
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setDirty(boolean)
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setDirty(boolean)
*/
@Override
public void setDirty(boolean dirty) {
if (isAutoSave()) {
final ILaunchConfigurationWorkingCopy wc = getLaunchConfig(getPeerModel(getEditorInput()));
if (wc != null && dirty) {
- IPeerModel peerModel = getPeerModel(getEditorInput());
- IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
- service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, null);
- try {
- wc.doSave();
- }
- catch (Exception e) {
- }
+ IPeerModel peerModel = getPeerModel(getEditorInput());
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
+ service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, null);
+ try {
+ wc.doSave();
+ onPostSave(wc);
+ }
+ catch (Exception e) {
+ }
}
}
else {
@@ -204,10 +186,17 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
}
}
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setActive(boolean)
+ /**
+ * Called once the editor page got saved.
+ *
+ * @param config The launch configuration saved. Must not be <code>null</code>.
+ */
+ protected void onPostSave(ILaunchConfiguration config) {
+ Assert.isNotNull(config);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#setActive(boolean)
*/
@Override
public void setActive(boolean active) {
@@ -218,56 +207,43 @@ public abstract class AbstractTcfLaunchTabContainerEditorPage extends AbstractLa
}
}
- /*
- * (non-Javadoc)
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.launch.ui.editor.AbstractLaunchTabContainerEditorPage#dispose()
*/
@Override
public void dispose() {
super.dispose();
IPeerModel peerModel = getPeerModel(getEditorInput());
- IPropertiesAccessService service = ServiceManager.getInstance()
- .getService(peerModel, IPropertiesAccessService.class);
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
service.setProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES, null);
service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, null);
DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(this);
launchConfigListener = null;
}
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.
- * debug.core.ILaunchConfiguration)
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
}
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse
- * .debug.core.ILaunchConfiguration)
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
}
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse
- * .debug.core.ILaunchConfiguration)
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override
public void launchConfigurationChanged(ILaunchConfiguration configuration) {
if (!(configuration instanceof ILaunchConfigurationWorkingCopy)) {
IPeerModel peerModel = getPeerModel(getEditorInput());
- IPropertiesAccessService service = ServiceManager.getInstance()
- .getService(peerModel, IPropertiesAccessService.class);
- ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) service
- .getProperty(peerModel, PROP_LAUNCH_CONFIG_WC);
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(peerModel, IPropertiesAccessService.class);
+ ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) service.getProperty(peerModel, PROP_LAUNCH_CONFIG_WC);
if (wc != null && configuration.getName().equals(wc.getName())) {
service.setProperty(peerModel, PROP_ORIGINAL_LAUNCH_CONFIG_ATTRIBUTES, null);
service.setProperty(peerModel, PROP_LAUNCH_CONFIG_WC, null);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
index 4f9890de3..874d3ac58 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/PathMapEditorPage.java
@@ -9,8 +9,31 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.ui.editor;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IPathMap;
+import org.eclipse.tcf.services.IPathMap.PathMapRule;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService;
+import org.eclipse.tcf.te.tcf.launch.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.launch.ui.editor.tabs.PathMapTab;
+import org.eclipse.tcf.te.tcf.launch.ui.help.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.launch.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
/**
* TCF path map launch configuration tab container page implementation.
@@ -24,4 +47,57 @@ public class PathMapEditorPage extends AbstractTcfLaunchTabContainerEditorPage {
protected AbstractLaunchConfigurationTab createLaunchConfigurationTab() {
return new PathMapTab(this);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.launch.ui.editor.AbstractTcfLaunchTabContainerEditorPage#onPostSave(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ protected void onPostSave(ILaunchConfiguration config) {
+ Assert.isNotNull(config);
+
+ final IPeerModel peerModel = getPeerModel(getEditorInput());
+ if (peerModel != null && peerModel.getPeer() != null) {
+ final IChannel channel = Tcf.getChannelManager().getChannel(peerModel.getPeer());
+ if (channel != null && IChannel.STATE_OPEN == channel.getState()) {
+ // Channel is open -> Have to update the path maps
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ final IPeer peer = peerModel.getPeer();
+ final IPathMapService service = ServiceManager.getInstance().getService(peer, IPathMapService.class);
+ final IPathMap svc = channel.getRemoteService(IPathMap.class);
+ if (service != null && svc != null) {
+ final PathMapRule[] map = service.getPathMap(peer);
+ if (map != null && map.length > 0) {
+ svc.set(map, new IPathMap.DoneSet() {
+ @Override
+ public void doneSet(IToken token, Exception error) {
+ if (error != null) {
+ IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
+ NLS.bind(Messages.PathMapEditorPage_error_apply, peerModel.getName(), error.getLocalizedMessage()),
+ error);
+ IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(peerModel);
+ if (handlers.length > 0) {
+ IPropertiesContainer data = new PropertiesContainer();
+ data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.PathMapEditorPage_error_title);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_APPLY_PATHMAP_FAILED);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
+
+ handlers[0].handleStatus(status, data, null);
+ } else {
+ UIPlugin.getDefault().getLog().log(status);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ }
+ };
+
+ Protocol.invokeLater(runnable);
+ }
+ }
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/help/IContextHelpIds.java
index fb76dad0d..be6bcecd2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/help/IContextHelpIds.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/help/IContextHelpIds.java
@@ -27,4 +27,9 @@ public interface IContextHelpIds {
* Remote Linux Application launch tab group context help id.
*/
public final static String REMOTE_LINUX_APPLICATION = ILaunchTypes.REMOTE_APPLICATION + ".tabGroup"; //$NON-NLS-1$
+
+ /**
+ * Path map editor page: Apply path map failed.
+ */
+ public final static String MESSAGE_APPLY_PATHMAP_FAILED = PREFIX + ".status.messageApplyPathMapFailed"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java
index b705cf297..45d214b9c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java
@@ -96,6 +96,8 @@ public class Messages extends NLS {
public static String LaunchConfigurationAdvancedTabSection_lineseparator_cr;
public static String PathMapEditorPage_name;
+ public static String PathMapEditorPage_error_apply;
+ public static String PathMapEditorPage_error_title;
public static String SourceLookupEditorPage_name;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties
index 0d3495ded..3360a6796 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties
@@ -37,6 +37,8 @@ LaunchConfigurationAdvancedTabSection_lineseparator_crlf=CRLF
LaunchConfigurationAdvancedTabSection_lineseparator_cr=CR
PathMapEditorPage_name=Object Paths
+PathMapEditorPage_error_apply=Failed to update object paths for connection ''{0}''.\n\nPossible cause:\n{1}
+PathMapEditorPage_error_title=Error
SourceLookupEditorPage_name=Source Paths
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java
index 33377d642..356f3536a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java
@@ -211,7 +211,9 @@ public class LocatorModelPeerNodeQueryService extends AbstractLocatorModelServic
}
// Opens a channel with the full value-add chain
- Tcf.getChannelManager().openChannel(node.getPeer(), null, new IChannelManager.DoneOpenChannel() {
+ Map<String, Boolean> flags = new HashMap<String, Boolean>();
+ flags.put(IChannelManager.FLAG_NO_PATH_MAP, Boolean.TRUE);
+ Tcf.getChannelManager().openChannel(node.getPeer(), flags, new IChannelManager.DoneOpenChannel() {
@Override
public void doneOpenChannel(Throwable error, IChannel channel) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
index dc8589b02..f907350c9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
@@ -114,6 +114,7 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
this.streamsProxy = streamsProxy;
}
+
/* (non-Javadoc)
* @see org.eclipse.tcf.te.tcf.processes.core.interfaces.launcher.IProcessLauncher#dispose()
*/
@@ -392,7 +393,6 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
}
});
-
// Check if the channel is in connected state
if (channel.getState() != IChannel.STATE_OPEN) {
IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(),
@@ -437,7 +437,7 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
return;
}
- // Execute the launch now
+ // Execute the launch
executeLaunch();
}

Back to the top