Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2011-05-02 11:52:52 +0000
committerTomasz Zarna2011-05-02 11:52:52 +0000
commit8e36fdda343694e04aa0f5e9736fe46ed3e810fb (patch)
treef5942bc33a6b2f9a706fa41c19beffa9c91084f5 /bundles
parentc87272f8e49df5dd6cc2e061fd14069770c28885 (diff)
downloadeclipse.platform.team-8e36fdda343694e04aa0f5e9736fe46ed3e810fb.tar.gz
eclipse.platform.team-8e36fdda343694e04aa0f5e9736fe46ed3e810fb.tar.xz
eclipse.platform.team-8e36fdda343694e04aa0f5e9736fe46ed3e810fb.zip
bug 337550: [History View] Add simple branch filter to CVS History view
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilter.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties5
5 files changed, 37 insertions, 8 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$
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java
index 842bc6c19..ec754e74a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryFilterDialog.java
@@ -29,6 +29,7 @@ public class CVSHistoryFilterDialog extends TrayDialog {
//widgets
private Button orRadio;
private Button andRadio;
+ private Text branchName;
private Text author;
private Text comment;
private DateTime fromDate;
@@ -73,6 +74,12 @@ public class CVSHistoryFilterDialog extends TrayDialog {
data.horizontalSpan = 2;
orRadio.setLayoutData(data);
+ //branch name
+ label = new Label(topLevel, SWT.NONE);
+ label.setText(CVSUIMessages.HistoryFilterDialog_branchName);
+ branchName = new Text(topLevel, SWT.BORDER);
+ branchName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
//author
label = new Label(topLevel, SWT.NONE);
label.setText(CVSUIMessages.HistoryFilterDialog_author);
@@ -104,6 +111,9 @@ public class CVSHistoryFilterDialog extends TrayDialog {
void initializeValues() {
if (historyFilter == null)
return;
+ if (historyFilter.branchName != null) {
+ branchName.setText(historyFilter.branchName);
+ }
if (historyFilter.author != null) {
author.setText(historyFilter.author);
}
@@ -139,7 +149,7 @@ public class CVSHistoryFilterDialog extends TrayDialog {
Date toDate = getToDate();
//create the filter
- historyFilter = new CVSHistoryFilter(author.getText(), comment.getText(), fromDate, toDate, orRadio.getSelection());
+ historyFilter = new CVSHistoryFilter(branchName.getText(), author.getText(), comment.getText(), fromDate, toDate, orRadio.getSelection());
super.buttonPressed(buttonId);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
index 6947c6ac9..a863b099d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
@@ -1606,7 +1606,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Update the history (if it exists) to reflect the new
//counts
if (historyFilter != null){
- CVSHistoryFilter tempFilter = new CVSHistoryFilter(historyFilter.author, historyFilter.comment, historyFilter.fromDate, historyFilter.toDate, historyFilter.isOr);
+ CVSHistoryFilter tempFilter = new CVSHistoryFilter(historyFilter.branchName, historyFilter.author, historyFilter.comment, historyFilter.fromDate, historyFilter.toDate, historyFilter.isOr);
showFilter(tempFilter);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
index 03b8dfbed..a49af0f10 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
@@ -440,6 +440,7 @@ public class CVSUIMessages extends NLS {
public static String HistoryFilterDialog_showMatching;
public static String HistoryFilterDialog_matchingAny;
public static String HistoryFilterDialog_matchingAll;
+ public static String HistoryFilterDialog_branchName;
public static String HistoryFilterDialog_author;
public static String HistoryFilterDialog_comment;
public static String HistoryFilterDialog_fromDate;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index 226d25d1d..1d280c145 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -383,8 +383,9 @@ HistoryFilterDialog_title = Filter Resource History
HistoryFilterDialog_showMatching = Show entries matching:
HistoryFilterDialog_matchingAny = A&ny of the provided criteria
HistoryFilterDialog_matchingAll = A&ll of the provided criteria
-HistoryFilterDialog_author = &Author:
-HistoryFilterDialog_comment = &Comment containing:
+HistoryFilterDialog_branchName = &Branches contain:
+HistoryFilterDialog_author = &Author matches:
+HistoryFilterDialog_comment = &Comment contains:
HistoryFilterDialog_fromDate = &From date:
HistoryFilterDialog_toDate = &To date:

Back to the top