1 11 package org.eclipse.team.internal.ccvs.core.client.listeners; 12 13 14 import java.util.Date ; 15 16 import org.eclipse.core.runtime.PlatformObject; 17 import org.eclipse.team.internal.ccvs.core.*; 18 import org.eclipse.team.internal.ccvs.core.resources.RemoteFile; 19 20 public class LogEntry extends PlatformObject implements ILogEntry { 21 22 private RemoteFile file; 23 private String author; 24 private Date date; 25 private String comment; 26 private String state; 27 private CVSTag[] tags; 28 private String [] revisions; 29 30 33 public static String flattenText(String string) { 34 StringBuffer buffer = new StringBuffer (string.length() + 20); 35 boolean skipAdjacentLineSeparator = true; 36 for (int i = 0; i < string.length(); i++) { 37 char c = string.charAt(i); 38 if (c == '\r' || c == '\n') { 39 if (!skipAdjacentLineSeparator) 40 buffer.append(CVSMessages.LogEntry_0); 41 skipAdjacentLineSeparator = true; 42 } else { 43 buffer.append(c); 44 skipAdjacentLineSeparator = false; 45 } 46 } 47 return buffer.toString(); 48 } 49 50 public LogEntry(RemoteFile file, String revision, String author, Date date, String comment, String state, CVSTag[] tags) { 51 this.file = file.toRevision(revision); 52 this.author = author; 53 this.date = date; 54 this.comment = comment; 55 this.state = state; 56 this.tags = tags; 57 } 58 59 public LogEntry(RemoteFile file, String revision, String author, Date date, String comment, String state, CVSTag[] tags, String [] revisions) { 60 this(file,revision,author,date,comment,state,tags); 61 this.revisions=revisions; 62 } 63 64 67 public String getRevision() { 68 return file.getRevision(); 69 } 70 71 74 public String getAuthor() { 75 return author; 76 } 77 78 81 public Date getDate() { 82 return date; 83 } 84 85 88 public String getComment() { 89 return comment; 90 } 91 92 95 public String getState() { 96 return state; 97 } 98 99 102 public CVSTag[] getTags() { 103 CVSTag[] result = new CVSTag[tags.length]; 104 System.arraycopy(tags, 0, result, 0, tags.length); 105 return result; 106 } 107 108 111 public ICVSRemoteFile getRemoteFile() { 112 return file; 113 } 114 115 118 public boolean isDeletion() { 119 return getState().equals("dead"); } 121 122 129 public String [] getBranchRevisions(){ 130 131 if (revisions != null) 132 return revisions; 133 134 return new String [0]; 135 } 136 } 137 138 | Popular Tags |