1 11 package org.eclipse.team.internal.ccvs.ui.subscriber; 12 13 import java.text.DateFormat ; 14 15 import org.eclipse.core.resources.IResource; 16 import org.eclipse.jface.resource.ImageDescriptor; 17 import org.eclipse.team.internal.ccvs.core.ILogEntry; 18 import org.eclipse.team.internal.ccvs.ui.*; 19 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; 20 import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; 21 import org.eclipse.team.internal.ui.synchronize.SynchronizeModelElement; 22 import org.eclipse.team.ui.synchronize.ISynchronizeModelElement; 23 24 31 public class ChangeLogDiffNode extends SynchronizeModelElement { 32 33 private ILogEntry logEntry; 34 35 public ChangeLogDiffNode(ISynchronizeModelElement parent, ILogEntry logEntry) { 36 super(parent); 37 this.logEntry = logEntry; 38 } 39 40 public ILogEntry getComment() { 41 return logEntry; 42 } 43 44 public boolean equals(Object obj) { 45 if(obj == this) return true; 46 if(! (obj instanceof ChangeLogDiffNode)) return false; 47 ChangeLogDiffNode other = (ChangeLogDiffNode)obj; 48 ILogEntry otherLog = other.getComment(); 49 ILogEntry thisLog = getComment(); 50 return thisLog.getComment().equals(otherLog.getComment()) && thisLog.getAuthor().equals(otherLog.getAuthor()); 51 } 52 53 56 public ImageDescriptor getImageDescriptor(Object object) { 57 return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_CHANGELOG); 58 } 59 60 63 public String getName() { 64 String date = DateFormat.getDateTimeInstance().format(logEntry.getDate()); 65 String comment = HistoryView.flattenText(logEntry.getComment()); 66 return "["+logEntry.getAuthor()+ "] (" + date +") " + comment; } 68 69 72 public String toString() { 73 return getName(); 74 } 75 76 79 public IResource getResource() { 80 return null; 81 } 82 } 83 | Popular Tags |