Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
index d41fa8235..1ba1d24d2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,10 +14,12 @@ import java.util.Date;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.team.core.history.ITag;
import org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision;
import org.eclipse.team.internal.ui.history.AbstractHistoryCategory;
public class CVSHistoryFilter extends ViewerFilter {
+ public String branchName;
public String author;
public Date fromDate;
public Date toDate;
@@ -25,7 +27,8 @@ public class CVSHistoryFilter extends ViewerFilter {
public boolean isOr;
private int matchCounter;
- public CVSHistoryFilter(String author, String comment, Date fromDate, Date toDate, boolean isOr) {
+ public CVSHistoryFilter(String branchName, String author, String comment, Date fromDate, Date toDate, boolean isOr) {
+ this.branchName = branchName;
this.author = author;
this.comment = comment;
this.fromDate = fromDate;
@@ -45,7 +48,7 @@ public class CVSHistoryFilter extends ViewerFilter {
CVSFileRevision entry = (CVSFileRevision) element;
if (isOr) {
//empty fields should be considered a non-match
- boolean orSearch = (hasAuthor() && authorMatch(entry)) || (hasDate() && dateMatch(entry)) || (hasComment() && commentMatch(entry));
+ boolean orSearch = (hasBranchName() && branchMatch(entry)) || (hasAuthor() && authorMatch(entry)) || (hasDate() && dateMatch(entry)) || (hasComment() && commentMatch(entry));
if (orSearch)
matchCounter++;
@@ -53,7 +56,7 @@ public class CVSHistoryFilter extends ViewerFilter {
} else {
//"and" search
//empty fields should be considered a match
- boolean andSearch = (!hasAuthor() || authorMatch(entry)) && (!hasDate() || dateMatch(entry)) && (!hasComment() || commentMatch(entry));
+ boolean andSearch = (!hasBranchName() || branchMatch(entry)) && (!hasAuthor() || authorMatch(entry)) && (!hasDate() || dateMatch(entry)) && (!hasComment() || commentMatch(entry));
if (andSearch)
matchCounter++;
@@ -63,6 +66,16 @@ public class CVSHistoryFilter extends ViewerFilter {
return false;
}
+ protected boolean branchMatch(CVSFileRevision revision) {
+ ITag[] branches = revision.getBranches();
+ for (int i = 0; i < branches.length; i++) {
+ if ((branches[i].getName().toLowerCase().indexOf(branchName.toLowerCase()) != -1)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
protected boolean authorMatch(CVSFileRevision revision) {
return revision.getAuthor().equals(author);
}
@@ -87,6 +100,10 @@ public class CVSHistoryFilter extends ViewerFilter {
return (fromDate.before(new Date(revision.getTimestamp())));
}
+ protected boolean hasBranchName() {
+ return !branchName.equals(""); //$NON-NLS-1$
+ }
+
protected boolean hasAuthor() {
return !author.equals(""); //$NON-NLS-1$
}

Back to the top