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 | 74 |
1 files changed, 0 insertions, 74 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 64209cca4..000000000 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryFilter.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v0.5 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v05.html - * - * Contributors: - * IBM - Initial API and implementation - ******************************************************************************/ -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 |