diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java deleted file mode 100644 index 9966bb4eb..000000000 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.eclipse.team.internal.ccvs.ui; - -import java.util.Date; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.team.internal.ccvs.core.ILogEntry; - -public class HistoryFilter extends ViewerFilter { - private HistoryView view; - public String author; - public Date fromDate; - public Date toDate; - public String comment; - public boolean isOr; - - public HistoryFilter(HistoryView hView, String author, String comment, Date fromDate, Date toDate, boolean isOr) { - this.view = hView; - this.author = author; - this.comment = comment; - this.fromDate = fromDate; - this.toDate = toDate; - this.isOr = isOr; - } - /** - * @see ViewerFilter#select(Viewer, Object, Object) - */ - public boolean select(Viewer aviewer, Object parentElement, Object element) { - if (element instanceof ILogEntry) { - ILogEntry entry = (ILogEntry)element; - if (isOr) { - //empty fields should be considered a non-match - return (hasAuthor() && authorMatch(entry) ) - || (hasDate() && dateMatch(entry)) - || (hasComment() && commentMatch(entry)); - } else { - //"and" search - //empty fields should be considered a match - return (!hasAuthor() || authorMatch(entry)) - && (!hasDate() || dateMatch(entry)) - && (!hasComment() || commentMatch(entry)); - } - } - return false; - } - protected boolean authorMatch(ILogEntry entry) { - return entry.getAuthor().equals(author); - } - protected boolean commentMatch(ILogEntry entry) { - return !(entry.getComment().toLowerCase().indexOf(comment.toLowerCase()) == -1); - } - protected boolean dateMatch(ILogEntry entry) { - return (fromDate.before(entry.getDate())) - && (toDate.after(entry.getDate())); - } - protected boolean hasAuthor() { - return !author.equals(""); //$NON-NLS-1$ - } - protected boolean hasComment() { - return !comment.equals(""); //$NON-NLS-1$ - } - protected boolean hasDate() { - return fromDate != null && toDate != null; - } -}
\ No newline at end of file |