diff options
author | Michael Valenta | 2004-11-11 20:15:32 +0000 |
---|---|---|
committer | Michael Valenta | 2004-11-11 20:15:32 +0000 |
commit | 86c89224f7239f8b50c5079588ab2bd61dc75432 (patch) | |
tree | 002d6e52d24af461de7a831959b740b68a157fa2 | |
parent | bcc4688364e0768d75cff2e5fb3dac53e60c3da9 (diff) | |
download | eclipse.platform.team-86c89224f7239f8b50c5079588ab2bd61dc75432.tar.gz eclipse.platform.team-86c89224f7239f8b50c5079588ab2bd61dc75432.tar.xz eclipse.platform.team-86c89224f7239f8b50c5079588ab2bd61dc75432.zip |
Bug 78303 [Decorators] Workspace is closed exception on shutdown
2 files changed, 38 insertions, 8 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java index ecff82be7..e572e42d5 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java @@ -23,6 +23,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ReentrantLock.CVSThreadInfo; import org.eclipse.team.internal.ccvs.core.util.*; import org.eclipse.team.internal.core.subscribers.BatchingLock.IFlushOperation; import org.eclipse.team.internal.core.subscribers.BatchingLock.ThreadInfo; +import org.osgi.framework.Bundle; /** * A synchronizer is responsible for managing synchronization information for local @@ -513,12 +514,22 @@ public class EclipseSynchronizer implements IFlushOperation { * Begin an access to the internal data structures of the synchronizer */ private void beginOperation() { - // Do not try to acquire the lock if the resources tree is locked - // The reason for this is that during the resource delta phase (i.e. when the tree is locked) - // the workspace lock is held. If we obtain our lock, there is - // a chance of dealock. It is OK if we don't as we are still protected - // by scheduling rules and the workspace lock. - if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; + try { + // Do not try to acquire the lock if the resources tree is locked + // The reason for this is that during the resource delta phase (i.e. when the tree is locked) + // the workspace lock is held. If we obtain our lock, there is + // a chance of dealock. It is OK if we don't as we are still protected + // by scheduling rules and the workspace lock. + if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; + } catch (RuntimeException e) { + // If we are not active, throw a cancel. Otherwise, propogate it. + // (see bug 78303) + if (Platform.getBundle(CVSProviderPlugin.ID).getState() == Bundle.ACTIVE) { + throw e; + } else { + throw new OperationCanceledException(); + } + } lock.acquire(); } @@ -526,8 +537,18 @@ public class EclipseSynchronizer implements IFlushOperation { * End an access to the internal data structures of the synchronizer */ private void endOperation() { - // See beginOperation() for a description of why the lock is not obtained when the tree is locked - if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; + try { + // See beginOperation() for a description of why the lock is not obtained when the tree is locked + if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; + } catch (RuntimeException e) { + // If we are not active, throw a cancel. Otherwise, propogate it. + // (see bug 78303) + if (Platform.getBundle(CVSProviderPlugin.ID).getState() == Bundle.ACTIVE) { + throw e; + } else { + throw new OperationCanceledException(); + } + } lock.release(); } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java index ec06a3ee4..1408a89f2 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java @@ -13,6 +13,7 @@ package org.eclipse.team.internal.ccvs.ui; import java.text.SimpleDateFormat; import java.util.*; + import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.jface.preference.IPreferenceStore; @@ -32,6 +33,7 @@ import org.eclipse.team.internal.core.ExceptionCollector; import org.eclipse.team.ui.TeamUI; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.themes.ITheme; +import org.osgi.framework.Bundle; public class CVSLightweightDecorator extends LabelProvider implements ILightweightLabelDecorator, IResourceStateChangeListener, IPropertyChangeListener { @@ -166,6 +168,13 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig cvsDecoration.apply(decoration); } catch(CVSException e) { handleException(e); + } catch (IllegalStateException e) { + // This is thrown by Core if the workspace is in an illegal state + // If we are not active, ignore it. Otherwise, propogate it. + // (see bug 78303) + if (Platform.getBundle(CVSUIPlugin.ID).getState() == Bundle.ACTIVE) { + throw e; + } } } |