1 11 package org.eclipse.team.internal.ccvs.core.client; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.team.internal.ccvs.core.CVSStatus; 16 import org.eclipse.team.internal.ccvs.core.ICVSFolder; 17 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; 18 import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener; 19 import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; 20 21 public class CommandOutputListener implements ICommandOutputListener { 22 23 28 public static final String ROOT_CVSIGNORE_READ_FAILURE = "cvs server: cannot open /root/.cvsignore: Permission denied"; 30 public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { 31 return OK; 32 } 33 public IStatus errorLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { 34 String protocolError = getProtocolError(line, location); 35 if (protocolError != null) { 36 return new CVSStatus(IStatus.ERROR, CVSStatus.PROTOCOL_ERROR, protocolError, commandRoot); 37 } 38 if (line.equals(ROOT_CVSIGNORE_READ_FAILURE) || getServerMessage(ROOT_CVSIGNORE_READ_FAILURE, location).equals(getServerMessage(line, location))) { 39 return new CVSStatus(IStatus.WARNING, CVSStatus.ERROR_LINE, line, commandRoot); 41 } 42 return new CVSStatus(IStatus.ERROR, CVSStatus.ERROR_LINE, line, commandRoot); 43 } 44 45 53 protected String getProtocolError(String line, ICVSRepositoryLocation location) { 54 if (line.startsWith("Protocol error:")) { return line; 56 } 57 return null; 58 } 59 60 public String getServerMessage(String line, ICVSRepositoryLocation location) { 61 return ((CVSRepositoryLocation)location).getServerMessageWithoutPrefix(line, SERVER_PREFIX); 62 } 63 64 public String getServerAbortedMessage(String line, ICVSRepositoryLocation location) { 65 return ((CVSRepositoryLocation)location).getServerMessageWithoutPrefix(line, SERVER_ABORTED_PREFIX); 66 } 67 68 public String getServerRTagMessage(String line, ICVSRepositoryLocation location) { 69 return ((CVSRepositoryLocation)location).getServerMessageWithoutPrefix(line, RTAG_PREFIX); 70 } 71 } 72 | Popular Tags |