1 11 package org.eclipse.team.core.synchronize; 12 13 import org.eclipse.core.resources.IFile; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.core.runtime.Assert; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.team.core.variants.IResourceVariant; 18 import org.eclipse.team.internal.core.subscribers.ContentComparator; 19 20 29 public abstract class SyncInfoFilter { 30 31 41 public static class ContentComparisonSyncInfoFilter extends SyncInfoFilter { 42 ContentComparator criteria = new ContentComparator(false); 43 46 public ContentComparisonSyncInfoFilter() { 47 this(false); 48 } 49 53 public ContentComparisonSyncInfoFilter(boolean ignoreWhitespace) { 54 criteria = new ContentComparator(ignoreWhitespace); 55 } 56 57 60 public boolean select(SyncInfo info, IProgressMonitor monitor) { 61 IResourceVariant remote = info.getRemote(); 62 IResource local = info.getLocal(); 63 if (local.getType() != IResource.FILE) return true; 64 if (remote == null) return !local.exists(); 65 if (!local.exists()) return false; 66 return compareContents((IFile)local, remote, monitor); 67 } 68 69 78 public boolean compareContents(IFile local, IResourceVariant remote, IProgressMonitor monitor) { 79 Assert.isNotNull(local); 80 Assert.isNotNull(remote); 81 return criteria.compare(local, remote, monitor); 82 } 83 } 84 85 92 public abstract boolean select(SyncInfo info, IProgressMonitor monitor); 93 94 } 95 | Popular Tags |