[EGIT PATCH] Resurrect group filtering options in history view

[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 flag is persistent.

Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
---
 org.spearce.egit.ui/icons/elcl16/filterfolder.gif  |  Bin 0 -> 153 bytes
 org.spearce.egit.ui/icons/elcl16/filterproject.gif |  Bin 0 -> 154 bytes
 org.spearce.egit.ui/icons/elcl16/filterrepo.gif    |  Bin 0 -> 322 bytes
 .../src/org/spearce/egit/ui/UIIcons.java           |   12 ++
 .../src/org/spearce/egit/ui/UIText.java            |   11 ++-
 .../egit/ui/internal/history/GitHistoryPage.java   |  115 +++++++++++++++++++-
 .../src/org/spearce/egit/ui/uitext.properties      |    4 +
 7 files changed, 136 insertions(+), 6 deletions(-)
 create mode 100644 org.spearce.egit.ui/icons/elcl16/filterfolder.gif
 create mode 100644 org.spearce.egit.ui/icons/elcl16/filterproject.gif
 create mode 100644 org.spearce.egit.ui/icons/elcl16/filterrepo.gif

söndag 01 februari 2009 23:39:20 skrev Shawn O. Pearce:
> Shouldn't these filtering flag buttons be exclusive buttons,
> in the sense that only one can be depressed at a time, or none
> are depressed?
Fixed.
> Also, the R/P/F labels are a bit too similar.  I know its what we
> had before, but these are blending too much to me visually and I
> keep reading the F as though it were a misdrawn R or P, like the
> box isn't big enough for it.  Which actually has me thinking that
> with the proportional width font on my workbench the F is using a
> narrower button box than the R or P, which looks funny.

How about these cute icons instead? They are shamelessy stolen from
other places in Eclipse and mis-treated using kolourpaint.

Btw, I think we have a case for open source mail programs that can display
image patches inline.... Any takers? (I'm using KMail).

-- robin

diff --git a/org.spearce.egit.ui/icons/elcl16/filterfolder.gif b/org.spearce.egit.ui/icons/elcl16/filterfolder.gif
new file mode 100644
index 0000000000000000000000000000000000000000..55843e768f2d5509d2b48a1f881fe69ffbe9d59a
GIT binary patch
literal 153
zcmZ?wbhEHb6krfw_{_lI8x<R#Qq$nT@Z&;7epyRu?UeGCSuw3kL%KKrxG~|!g9Sf6
zoM1o#ia%Kx85npNbU<PtGZ<LhCY<zKt$O)}SHl&tA`zFDjkB+KI$9<6DD0lRK&9Cx
w|InlVO;daqUU;k3<f62a=TlMhipj#pewK1>+9q0S16GPM?`iDS6=bjm0G<puSpWb4

literal 0
HcmV?d00001

diff --git a/org.spearce.egit.ui/icons/elcl16/filterproject.gif b/org.spearce.egit.ui/icons/elcl16/filterproject.gif
new file mode 100644
index 0000000000000000000000000000000000000000..a24b94dcfa75ff64da290f69c8b20d21886c7c11
GIT binary patch
literal 154
zcmZ?wbhEHb6krfw_{_lI8x<R#Qq$nT@Z&;7epyRu?Gy%v|K%;SVp^AmbZ=((|NqC0
z2|pez`0?Qc0~jd&WMO1r;A7AM@jzxUu()41>A70<^9`?tD`8C{E-xErU-5LbO6*hE
zJ^7$cvrWF+<Nr-ldJh^%@H%!UZZy!C$M*05=iP+9<5x~y<m&a(o^tK6K(z5R4hCxg
DA$>k#

literal 0
HcmV?d00001

diff --git a/org.spearce.egit.ui/icons/elcl16/filterrepo.gif b/org.spearce.egit.ui/icons/elcl16/filterrepo.gif
new file mode 100644
index 0000000000000000000000000000000000000000..c1cfa7bedc95329943acc214bf92e072059ad54b
GIT binary patch
literal 322
zcmZ?wbhEHb6krfw_^QU>8x<R#QnS6Ddt<HD-bo_6CtK{EV)=F+&!IlmgS~1m+LaD3
zQaQa+|JW+iLtCsKFVTOxUhnlzmB(9bUmsNccGBX+&al_V{J&iH`g6<Y&uzbtM?=0p
ziuign;p@G`-;c6?KPk;GYe}u0Qr<EvrgdpZ_vYUprv3l_pMiQn@h1x-1A{t)4#-H5
zpBUKU4@@rb(2;U<p16^NiDRnUB@LEURtvoogC$PzO+0d{DZsGOpYP0a=fXMClKjyH
zW-exvogc+Km~w+7ota-;fQ#A3MT)tVna9UZol#AUnOP_;C?rfhA~Jezx_ZJwS4ReG
E0D-q??*IS*

literal 0
HcmV?d00001

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIIcons.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIIcons.java
index 1697542..13749fa 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIIcons.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIIcons.java
@@ -71,6 +71,15 @@
 	/** Connect Wizard banner */
 	public static final ImageDescriptor WIZBAN_CONNECT_REPO;
 
+	/** History filter, select all version in repo */
+	public static ImageDescriptor FILTERREPO;
+
+	/** History filter, select all version in same project */
+	public static ImageDescriptor FILTERPROJECT;
+
+	/** History filter, select all version in same folder */
+	public static ImageDescriptor FILTERFOLDER;
+
 	private static final URL base;
 
 	static {
@@ -97,6 +106,9 @@
 		CHECKBOX_ENABLED_UNCHECKED = map("checkboxes/enabled_unchecked.gif");
 		CHECKBOX_DISABLED_CHECKED = map("checkboxes/disabled_checked.gif");
 		CHECKBOX_DISABLED_UNCHECKED = map("checkboxes/disabled_unchecked.gif");
+		FILTERREPO = map("elcl16/filterrepo.gif"); //$NON-NLS-1$
+		FILTERPROJECT = map("elcl16/filterproject.gif"); //$NON-NLS-1$
+		FILTERFOLDER = map("elcl16/filterfolder.gif"); //$NON-NLS-1$
 	}
 
 	private static ImageDescriptor map(final String icon) {
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
index 7a7d3ef..d386482 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
@@ -913,8 +913,17 @@
 	/** */
 	public static String BranchSelectionDialog_Refs;
 
+	/** */
+	public static String HistoryPage_ShowAllVersionsForProject;
+
+	/** */
+	public static String HistoryPage_ShowAllVersionsForRepo;
+
+	/** */
+	public static String HistoryPage_ShowAllVersionsForFolder;
+
 	static {
-		initializeMessages(UIText.class.getPackage().getName() + ".uitext",
+		initializeMessages(UIText.class.getPackage().getName() + ".uitext", //$NON-NLS-1$
 				UIText.class);
 	}
 }
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..08b8d69 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
@@ -1,5 +1,4 @@
 /*******************************************************************************
- * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
  * Copyright (C) 2008, Roger C. Soares <rogersoares@xxxxxxxxxxxxxxxx>
  * Copyright (C) 2008, Shawn O. Pearce <spearce@xxxxxxxxxxx>
  *
@@ -27,6 +26,7 @@
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.text.ITextOperationTarget;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -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).
@@ -193,6 +193,98 @@ private static boolean typeOk(final IResource object) {
 	 */
 	private RevObjectSelectionProvider revObjectSelectionProvider;
 
+	private static final String PREF_SHOWALLFILTER = "org.spearce.egit.ui.githistorypage.showallfilter"; //$NON-NLS-1$
+
+	enum ShowFilter {
+		SHOWALLRESOURCE,
+		SHOWALLFOLDER,
+		SHOWALLPROJECT,
+		SHOWALLREPO,
+	}
+
+	class ShowFilterAction extends Action {
+		private final ShowFilter filter;
+
+		ShowFilterAction(ShowFilter filter, ImageDescriptor icon, String toolTipText) {
+			super(null, IAction.AS_CHECK_BOX);
+			this.filter = filter;
+			setImageDescriptor(icon);
+			setToolTipText(toolTipText);
+		}
+		@Override
+		public void run() {
+			if (!isChecked()) {
+				if (showAllFilter == filter) {
+					showAllFilter = ShowFilter.SHOWALLRESOURCE;
+					refresh();
+				}
+			}
+			if (isChecked() && showAllFilter != filter) {
+				showAllFilter = filter;
+				if (this != showAllRepoVersionsAction)
+					showAllRepoVersionsAction.setChecked(false);
+				if (this != showAllProjectVersionsAction)
+					showAllProjectVersionsAction.setChecked(false);
+				if (this != showAllFolderVersionsAction)
+					showAllFolderVersionsAction.setChecked(false);
+				refresh();
+			}
+			Activator.getDefault().getPreferenceStore().setValue(
+					PREF_SHOWALLFILTER, showAllFilter.toString());
+		}
+		@Override
+		public String toString() {
+			return "ShowFilter[" + filter.toString() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+		}
+	}
+
+	private ShowFilter showAllFilter = ShowFilter.SHOWALLRESOURCE;
+
+	private ShowFilterAction showAllRepoVersionsAction;
+
+	private ShowFilterAction showAllProjectVersionsAction;
+
+	private ShowFilterAction showAllFolderVersionsAction;
+
+	private void createResourceFilterActions() {
+		try {
+			showAllFilter = ShowFilter.valueOf(Activator.getDefault()
+					.getPreferenceStore().getString(PREF_SHOWALLFILTER));
+		} catch (IllegalArgumentException e) {
+			showAllFilter = ShowFilter.SHOWALLRESOURCE;
+		}
+
+		showAllRepoVersionsAction = new ShowFilterAction(
+				ShowFilter.SHOWALLREPO, UIIcons.FILTERREPO,
+				UIText.HistoryPage_ShowAllVersionsForRepo);
+
+		showAllProjectVersionsAction = new ShowFilterAction(
+				ShowFilter.SHOWALLPROJECT, UIIcons.FILTERPROJECT,
+				UIText.HistoryPage_ShowAllVersionsForProject);
+
+		showAllFolderVersionsAction = new ShowFilterAction(
+				ShowFilter.SHOWALLFOLDER, UIIcons.FILTERFOLDER,
+				UIText.HistoryPage_ShowAllVersionsForFolder);
+
+		showAllRepoVersionsAction
+				.setChecked(showAllFilter == showAllRepoVersionsAction.filter);
+		showAllProjectVersionsAction
+				.setChecked(showAllFilter == showAllProjectVersionsAction.filter);
+		showAllFolderVersionsAction
+				.setChecked(showAllFilter == showAllFolderVersionsAction.filter);
+
+		getSite().getActionBars().getToolBarManager().add(new Separator());
+
+		getSite().getActionBars().getToolBarManager().add(
+				showAllRepoVersionsAction);
+
+		getSite().getActionBars().getToolBarManager().add(
+				showAllProjectVersionsAction);
+
+		getSite().getActionBars().getToolBarManager().add(
+				showAllFolderVersionsAction);
+	}
+
 	@Override
 	public void createControl(final Composite parent) {
 		GridData gd;
@@ -227,6 +319,7 @@ public void createControl(final Composite parent) {
 		popupMgr = new MenuManager(null, POPUP_ID);
 		attachCommitSelectionChanged();
 		createLocalToolbarActions();
+		createResourceFilterActions();
 		createStandardActions();
 		createViewMenu();
 
@@ -566,9 +659,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 (showAllFilter == ShowFilter.SHOWALLFOLDER) {
+				final String name = map.getRepoRelativePath(r.getParent());
+				if (name != null && name.length() > 0)
+					paths.add(name);
+			} else if (showAllFilter == ShowFilter.SHOWALLPROJECT) {
+				final String name = map.getRepoRelativePath(r.getProject());
+				if (name != null && name.length() > 0)
+					paths.add(name);
+			} else if (showAllFilter == ShowFilter.SHOWALLREPO) {
+				// nothing
+			} else /*if (showAllFilter == ShowFilter.SHOWALLRESOURCE)*/ {
+				final String name = map.getRepoRelativePath(r);
+				if (name != null && name.length() > 0)
+					paths.add(name);
+			}
 		}
 
 		if (db == null)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index a86e58b..52fa4f8 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -199,6 +199,10 @@ HistoryPage_findbar_changeto_committer=Change to Committer
 HistoryPage_findbar_exceeded=Results limit exceeded
 HistoryPage_findbar_notFound=String not found
 
+HistoryPage_ShowAllVersionsForRepo=Show all versions for the repository containing the resource
+HistoryPage_ShowAllVersionsForProject=Show all versions for the project containing the resource
+HistoryPage_ShowAllVersionsForFolder=Show all versions for the folder containing the resource
+
 HistoryPreferencePage_title=Git
 
 PushAction_wrongURIDescription=Remote repositories URIs configuration is corrupted.
-- 
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