diff options
author | Pablo Torregrosa Paez | 2016-03-10 08:32:17 +0000 |
---|---|---|
committer | Pablo Torregrosa Paez | 2016-03-10 08:32:17 +0000 |
commit | d1a7ae6b18ef7f1b56c5f00175da27d1d5787e56 (patch) | |
tree | 89d4e60b3ba37648a36fc440e13188376172d2ee /target_explorer/plugins | |
parent | 6c424436a8410542b81c80d54efce8fa3952f62a (diff) | |
download | org.eclipse.tcf-d1a7ae6b18ef7f1b56c5f00175da27d1d5787e56.tar.gz org.eclipse.tcf-d1a7ae6b18ef7f1b56c5f00175da27d1d5787e56.tar.xz org.eclipse.tcf-d1a7ae6b18ef7f1b56c5f00175da27d1d5787e56.zip |
Target Explorer: Fixed shared PathMap listener removes only shared ones
Change-Id: I34d92f5e654cd75a60e721c2471bce905e39c4fb
Signed-off-by: Pablo Torregrosa Paez <pablo.torregrosa@windriver.com>
Diffstat (limited to 'target_explorer/plugins')
3 files changed, 41 insertions, 3 deletions
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 index 3a40768c5..98077e7bb 100644 --- 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2014 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 2016 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 @@ -51,6 +51,15 @@ public interface IPathMapService extends IService { public IPathMap.PathMapRule[] getPathMap(Object context); /** + * Returns the configured shared path mapping rules for the given context. + * <p> + * + * @param context The context. Must not be <code>null</code>. + * @return The configured shared path map or <code>null</code>. + */ + public IPathMap.PathMapRule[] getSharedPathMapRules(Object context); + + /** * Adds a new path mapping rule to the configured (object) path mapping for the * given context. * <p> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/AttachPathMapsListenerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/AttachPathMapsListenerStep.java index 71b5022f1..282862f8b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/AttachPathMapsListenerStep.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/AttachPathMapsListenerStep.java @@ -82,8 +82,8 @@ public class AttachPathMapsListenerStep extends AbstractPeerStep { public void run() { final IPathMapService service = ServiceManager.getInstance().getService(peer, IPathMapService.class); if (service != null) { - // Update path map rules comparing existing and new ones - PathMapRule[] existingRulesArray = service.getPathMap(peer); + // Update shared path map rules comparing existing and new ones + PathMapRule[] existingRulesArray = service.getSharedPathMapRules(peer); List<PathMapRule> existingRules; if (existingRulesArray != null) { existingRules = Arrays.asList(existingRulesArray); 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 index 71972ab2f..44b5f3acc 100644 --- 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 @@ -400,6 +400,7 @@ public class PathMapService extends AbstractService implements IPathMapService { */ @Override public void cleanSharedPathMapRules(Object context) { + Assert.isTrue(!Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ Assert.isNotNull(context); if (context instanceof IPeer) { @@ -708,4 +709,32 @@ public class PathMapService extends AbstractService implements IPathMapService { public String getClientID() { return org.eclipse.tcf.internal.debug.Activator.getClientID(); } + + /* + * (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService#getSharedPathMapRules(java.lang.Object) + */ + + @Override + public PathMapRule[] getSharedPathMapRules(Object context) { + Assert.isNotNull(context); + + PathMapRule[] rules = null; + try { + // Acquire the lock before accessing the shared path mappings + lock.lock(); + + if (sharedPathMapRules != null ) { + List<PathMapRule> sharedRules = sharedPathMapRules.get(((IPeer)context).getID()); + if (sharedRules != null && sharedRules.size() > 0) { + rules = sharedRules.toArray(new IPathMap.PathMapRule[sharedRules.size()]); + } + } + } finally { + // Release the lock + lock.unlock(); + } + + return rules; + } } |