git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: spearce@spearce.org
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH] Resurrect group filtering options in history pane
Date: Sun,  1 Feb 2009 21:36:18 +0100	[thread overview]
Message-ID: <1233520578-10453-1-git-send-email-robin.rosenberg@dewire.com> (raw)

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

             reply	other threads:[~2009-02-01 20:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-01 20:36 Robin Rosenberg [this message]
2009-02-01 20:43 ` [EGIT PATCH] Resurrect group filtering options in history pane Robin Rosenberg
2009-02-01 22:39 ` Shawn O. Pearce
2009-02-04 22:43   ` [EGIT PATCH] Resurrect group filtering options in history view Robin Rosenberg
2009-02-04 23:23     ` Robin Rosenberg
2009-02-05 16:14       ` Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233520578-10453-1-git-send-email-robin.rosenberg@dewire.com \
    --to=robin.rosenberg@dewire.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).