diff options
author | Michael Valenta | 2005-03-14 21:43:42 +0000 |
---|---|---|
committer | Michael Valenta | 2005-03-14 21:43:42 +0000 |
commit | 6c332998ff79a689ed729443ded6cd4afd602fc4 (patch) | |
tree | 9db4b454540da5f7eeb106f88c8a28ebdad7107d /bundles/org.eclipse.team.cvs.core | |
parent | 914b290676b1fd7a3666c900d58270d0de8eef8f (diff) | |
download | eclipse.platform.team-6c332998ff79a689ed729443ded6cd4afd602fc4.tar.gz eclipse.platform.team-6c332998ff79a689ed729443ded6cd4afd602fc4.tar.xz eclipse.platform.team-6c332998ff79a689ed729443ded6cd4afd602fc4.zip |
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core')
-rw-r--r-- | bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java index ab689ae24..5c10399ea 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.core; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; public class CVSStatus extends Status { @@ -68,4 +69,45 @@ public class CVSStatus extends Status { return message; } + /** + * Return whether this status is wrapping an internal error. + * An internal error is any error for which the wrapped exception + * is not a CVS exception. Check deeply to make sure there isn't + * an internal error buried deep down. + * @return whether this status is wrapping an internal error + */ + public boolean isInternalError() { + Throwable ex = getException(); + if (ex instanceof CVSException) { + CVSException cvsEx = (CVSException) ex; + IStatus status = cvsEx.getStatus(); + return isInternalError(status); + } + return ex != null; + } + + /** + * Return whether this status is wrapping an internal error. + * An internal error is any error for which the wrapped exception + * is not a CVS exception. Check deeply to make sure there isn't + * an internal error buried deep down. + * @return whether this status is wrapping an internal error + */ + public static boolean isInternalError(IStatus status) { + if (status instanceof CVSStatus) { + return ((CVSStatus)status).isInternalError(); + } + if (status.isMultiStatus()) { + IStatus[] children = status.getChildren(); + for (int i = 0; i < children.length; i++) { + IStatus child = children[i]; + if (isInternalError(child)) { + return true; + } + } + return false; + } + return true; + } + } |