aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Elsemore2013-06-17 14:18:21 (EDT)
committerStephen Elsemore2013-06-17 19:45:55 (EDT)
commita108c6e0a0349783ebd7e8c3eb0d72d39adf609f (patch)
tree8cb30d34f1600f7996030659fe95825e981103b7
parente8497d977c07978e00c4b5a343fc0ff79b0f3b78 (diff)
downloadegit-a108c6e0a0349783ebd7e8c3eb0d72d39adf609f.zip
egit-a108c6e0a0349783ebd7e8c3eb0d72d39adf609f.tar.gz
egit-a108c6e0a0349783ebd7e8c3eb0d72d39adf609f.tar.bz2
Automatically select file for diff when History view commit selectedrefs/changes/53/13853/2
If history is being shown for a single file, then select that file automatically each time a commit is selected. Bug: 410220 Change-Id: I681de41ea613326f4c2b68593b5d20c072d7b5ab Signed-off-by: Stephen Elsemore <selsemore@collab.net>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java16
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java3
2 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
index 39f48f7..3a863f2 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
@@ -639,6 +639,22 @@ public class CommitFileDiffViewer extends TableViewer {
((FileDiffContentProvider) getContentProvider()).setInterestingPaths(interestingPaths);
}
+ void selectFirstInterestingElement() {
+ IStructuredContentProvider contentProvider = ((IStructuredContentProvider) getContentProvider());
+ Object[] elements = contentProvider.getElements(getInput());
+ for (final Object element : elements) {
+ if (element instanceof FileDiff) {
+ FileDiff fileDiff = (FileDiff) element;
+ boolean marked = fileDiff
+ .isMarked(FileDiffContentProvider.INTERESTING_MARK_TREE_FILTER_INDEX);
+ if (marked) {
+ setSelection(new StructuredSelection(fileDiff));
+ return;
+ }
+ }
+ }
+ }
+
private void revealFirstInterestingElement() {
IStructuredContentProvider contentProvider = ((IStructuredContentProvider) getContentProvider());
Object[] elements = contentProvider.getElements(getInput());
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 e2a454c..b6e99b1 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
@@ -900,6 +900,9 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
} finally {
walk.dispose();
}
+
+ if (input.getSingleFile() != null)
+ fileViewer.selectFirstInterestingElement();
}
});
commentViewer