1 11 package org.eclipse.team.internal.ccvs.core.client.listeners; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.team.internal.ccvs.core.*; 16 import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener; 17 import org.eclipse.team.internal.ccvs.core.util.Util; 18 19 public class StatusListener extends CommandOutputListener { 20 private static boolean isFolder = false; 21 private IStatusListener statusListener; 22 23 public StatusListener(IStatusListener statusListener) { 24 this.statusListener = statusListener; 25 } 26 27 public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, 28 IProgressMonitor monitor) { 29 30 if (line.startsWith(" Repository revision:")) { if (!line.startsWith(" Repository revision: No revision control file")) { int separatingTabIndex = line.indexOf('\t', 24); 34 String remoteRevision = line.substring(24, separatingTabIndex); 35 36 String fileLocation = line.substring(separatingTabIndex + 1, line.length() - 2); 38 39 statusListener.fileStatus(commandRoot, removeAtticSegment(fileLocation), remoteRevision); 41 } 42 } 43 return OK; 44 } 45 46 public IStatus errorLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { 47 String serverMessage = getServerMessage(line, location); 48 if (serverMessage != null) { 49 if (serverMessage.startsWith("conflict:")) { return new CVSStatus(IStatus.WARNING, CVSStatus.CONFLICT, line, commandRoot); 53 } 54 if (serverMessage.startsWith("Examining")) { isFolder = true; 56 return OK; 57 } 58 } 59 if (isFolder) { 60 isFolder = false; 63 } 64 return super.errorLine(line, location, commandRoot, monitor); 65 } 66 67 74 private String removeAtticSegment(String path) { 75 return Util.removeAtticSegment(path); 76 } 77 } 78 | Popular Tags |