diff options
author | Michael Valenta | 2004-10-26 16:06:19 +0000 |
---|---|---|
committer | Michael Valenta | 2004-10-26 16:06:19 +0000 |
commit | 42e740ef629594128ed5dec9c9373eb21706665c (patch) | |
tree | f46ae86b752ba0e24444247ac011f69a5eb1b38b /bundles | |
parent | fe4ad1d765d8ed91009489aa762aa6a4c92555dc (diff) | |
download | eclipse.platform.team-42e740ef629594128ed5dec9c9373eb21706665c.tar.gz eclipse.platform.team-42e740ef629594128ed5dec9c9373eb21706665c.tar.xz eclipse.platform.team-42e740ef629594128ed5dec9c9373eb21706665c.zip |
Bug 76861 Delete error with no mention of resource
Diffstat (limited to 'bundles')
7 files changed, 89 insertions, 34 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 b5dc9f4d4..6d06d5728 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 @@ -32,6 +32,7 @@ public class CVSStatus extends Status { public static final int FAILED_TO_CACHE_SYNC_INFO = -25; public static final int UNMEGERED_BINARY_CONFLICT = -26; public static final int INVALID_LOCAL_RESOURCE_PATH = -27; + public static final int RESPONSE_HANDLING_FAILURE = -28; // Path for resource related status private ICVSFolder commandRoot; diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java index f71b20a86..943262f32 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java @@ -11,13 +11,9 @@ package org.eclipse.team.internal.ccvs.core.client; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.*; import org.eclipse.team.internal.ccvs.core.*; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.ICVSFile; -import org.eclipse.team.internal.ccvs.core.ICVSFolder; -import org.eclipse.team.internal.ccvs.core.Policy; /** * Handles a "Removed" response from the CVS server. @@ -59,12 +55,27 @@ class RemovedHandler extends ResponseHandler { // delete then unmanage the file try { if (mFile.isReadOnly()) mFile.setReadOnly(false); - mFile.delete(); - mFile.unmanage(null); + mFile.delete(); + mFile.unmanage(null); } catch (CVSException e) { - // Just log and keep going - CVSProviderPlugin.log(e); + session.handleResponseError(new CVSStatus(IStatus.ERROR, CVSStatus.RESPONSE_HANDLING_FAILURE, Policy.bind("RemovedHandler.0", getPath(mFile)), e)); //$NON-NLS-1$ } } + + private String getPath(ICVSFile file) { + try { + IResource resource = file.getIResource(); + if (resource != null) { + return resource.getFullPath().toString(); + } + } catch (CVSException e) { + // Ignore + } + try { + return file.getRepositoryRelativePath(); + } catch (CVSException e1) { + return file.getName(); + } + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java index 0a6e887b5..bbd8a7dfb 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java @@ -145,7 +145,7 @@ public abstract class ResponseHandler { path = local.getFullPath().toString(); } IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.INVALID_LOCAL_RESOURCE_PATH, Policy.bind("ResponseHandler.0", path, e.getMessage()), e); //$NON-NLS-1$ - session.addError(status); + session.handleResponseError(status); } catch (CVSException e1) { CVSProviderPlugin.log(e1); } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java index 1d59df344..e0fdd4950 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java @@ -795,15 +795,6 @@ public class Session { file.setContents(in, responseType, true, new NullProgressMonitor()); } - /** - * Report the given error line to any listeners - * @param line the error line - * @param status the status that indicates any problems encountered parsing the line - */ - public void handleErrorLine(String line, IStatus status) { - ConsoleListeners.getInstance().errorLineReceived(this, line, status); - } - /** * Stores the value of the last Mod-time response encountered. * Valid only for the duration of a single CVS command. @@ -997,4 +988,24 @@ public class Session { public Command getCurrentCommand() { return currentCommand; } + + /** + * Report the given error line to any listeners + * @param line the error line + * @param status the status that indicates any problems encountered parsing the line + */ + public void handleErrorLine(String line, IStatus status) { + ConsoleListeners.getInstance().errorLineReceived(this, line, status); + } + + /** + * An error has occurred while processing responses from the + * server. Place this error is the status that will be returned + * from the command and show the error in the console + * @param status the status that descibes the error + */ + public void handleResponseError(IStatus status) { + addError(status); + handleErrorLine(Policy.bind("Session.0", status.getMessage()), status); //$NON-NLS-1$ + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties index 2455313e7..4ee3099b4 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties @@ -139,6 +139,8 @@ Session.sending=Sending file: {0} Session.transfer={0} ({1}K of {2}K bytes) Session.transferNoSize={0} Session.calculatingCompressedSize=Calculating compressed size: {0} +Session.dot_2=dot +Session.0=cvs client: {0} Command.receivingResponses=Receiving server response Command.warnings=The following warnings were reported while performing the "cvs {0}" command. @@ -181,6 +183,7 @@ Updated.numberFormat=Server did not send length of the file UpdateListener.0=An unmergable conflict has occurred for binary file {0}. Revision {1} has been loaded and overwritten local changes have been saved in file {2} UnsupportedHandler.message=Unsupported response received from server RemovedHandler.invalid=Invalid removed response received from CVS server for {0} +RemovedHandler.0=An error occurred removing resource {0} CheckInHandler.checkedIn= Receiving confirmation for file {0}. KSubstOption.-kb.short=Binary @@ -303,8 +306,6 @@ NotifyInfo.MalformedLine=Invalid Notify format: ''{0}'' NotifyInfo.MalformedNotificationType=Invalid notification type in line: ''{0}'' NotifyInfo.MalformedNotifyDate=Invalid date format in line: ''{0}'' -Session.dot_2=dot - ResourceSynchronizer.missingParentBytesOnGet=Synchronization bytes are missing for parent of resource ''{1}'' in synchronization partner ''{0}'' on get. ResourceSynchronizer.missingParentBytesOnSet=Synchronization bytes are missing for parent of resource ''{1}'' in synchronization partner ''{0}'' on set. CVSAnnotateBlock.4=lines diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java index a95586e71..3158fa7e9 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java @@ -14,6 +14,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; +import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jface.preference.IPreferenceStore; @@ -68,6 +69,11 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener // Indicates whether the console's streams have been initialized private boolean initialized = false; + /* + * Constant used for indenting error status printing + */ + private static final String NESTING = " "; //$NON-NLS-1$ + /** * Used to notify this console of lifecycle methods <code>init()</code> * and <code>dispose()</code>. @@ -281,22 +287,15 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener } String statusText; if (status != null) { + boolean includeRoot = true; if (status.getCode() == CVSStatus.SERVER_ERROR) { statusText = Policy.bind("Console.resultServerError", status.getMessage(), time); //$NON-NLS-1$ + includeRoot = false; } else { statusText = Policy.bind("Console.resultOk", time); //$NON-NLS-1$ } appendLine(ConsoleDocument.COMMAND, statusText); - IStatus[] children = status.getChildren(); - if (children.length == 0) { - if (!status.isOK()) - appendLine(ConsoleDocument.COMMAND, messageLineForStatus(status)); - } else { - for (int i = 0; i < children.length; i++) { - if (!children[i].isOK()) - appendLine(ConsoleDocument.COMMAND, messageLineForStatus(children[i])); - } - } + outputStatus(status, includeRoot, includeRoot ? 0 : 1); } else if (exception != null) { if (exception instanceof OperationCanceledException) { statusText = Policy.bind("Console.resultAborted", time); //$NON-NLS-1$ @@ -304,6 +303,9 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener statusText = Policy.bind("Console.resultException", time); //$NON-NLS-1$ } appendLine(ConsoleDocument.COMMAND, statusText); + if (exception instanceof CoreException) { + outputStatus(((CoreException)exception).getStatus(), true, 1); + } } else { statusText = Policy.bind("Console.resultOk", time); //$NON-NLS-1$ } @@ -311,7 +313,35 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener appendLine(ConsoleDocument.COMMAND, ""); //$NON-NLS-1$ } - /* (non-Javadoc) + private void outputStatus(IStatus status, boolean includeParent, int nestingLevel) { + if (includeParent && !status.isOK()) { + outputStatusMessage(status, nestingLevel); + nestingLevel++; + } + + // Include a CoreException in the status + Throwable t = status.getException(); + if (t instanceof CoreException) { + outputStatus(((CoreException)t).getStatus(), true, nestingLevel); + } + + // Include child status + IStatus[] children = status.getChildren(); + for (int i = 0; i < children.length; i++) { + outputStatus(children[i], true, nestingLevel); + } + } + + private void outputStatusMessage(IStatus status, int nesting) { + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < nesting; i++) { + buffer.append(NESTING); + } + buffer.append(messageLineForStatus(status)); + appendLine(ConsoleDocument.COMMAND, buffer.toString()); + } + + /* (non-Javadoc) * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java index 91a774036..580f5bf67 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java @@ -144,7 +144,8 @@ public class UpdateOperation extends SingleCommandOperation { private boolean isReportableError(IStatus status) { return status.getCode() == CVSStatus.SERVER_ERROR || status.getCode() == CVSStatus.UNMEGERED_BINARY_CONFLICT - || status.getCode() == CVSStatus.INVALID_LOCAL_RESOURCE_PATH; + || status.getCode() == CVSStatus.INVALID_LOCAL_RESOURCE_PATH + || status.getCode() == CVSStatus.RESPONSE_HANDLING_FAILURE; } /* (non-Javadoc) |