1 11 12 package org.eclipse.team.internal.ccvs.core.filehistory; 13 14 import java.net.URI ; 15 16 import org.eclipse.core.resources.IStorage; 17 import org.eclipse.core.runtime.*; 18 import org.eclipse.team.core.TeamException; 19 import org.eclipse.team.core.history.IFileRevision; 20 import org.eclipse.team.core.history.ITag; 21 import org.eclipse.team.core.history.provider.FileRevision; 22 import org.eclipse.team.core.variants.IResourceVariant; 23 import org.eclipse.team.internal.ccvs.core.*; 24 import org.eclipse.team.internal.ccvs.core.resources.RemoteFile; 25 26 public class CVSFileRevision extends FileRevision implements IAdaptable { 27 28 protected ILogEntry entry; 29 30 public CVSFileRevision(ILogEntry entry) { 31 this.entry = entry; 32 } 33 34 public long getTimestamp() { 35 return entry.getDate().getTime(); 36 } 37 38 public String getAuthor() { 39 return entry.getAuthor(); 40 } 41 42 public String getComment() { 43 return entry.getComment(); 44 } 45 46 public boolean isPredecessorOf(IFileRevision revision) { 47 long compareRevisionTime = revision.getTimestamp(); 48 return (this.getTimestamp() < compareRevisionTime); 49 } 50 51 public boolean isDescendentOf(IFileRevision revision) { 52 long compareRevisionTime = revision.getTimestamp(); 53 return (this.getTimestamp() > compareRevisionTime); 54 } 55 56 public IStorage getStorage(IProgressMonitor monitor) throws TeamException { 57 RemoteFile remoteFile = (RemoteFile) entry.getRemoteFile(); 58 return remoteFile.getStorage(monitor); 59 } 60 61 public String getName(){ 62 return entry.getRemoteFile().getName(); 63 } 64 65 public String getContentIdentifier() { 66 return entry.getRevision(); 67 } 68 69 public boolean equals(Object obj) { 70 if (obj instanceof CVSFileRevision){ 71 CVSFileRevision objRevision = (CVSFileRevision) obj; 72 ICVSRemoteFile remFile = objRevision.getCVSRemoteFile(); 73 if (remFile.equals(this.getCVSRemoteFile()) && 74 objRevision.getContentIdentifier().equals(this.getContentIdentifier())) 75 return true; 76 } 77 return false; 78 } 79 80 public URI getURI() { 81 ICVSRemoteFile file = entry.getRemoteFile(); 82 return ((RemoteFile)file).toCVSURI().toURI(); 83 } 84 85 public ITag[] getTags() { 86 return entry.getTags(); 87 } 88 89 public boolean exists() { 90 return !entry.isDeletion(); 91 } 92 93 public ICVSRemoteFile getCVSRemoteFile(){ 94 return entry.getRemoteFile(); 95 } 96 97 public boolean isPropertyMissing() { 98 if (entry.getAuthor() == null) 100 return true; 101 102 return false; 103 } 104 105 public IFileRevision withAllProperties(IProgressMonitor monitor) throws CoreException { 106 return new CVSFileRevision(getCVSRemoteFile().getLogEntry(monitor)); 107 } 108 109 public Object getAdapter(Class adapter) { 110 if (adapter == ICVSFile.class) 111 return getCVSRemoteFile(); 112 if (adapter == IResourceVariant.class) 113 return getCVSRemoteFile(); 114 return Platform.getAdapterManager().getAdapter(this, adapter); 115 } 116 } 117 | Popular Tags |