1 11 12 package org.eclipse.team.core.history.provider; 13 14 import java.net.URI ; 15 16 import org.eclipse.core.resources.IFile; 17 import org.eclipse.core.resources.IStorage; 18 import org.eclipse.core.runtime.CoreException; 19 import org.eclipse.core.runtime.IProgressMonitor; 20 import org.eclipse.team.core.history.IFileRevision; 21 import org.eclipse.team.core.history.ITag; 22 23 31 public abstract class FileRevision implements IFileRevision { 32 33 private static final class LocalFileRevision extends FileRevision { 34 private final IFile file; 35 36 private LocalFileRevision(IFile file) { 37 this.file = file; 38 } 39 40 public IStorage getStorage(IProgressMonitor monitor) { 41 return file; 42 } 43 44 public String getName() { 45 return file.getName(); 46 } 47 48 public boolean exists() { 49 return file.exists(); 50 } 51 52 public long getTimestamp() { 53 return file.getLocalTimeStamp(); 54 } 55 56 public URI getURI() { 57 return file.getLocationURI(); 58 } 59 60 public IFileRevision withAllProperties(IProgressMonitor monitor) throws CoreException { 61 return this; 62 } 63 64 public boolean isPropertyMissing() { 65 return false; 66 } 67 68 public int hashCode() { 69 return file.hashCode(); 70 } 71 72 public boolean equals(Object obj) { 73 if (obj == this) 74 return true; 75 if (obj instanceof LocalFileRevision) { 76 LocalFileRevision other = (LocalFileRevision) obj; 77 return other.file.equals(this.file); 78 } 79 return false; 80 } 81 } 82 83 90 public static IFileRevision getFileRevisionFor(final IFile file) { 91 return new LocalFileRevision(file); 92 } 93 94 97 public URI getURI() { 98 return null; 99 } 100 101 104 public long getTimestamp() { 105 return -1; 106 } 107 108 111 public boolean exists() { 112 return true; 113 } 114 115 118 public String getContentIdentifier() { 119 return null; 120 } 121 124 public String getAuthor() { 125 return null; 126 } 127 130 public String getComment() { 131 return null; 132 } 133 134 137 public ITag[] getTags() { 138 return new ITag[0]; 139 } 140 141 } 142 | Popular Tags |