Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Lay2010-09-06 11:00:26 +0000
committerCode Review2010-09-06 11:00:26 +0000
commita2dc1ed7ceb5faa54d499984cad504c979377fb0 (patch)
treeadf7e41171a5cf28bd0118cd9ffb32a1977d10fe
parentb1b76895c909160bd586d18523850ed6a53cb0d6 (diff)
parent81f5c32b35653940da7adbcaab2b2b70db84b81e (diff)
downloadegit-a2dc1ed7ceb5faa54d499984cad504c979377fb0.tar.gz
egit-a2dc1ed7ceb5faa54d499984cad504c979377fb0.tar.xz
egit-a2dc1ed7ceb5faa54d499984cad504c979377fb0.zip
Merge "History View: always show selected resource"
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java24
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java78
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties8
3 files changed, 94 insertions, 16 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index 358da7008c..c2a0dfc8b4 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -229,6 +229,18 @@ public class UIText extends NLS {
public static String GitDocument_errorRefreshQuickdiff;
/** */
+ public static String GitHistoryPage_AllChangesInFolderHint;
+
+ /** */
+ public static String GitHistoryPage_AllChangesInProjectHint;
+
+ /** */
+ public static String GitHistoryPage_AllChangesInRepoHint;
+
+ /** */
+ public static String GitHistoryPage_AllChangesOfResourceHint;
+
+ /** */
public static String GitDocument_errorResolveQuickdiff;
/** */
@@ -271,6 +283,12 @@ public class UIText extends NLS {
public static String GitHistoryPage_FileNotInCommit;
/** */
+ public static String GitHistoryPage_FileType;
+
+ /** */
+ public static String GitHistoryPage_FolderType;
+
+ /** */
public static String GitHistoryPage_fileNotFound;
/** */
@@ -286,9 +304,15 @@ public class UIText extends NLS {
public static String GitHistoryPage_From;
/** */
+ public static String GitHistoryPage_MultiResourcesType;
+
+ /** */
public static String GitHistoryPage_OpenMenuLabel;
/** */
+ public static String GitHistoryPage_ProjectType;
+
+ /** */
public static String GitHistoryPage_QuickdiffMenuLabel;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
index 32bf454861..a26413e607 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
@@ -70,7 +70,6 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevFlag;
import org.eclipse.jgit.revwalk.RevSort;
import org.eclipse.jgit.revwalk.RevWalk;
-import org.eclipse.jgit.revwalk.filter.RevFilter;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
@@ -110,6 +109,10 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener {
private static final String POPUP_ID = "org.eclipse.egit.ui.historyPageContributions"; //$NON-NLS-1$
+ private static final String DESCRIPTION_PATTERN = "{0} - {1}"; //$NON-NLS-1$
+
+ private static final String NAME_PATTERN = "{0}: {1} [{2}]"; //$NON-NLS-1$
+
/** Standard action: select all */
private IAction selectAllAction;
@@ -266,6 +269,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener {
@Override
public void run() {
String oldName = getName();
+ String oldDescription = getDescription();
if (!isChecked()) {
if (showAllFilter == filter) {
showAllFilter = ShowFilter.SHOWALLRESOURCE;
@@ -287,6 +291,11 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener {
}
GitHistoryPage.this.firePropertyChange(GitHistoryPage.this, P_NAME,
oldName, getName());
+ // even though this is currently ending nowhere (see bug 324386), we
+ // still create the event
+ GitHistoryPage.this.firePropertyChange(GitHistoryPage.this,
+ P_DESCRIPTION, oldDescription, GitHistoryPage.this
+ .getDescription());
Activator.getDefault().getPreferenceStore().setValue(
PREF_SHOWALLFILTER, showAllFilter.toString());
}
@@ -1206,31 +1215,68 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener {
}
public String getName() {
+ // we always visualize the current input in the form
+ // <type>: <path> [<respository name>]
+ // in order to give the user an understanding which context
+ // menus they can expect with the current input
+ // we show the filter hint only upon getDescription()
+ // as it wrongly pollutes the navigation history
+ final String repositoryName = Activator.getDefault()
+ .getRepositoryUtil().getRepositoryName(db);
final ResourceList in = (ResourceList) super.getInput();
- if (currentWalk == null || in == null)
- return ""; //$NON-NLS-1$
- final IResource[] items = in.getItems();
- if (items.length == 0)
+ if (currentWalk == null || in == null || in.getItems().length == 0)
return ""; //$NON-NLS-1$
- final StringBuilder b = new StringBuilder();
- b.append(db.getDirectory().getParentFile().getName());
- if (currentWalk.getRevFilter() != RevFilter.ALL) {
- b.append(": "); //$NON-NLS-1$
- b.append(currentWalk.getRevFilter());
- }
- if (currentWalk.getTreeFilter() != TreeFilter.ALL) {
- b.append(":"); //$NON-NLS-1$
+ if (in.getItems().length == 1) {
+ IResource resource = in.getItems()[0];
+ final String type;
+ switch (resource.getType()) {
+ case IResource.FILE:
+ type = UIText.GitHistoryPage_FileType;
+ break;
+ case IResource.PROJECT:
+ type = UIText.GitHistoryPage_ProjectType;
+ break;
+ default:
+ type = UIText.GitHistoryPage_FolderType;
+ break;
+ }
+ String path = resource.getFullPath().makeRelative().toString();
+ if (resource.getType() == IResource.FOLDER)
+ path = path + '/';
+ return NLS.bind(NAME_PATTERN, new Object[] { type, path,
+ repositoryName });
+ } else {
+ // can this happen at all? the generic history view can't
+ // handle multiple selection
+ StringBuilder b = new StringBuilder();
for (final String p : pathFilters) {
- b.append(' ');
b.append(p);
+ b.append(' ');
}
+ return NLS.bind(NAME_PATTERN, new Object[] {
+ UIText.GitHistoryPage_MultiResourcesType, b.toString(), repositoryName });
}
- return b.toString();
}
public String getDescription() {
- return getName();
+ // this doesn't seem to be rendered anywhere, but still...
+ String filterHint = null;
+ switch (showAllFilter) {
+ case SHOWALLREPO:
+ filterHint = UIText.GitHistoryPage_AllChangesInRepoHint;
+ break;
+ case SHOWALLPROJECT:
+ filterHint = UIText.GitHistoryPage_AllChangesInProjectHint;
+ break;
+ case SHOWALLFOLDER:
+ filterHint = UIText.GitHistoryPage_AllChangesInFolderHint;
+ break;
+ case SHOWALLRESOURCE:
+ filterHint = UIText.GitHistoryPage_AllChangesOfResourceHint;
+ break;
+ }
+ return NLS.bind(DESCRIPTION_PATTERN, getName(), filterHint);
}
private abstract class BooleanPrefAction extends Action implements
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index 520842ef2f..29ab00e6eb 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -82,6 +82,10 @@ GitDocument_errorLoadCommit=Could not load commit {0} for {1} corresponding to {
GitDocument_errorLoadTree=Could not load tree {0} for {1} corresponding to {2} in {3}
GitDocument_errorRefreshQuickdiff=Failed to refresh quickdiff
GitDocument_errorResolveQuickdiff=Could not resolve quickdiff baseline {0} corresponding to {1} in {2}
+GitHistoryPage_AllChangesInFolderHint=All changes of this resource's parent folder and its children
+GitHistoryPage_AllChangesInProjectHint=All changes of this resource's project and its children
+GitHistoryPage_AllChangesInRepoHint=All changes in the Repository containing this resource
+GitHistoryPage_AllChangesOfResourceHint=Changes of this resource and its children only
GitHistoryPage_CheckoutMenuLabel=&Checkout
GitHistoryPage_CompareWithEachOtherMenuLabel=Compare with &each other
GitHistoryPage_CompareWithWorkingTreeMenuMenuLabel=Compare with &working tree
@@ -99,8 +103,12 @@ GitHistoryPage_notContainedInCommits=File {0} is not contained in the commits: {
GitHistoryPage_openFailed=Opening Editor failed
GitHistoryPage_Date=Date
GitHistoryPage_FileNotInCommit={0} not in {1}
+GitHistoryPage_FileType=File
+GitHistoryPage_FolderType=Folder
GitHistoryPage_From=From
+GitHistoryPage_MultiResourcesType=Multiple Resources
GitHistoryPage_OpenMenuLabel=&Open
+GitHistoryPage_ProjectType=Project
GitHistoryPage_QuickdiffMenuLabel=&Quick Diff
GitHistoryPage_ResetBaselineToHeadMenuLabel=Reset Baseline to &HEAD
GitHistoryPage_ResetBaselineToParentOfHeadMenuLabel=Reset Baseline to first &Parent of HEAD

Back to the top