1 11 package org.eclipse.team.internal.ccvs.core.client.listeners; 12 13 14 import java.io.PrintStream ; 15 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.core.runtime.IStatus; 18 import org.eclipse.team.internal.ccvs.core.ICVSFolder; 19 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; 20 import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener; 21 import org.eclipse.team.internal.ccvs.core.client.Session; 22 23 public class DiffListener extends CommandOutputListener { 24 PrintStream patchStream; 25 boolean wroteToStream; 26 27 static final String ERR_NOSUCHDIRECTORY = "cvs [diff aborted]: no such directory"; 30 public DiffListener(PrintStream patchStream) { 31 this.patchStream = patchStream; 32 wroteToStream=false; 33 } 34 35 public IStatus messageLine( 36 String line, 37 ICVSRepositoryLocation location, 38 ICVSFolder commandRoot, 39 IProgressMonitor monitor) { 40 41 if (Session.IS_CRLF_PLATFORM && line.length() > 0 && line.charAt(line.length() - 1) == '\r') { 46 line = line.substring(0, line.length() - 1); 47 } 48 patchStream.println(line); 49 wroteToStream=true; 50 51 return OK; 52 } 53 54 public IStatus errorLine( 55 String line, 56 ICVSRepositoryLocation location, 57 ICVSFolder commandRoot, 58 IProgressMonitor monitor) { 59 if (getServerMessage(line, location) != null) { 62 return OK; 63 } 64 65 if (line.indexOf(ERR_NOSUCHDIRECTORY) != -1){ 67 return OK; 68 } 69 return super.errorLine(line, location, commandRoot, monitor); 70 } 71 72 public boolean wroteToStream() { 73 return wroteToStream; 74 } 75 } 76 | Popular Tags |