threads / patch / 17490

patchResurrect group filtering options in history pane

Subject: [EGIT PATCH] Resurrect group filtering options in history pane

## tl;dr

6 messages between Feb 1, 2009 and Feb 5, 2009. Diffs are folded; open one to read it.

replies: 5people: 2as markdown or json

Robin Rosenberg· Feb 1, 2009, 20:36 UTC · lore

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(-)
Show changes to org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java +104 −4
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
Robin Rosenberg· Feb 1, 2009, 20:43 UTC · re: Robin Rosenberg · lore

Re: [EGIT PATCH] Resurrect group filtering options in history pane

söndag 01 februari 2009 21:36:18 skrev jag:
> 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. 
Omg... I just told people not to repeat themselves...
> The flags are persistent between eclipse sessions in the same
> workspace.
-- robin
Shawn O. Pearce· Feb 1, 2009, 22:39 UTC · re: Robin Rosenberg · lore

Re: [EGIT PATCH] Resurrect group filtering options in history pane

Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
Show 6 quoted lines
> 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.

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?

I managed to depress R,P,F by doing it in the opposite order (push F, then P, then R) and I have no clue what that should really mean when looking at the history.

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.

Show 13 quoted lines
> 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).
Unnecessary re-formatting hunk.  Please discard from the patch.
-- 
Shawn.
Robin Rosenberg· Feb 4, 2009, 22:43 UTC · re: Shawn O. Pearce · lore

[EGIT PATCH] Resurrect group filtering options in history view

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@dewire.com>
---
 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.
Show 6 quoted lines
> 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
Show changes to 7 files +136 −6

org.spearce.egit.ui/icons/elcl16/filterfolder.gif, org.spearce.egit.ui/icons/elcl16/filterproject.gif, org.spearce.egit.ui/icons/elcl16/filterrepo.gif, org.spearce.egit.ui/src/org/spearce/egit/ui/UIIcons.java, org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java, org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java, org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties

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@dewire.com>
  * Copyright (C) 2008, Roger C. Soares <rogersoares@intelinet.com.br>
  * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
  *
@@ -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
Robin Rosenberg· Feb 4, 2009, 23:23 UTC · re: Robin Rosenberg · lore

[EGIT PATCH] Resurrect group filtering options in history view

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@dewire.com>
---

Same thing, not not adding the NON-NLS stuff tof UIIcons and UIText. We should use SuppressWarnings for those files.

-- robin
 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            |    9 ++
 .../egit/ui/internal/history/GitHistoryPage.java   |  113 +++++++++++++++++++-
 .../src/org/spearce/egit/ui/uitext.properties      |    4 +
 7 files changed, 134 insertions(+), 4 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
Show changes to 7 files +134 −4

org.spearce.egit.ui/icons/elcl16/filterfolder.gif, org.spearce.egit.ui/icons/elcl16/filterproject.gif, org.spearce.egit.ui/icons/elcl16/filterrepo.gif, org.spearce.egit.ui/src/org/spearce/egit/ui/UIIcons.java, org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java, org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java, org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties

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..ced186e 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");
+		FILTERPROJECT = map("elcl16/filterproject.gif");
+		FILTERFOLDER = map("elcl16/filterfolder.gif");
 	}
 
 	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..d74f53e 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,6 +913,15 @@
 	/** */
 	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",
 				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..08887c8 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@dewire.com>
  * Copyright (C) 2008, Roger C. Soares <rogersoares@intelinet.com.br>
  * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
  *
@@ -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;
@@ -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
Shawn O. Pearce· Feb 5, 2009, 16:14 UTC · re: Robin Rosenberg · lore

Re: [EGIT PATCH] Resurrect group filtering options in history view

Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
Show 9 quoted lines
> 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@dewire.com>
> ---
> 
> Same thing, not not adding the NON-NLS stuff tof UIIcons and UIText. We
> should use SuppressWarnings for those files.
Looks good, thanks.  :-)
 
Show 11 quoted lines
>  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            |    9 ++
>  .../egit/ui/internal/history/GitHistoryPage.java   |  113 +++++++++++++++++++-
>  .../src/org/spearce/egit/ui/uitext.properties      |    4 +
>  7 files changed, 134 insertions(+), 4 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
-- 
Shawn.

← back to recent threads