git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[EGIT PATCH] Resurrect group filtering options in history pane

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Feb 1, 2009, 20:36 UTC
Message-ID
<1233520578-10453-1-git-send-email-robin.rosenberg@dewire.com>

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@dewire.com>
---
 .../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
Next: Robin Rosenberg
Message 1 of 6 in “Resurrect group filtering options in history pane”
  1. Resurrect group filtering options in history paneRobin Rosenberg, Feb 1, 2009
  2. Robin RosenbergFeb 1, 2009
  3. Shawn O. PearceFeb 1, 2009
  4. Resurrect group filtering options in history viewRobin Rosenberg, Feb 4, 2009
  5. Resurrect group filtering options in history viewRobin Rosenberg, Feb 4, 2009
  6. Shawn O. PearceFeb 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.