1 12 package org.eclipse.team.internal.ccvs.core.client; 13 14 import java.util.Date ; 15 import java.util.Set ; 16 17 import org.eclipse.core.runtime.IProgressMonitor; 18 import org.eclipse.core.runtime.IStatus; 19 import org.eclipse.team.internal.ccvs.core.CVSException; 20 import org.eclipse.team.internal.ccvs.core.ICVSFile; 21 import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener; 22 23 28 public class Replace extends Update { 29 30 private Set prepDeletedFiles = null; 31 32 public Replace() {} 33 public Replace(Set prepDeletedFiles) { 34 this.prepDeletedFiles = prepDeletedFiles; 35 } 36 37 41 public class CreatedResponseHandler extends UpdatedHandler { 42 public CreatedResponseHandler() { 43 super(UpdatedHandler.HANDLE_UPDATED); 44 } 45 public String getResponseID() { 46 return "Created"; } 48 protected void receiveTargetFile(Session session, ICVSFile file, String entryLine, Date modTime, 49 boolean binary, boolean readOnly, boolean executable, IProgressMonitor monitor) throws CVSException { 50 if (prepDeletedFiles != null && prepDeletedFiles.contains(file)) 53 modTime = null; 54 super.receiveTargetFile(session, file, entryLine, modTime, binary, readOnly, executable, monitor); 55 } 56 } 57 58 61 protected IStatus doExecute( 62 Session session, 63 GlobalOption[] globalOptions, 64 LocalOption[] localOptions, 65 String [] arguments, 66 ICommandOutputListener listener, 67 IProgressMonitor monitor) 68 throws CVSException { 69 70 ResponseHandler newCreated = new CreatedResponseHandler(); 71 ResponseHandler oldCreated = session.getResponseHandler(newCreated.getResponseID()); 72 session.registerResponseHandler(newCreated); 73 try { 74 return super.doExecute( 75 session, 76 globalOptions, 77 localOptions, 78 arguments, 79 listener, 80 monitor); 81 } finally { 82 session.registerResponseHandler(oldCreated); 83 } 84 } 85 } 86 | Popular Tags |