From 0006e4ba15db599830f5e61017dab5b1019998ee Mon Sep 17 00:00:00 2001 From: Pawel Piech Date: Wed, 16 Jul 2008 18:34:24 +0000 Subject: [PATCH] [241024] - [view model] Most views stop refereshing after a breakpoint hit after a long operation (e.g. sleep) --- .../dd/dsf/ui/viewmodel/AbstractVMProvider.java | 12 ++++++++++++ .../eclipse/dd/dsf/ui/viewmodel/IVMModelProxy.java | 3 +++ .../viewmodel/update/AbstractCachingVMProvider.java | 12 ++++++++++++ 3 files changed, 27 insertions(+) diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMProvider.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMProvider.java index eac4f630394..7f9be5304ff 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMProvider.java @@ -566,9 +566,21 @@ abstract public class AbstractVMProvider implements IVMProvider, IVMEventListene } } } + if (proxy == null) { proxy = createModelProxyStrategy(element); getActiveModelProxies().add(proxy); + } else if (proxy.isDisposed()) { + // DSF is capable of re-using old proxies which were previously + // disposed. However, the viewer which installs a proxy using + // a background job to install the proxy calls + // IModelProxy.isDisposed(), to check whether the proxy was disposed + // before it could be installed. We need to clear the disposed flag + // of the re-used proxy here, otherwise the proxy will never get used. + // Calling init here will cause the init() method to be called twice + // so the IVMModelProxy needs to be prepared for that. + // See bug 241024. + proxy.init(context); } return proxy; } diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMModelProxy.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMModelProxy.java index 13fefb29aca..9aa86de900b 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMModelProxy.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/IVMModelProxy.java @@ -18,6 +18,9 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; * View Model extension to the platform IModelProxy interface. This extension * allows the IVMProvider implementation to delegate the model proxy implementation * into a separate object. + *
+ * Note: The IVMModelProxy.init() may be called twice when installed, as a + * workaround for bug 241024. */ @SuppressWarnings("restriction") public interface IVMModelProxy extends IModelProxy { diff --git a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java index 8a8894d0cb5..e1cd5d58933 100644 --- a/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/AbstractCachingVMProvider.java @@ -601,11 +601,23 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa IVMModelProxy next = itr.next(); if (next != null && next.getRootElement().equals(element)) { proxy = next; + break; } } if (proxy == null) { proxy = createModelProxyStrategy(element); getActiveModelProxies().add(proxy); + } else if (proxy.isDisposed()) { + // DSF is capable of re-using old proxies which were previously + // disposed. However, the viewer which installs a proxy using + // a background job to install the proxy calls + // IModelProxy.isDisposed(), to check whether the proxy was disposed + // before it could be installed. We need to clear the disposed flag + // of the re-used proxy here, otherwise the proxy will never get used. + // Calling init here will cause the init() method to be called twice + // so the IVMModelProxy needs to be prepared for that. + // See bug 241024. + proxy.init(context); } return proxy; }