Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2011-11-10 09:04:19 -0500
committerUwe Stieber2011-11-10 09:04:19 -0500
commit28d54f63a4c6c16dc256b9126922064c5866ac60 (patch)
treeddc529454fb94e7ea4e13bf41e7d2c1a75d737ad
parent46e8e84123c3c3a349418fa9c4abc056f7de8c24 (diff)
downloadorg.eclipse.tcf-28d54f63a4c6c16dc256b9126922064c5866ac60.tar.gz
org.eclipse.tcf-28d54f63a4c6c16dc256b9126922064c5866ac60.tar.xz
org.eclipse.tcf-28d54f63a4c6c16dc256b9126922064c5866ac60.zip
Target Explorer: Fix thread access issue on adding the locator model listener to refresh the view
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/navigator/ContentProviderDelegate.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/navigator/ContentProviderDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/navigator/ContentProviderDelegate.java
index bb7f0ad5e..92b6b03fc 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/navigator/ContentProviderDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/navigator/ContentProviderDelegate.java
@@ -12,7 +12,6 @@ package org.eclipse.tm.te.tcf.ui.internal.navigator;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.te.tcf.core.Tcf;
import org.eclipse.tm.te.tcf.locator.interfaces.IModelListener;
import org.eclipse.tm.te.tcf.locator.interfaces.nodes.ILocatorModel;
import org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModel;
@@ -29,7 +28,7 @@ public class ContentProviderDelegate implements ITreeContentProvider {
private final static Object[] NO_ELEMENTS = new Object[0];
// The locator model listener instance
- private IModelListener modelListener = null;
+ /* default */ IModelListener modelListener = null;
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
@@ -103,22 +102,22 @@ public class ContentProviderDelegate implements ITreeContentProvider {
// Create and attach the model listener if not yet done
if (modelListener == null && model != null && viewer instanceof CommonViewer) {
modelListener = new ModelListener(model, (CommonViewer)viewer);
- model.addListener(modelListener);
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ model.addListener(modelListener);
+ }
+ });
}
- // Refresh the model
if (model != null && newInput instanceof IRoot) {
- // If the TCF framework is not running yet, run the refresh asynchronous
- if (Tcf.isRunning() && Protocol.isDispatchThread()) {
- model.getService(ILocatorModelRefreshService.class).refresh();
- } else {
- Protocol.invokeLater(new Runnable() {
- @Override
- public void run() {
- model.getService(ILocatorModelRefreshService.class).refresh();
- }
- });
- }
+ // Refresh the model asynchronously
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ model.getService(ILocatorModelRefreshService.class).refresh();
+ }
+ });
}
}
}

Back to the top