1 11 package org.eclipse.team.internal.ccvs.core.syncinfo; 12 13 import java.util.HashSet ; 14 import java.util.Set ; 15 16 import org.eclipse.core.resources.IContainer; 17 import org.eclipse.core.runtime.Assert; 18 import org.eclipse.core.runtime.IProgressMonitor; 19 import org.eclipse.team.core.TeamException; 20 import org.eclipse.team.internal.core.subscribers.BatchingLock; 21 22 35 public class ReentrantLock extends BatchingLock { 36 37 public class CVSThreadInfo extends ThreadInfo{ 38 private Set changedFolders = new HashSet (); 39 public CVSThreadInfo(IFlushOperation operation) { 40 super(operation); 41 } 42 public void addChangedFolder(IContainer container) { 43 changedFolders.add(container); 44 } 45 public boolean isEmpty() { 46 return changedFolders.isEmpty() && super.isEmpty(); 47 } 48 public IContainer[] getChangedFolders() { 49 return (IContainer[]) changedFolders.toArray(new IContainer[changedFolders.size()]); 50 } 51 public void flush(IProgressMonitor monitor) throws TeamException { 52 try { 53 super.flush(monitor); 54 } finally { 55 changedFolders.clear(); 58 } 59 } 60 } 61 62 65 protected ThreadInfo createThreadInfo(IFlushOperation operation) { 66 return new CVSThreadInfo(operation); 67 } 68 69 public void folderChanged(IContainer folder) { 70 CVSThreadInfo info = (CVSThreadInfo)getThreadInfo(); 71 Assert.isNotNull(info, "Folder changed outside of resource lock"); info.addChangedFolder(folder); 73 } 74 75 } 76 | Popular Tags |