diff options
author | Uwe Stieber | 2015-08-07 11:46:14 +0000 |
---|---|---|
committer | Uwe Stieber | 2015-08-07 11:46:14 +0000 |
commit | 53a474aee39d4bf9fb5614167f3059e560c47b86 (patch) | |
tree | 7f8d52a69c57740f3d9ad42d3dca7e5ac8055d34 /target_explorer | |
parent | dc46aac3d23814ad2b499793ac869de7cb7ead82 (diff) | |
download | org.eclipse.tcf-53a474aee39d4bf9fb5614167f3059e560c47b86.tar.gz org.eclipse.tcf-53a474aee39d4bf9fb5614167f3059e560c47b86.tar.xz org.eclipse.tcf-53a474aee39d4bf9fb5614167f3059e560c47b86.zip |
Target Explorer: Fix connection lost on process monitor tree refresh if a context becomes invalid during the refresh
Diffstat (limited to 'target_explorer')
3 files changed, 19 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNodeProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNodeProperties.java index 6331f7f58..569ba8ff5 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNodeProperties.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNodeProperties.java @@ -46,4 +46,9 @@ public interface IProcessContextNodeProperties { * The property data is a <code>List<Map<String, Object>></code>. */ public static final String PROPERTY_PARAMETER_LIST = "parameterList"; //$NON-NLS-1$ + + /** + * Property is set if the context becomes invalid during a refresh. + */ + public static final String PROPERTY_INVALID_CTX = "invalidCtx"; //$NON-NLS-1$ } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java index cfcfe1dab..e225c7556 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java @@ -32,6 +32,7 @@ import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryState; import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryType; import org.eclipse.tcf.te.runtime.services.ServiceUtils; +import org.eclipse.tcf.te.runtime.utils.StatusHelper; import org.eclipse.tcf.te.tcf.core.async.CallbackInvocationDelegate; import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelChannelService; import org.eclipse.tcf.te.tcf.core.model.services.AbstractModelService; @@ -1003,7 +1004,14 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod callback.done(RuntimeModelRefreshService.this, Status.OK_STATUS); } } else { - callback.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getLocalizedMessage(), error)); + if (StatusHelper.unwrapErrorReport(error.getLocalizedMessage()).equals("Invalid context")) { //$NON-NLS-1$ + // OK, the context got invalid during the query. Mark the + // context as invalid and return with OK to keep the refresh going + container.setProperty(IProcessContextNodeProperties.PROPERTY_INVALID_CTX, true); + callback.done(RuntimeModelRefreshService.this, Status.OK_STATUS); + } else { + callback.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getLocalizedMessage(), error)); + } } } }); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java index 8e455dfec..7630b2916 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelUpdateService.java @@ -158,6 +158,11 @@ public class RuntimeModelUpdateService extends AbstractModelService<IRuntimeMode for (IProcessContextNode candidate : newChildren) { String id = candidate.getStringProperty(IProcessContextNodeProperties.PROPERTY_ID); if (id == null) continue; + // If the context node got invalid while refreshing the tree, skip the + // context. The context will be removed from the tree as a result, if + // the context had been added to the tree before. If the context was not + // in the tree before, it will not be added at all. + if (candidate.isProperty(IProcessContextNodeProperties.PROPERTY_INVALID_CTX, true)) continue; // Find the old process context node IProcessContextNode oldNode = findInList(id, oldChildren); if (oldNode != null) { |