Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-02-23 01:59:42 -0500
committerUwe Stieber2012-02-23 02:27:47 -0500
commit00619466ecda919b32c127dd80ba9944266c9c42 (patch)
tree1a13a1734768636ca10d71f6e2decbebf5c50d11
parent4c241386867caaa80b65abfb5c4a64cf87b74dfd (diff)
downloadorg.eclipse.tcf-00619466ecda919b32c127dd80ba9944266c9c42.tar.gz
org.eclipse.tcf-00619466ecda919b32c127dd80ba9944266c9c42.tar.xz
org.eclipse.tcf-00619466ecda919b32c127dd80ba9944266c9c42.zip
Target Explorer: Do not cache step context adapters for InvalidPeerModel objects
-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
1 files changed, 6 insertions, 2 deletions
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 e375bd046..afd1bfba4 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
@@ -19,12 +19,14 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.tcf.locator.interfaces.IModelListener;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.internal.nodes.InvalidPeerModel;
import org.eclipse.tcf.te.tcf.locator.listener.ModelAdapter;
import org.eclipse.tcf.te.tcf.locator.model.Model;
/**
* Adapter factory implementation.
*/
+@SuppressWarnings("restriction")
public class AdapterFactory implements IAdapterFactory {
// Maintain a map of step context adapters per peer model
/* default */ Map<IPeerModel, IStepContext> adapters = new HashMap<IPeerModel, IStepContext>();
@@ -65,7 +67,7 @@ public class AdapterFactory implements IAdapterFactory {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
- @Override
+ @Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof IPeerModel) {
if (IStepContext.class.equals(adapterType)) {
@@ -74,7 +76,9 @@ public class AdapterFactory implements IAdapterFactory {
// No adapter yet -> create a new one for this peer
if (adapter == null) {
adapter = new StepContextAdapter((IPeerModel)adaptableObject);
- adapters.put((IPeerModel)adaptableObject, adapter);
+ if (!(adaptableObject instanceof InvalidPeerModel)) {
+ adapters.put((IPeerModel)adaptableObject, adapter);
+ }
}
return adapter;
}

Back to the top