[EGIT PATCH] Resurrect group filtering options in history pane

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This commit restores the ability to filter on not only the selected
resource but instead all changes in the same folder, same project
or same repository. The filtering levels supported are Resource (no button
pessed), Folder, Project and Repository. Only the highest level has any
effect. The flags are persistent between eclipse sessions in the same
workspace.

Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
---
 .../egit/ui/internal/history/GitHistoryPage.java   |  108 +++++++++++++++++++-
 1 files changed, 104 insertions(+), 4 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
index d718cd7..4e95df4 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
@@ -96,7 +96,7 @@
 
 	/**
 	 * Determine if the input can be shown in this viewer.
-	 * 
+	 *
 	 * @param object
 	 *            an object that is hopefully of type ResourceList or IResource,
 	 *            but may be anything (including null).
@@ -188,6 +188,18 @@ private static boolean typeOk(final IResource object) {
 	 */
 	private List<String> pathFilters;
 
+	private static final String PREF_SHOWALLREPOVERSIONS = "org.spearce.egit.ui.githistorypage.showallrepoversions";
+
+	private static final String PREF_SHOWALLPROJECTVERSIONS = "org.spearce.egit.ui.githistorypage.showallprojectversions";
+
+	private static final String PREF_SHOWALLFOLDERVERSIONS = "org.spearce.egit.ui.githistorypage.showallfolderversions";
+
+	private boolean showAllProjectVersions;
+
+	private boolean showAllFolderVersions;
+
+	private boolean showAllRepoVersions;
+
 	/**
 	 * The selection provider tracks the selected revisions for the context menu
 	 */
@@ -236,9 +248,85 @@ public void createControl(final Composite parent) {
 		attachContextMenu(fileViewer.getControl());
 		layout();
 
+		showAllProjectVersions = Activator.getDefault().getPreferenceStore()
+				.getBoolean(PREF_SHOWALLPROJECTVERSIONS);
+		showAllFolderVersions = Activator.getDefault().getPreferenceStore()
+				.getBoolean(PREF_SHOWALLFOLDERVERSIONS);
+		showAllRepoVersions = Activator.getDefault().getPreferenceStore()
+				.getBoolean(PREF_SHOWALLREPOVERSIONS);
+
+		Action showAllRepoVersionsAction = new Action("R") {
+			public void run() {
+				cancelRefreshJob();
+				setShowAllRepoVersions(isChecked());
+				cancelRefreshJob();
+			}
+		};
+		showAllRepoVersionsAction
+				.setToolTipText("Show all versions for the repository containing the resource");
+		showAllRepoVersionsAction.setChecked(isShowAllRepoVersions());
+		getSite().getActionBars().getToolBarManager().add(
+				showAllRepoVersionsAction);
+
+		Action showAllProjectVersionsAction = new Action("P") {
+			public void run() {
+				cancelRefreshJob();
+				setShowAllProjectVersions(isChecked());
+				inputSet();
+			}
+		};
+		showAllProjectVersionsAction
+				.setToolTipText("Show all versions for the project containing the resource");
+		showAllProjectVersionsAction.setChecked(isShowAllProjectVersions());
+		getSite().getActionBars().getToolBarManager().add(
+				showAllProjectVersionsAction);
+
+		Action showAllFolderVersionsAction = new Action("F") {
+			public void run() {
+				cancelRefreshJob();
+				setShowAllFolderVersion(isChecked());
+				inputSet();
+			}
+		};
+		showAllFolderVersionsAction
+				.setToolTipText("Show all versions for the folder containing the resource");
+		showAllFolderVersionsAction.setChecked(isShowAllFolderVersions());
+		getSite().getActionBars().getToolBarManager().add(
+				showAllFolderVersionsAction);
+
 		Repository.addAnyRepositoryChangedListener(this);
 	}
 
+	/* private */boolean isShowAllRepoVersions() {
+		return showAllRepoVersions;
+	}
+
+	void setShowAllRepoVersions(boolean showAllRepoVersions) {
+		this.showAllRepoVersions = showAllRepoVersions;
+		Activator.getDefault().getPreferenceStore().setValue(
+				PREF_SHOWALLREPOVERSIONS, showAllRepoVersions);
+	}
+
+	/* private */boolean isShowAllProjectVersions() {
+		return showAllProjectVersions;
+	}
+
+	void setShowAllProjectVersions(boolean showAllProjectVersions) {
+		this.showAllProjectVersions = showAllProjectVersions;
+		Activator.getDefault().getPreferenceStore().setValue(
+				PREF_SHOWALLPROJECTVERSIONS, showAllProjectVersions);
+	}
+
+	/* private */boolean isShowAllFolderVersions() {
+		return showAllFolderVersions;
+	}
+
+	void setShowAllFolderVersion(boolean showAllFolderVersions) {
+		this.showAllFolderVersions = showAllFolderVersions;
+		Activator.getDefault().getPreferenceStore().setValue(
+				PREF_SHOWALLFOLDERVERSIONS, showAllFolderVersions);
+	}
+
 	private Runnable refschangedRunnable;
 
 	public void refsChanged(final RefsChangedEvent e) {
@@ -566,9 +654,21 @@ public boolean inputSet() {
 			else if (db != map.getRepository())
 				return false;
 
-			final String name = map.getRepoRelativePath(r);
-			if (name != null && name.length() > 0)
-				paths.add(name);
+			if (isShowAllFolderVersions()) {
+				final String name = map.getRepoRelativePath(r.getParent());
+				if (name != null && name.length() > 0)
+					paths.add(name);
+			} else if (isShowAllProjectVersions()) {
+				final String name = map.getRepoRelativePath(r.getProject());
+				if (name != null && name.length() > 0)
+					paths.add(name);
+			} else if (isShowAllRepoVersions()) {
+				// nothing
+			} else {
+				final String name = map.getRepoRelativePath(r);
+				if (name != null && name.length() > 0)
+					paths.add(name);
+			}
 		}
 
 		if (db == null)
-- 
1.6.1.285.g35d8b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux