From 2e2810f7afd230a88ea5f3740401343814fd7e12 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Tue, 26 Jun 2018 21:17:20 +0200 Subject: Avoid identical entries in history view history The egit history view implementation adapts the workbench selection when setting new input. The non egit history part creates a history dropdown from the inputs before they were adapted by egit. That is why the history dropdown can contain multiple similar entries, since they have been adapted to the same input by egit, but the general team API only sees the different (non adapted) inputs. We can fix this by returning the adapted input from egit to the general team API, so the comparison of inputs really removes the duplicates. Change-Id: Ie5139f83f7b75af76ed1c375cf139611a332329d Signed-off-by: Michael Keppler Bug:536313--- .../eclipse/egit/ui/internal/history/GitHistoryPage.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 c0eb0bd524..c44a2e27b0 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 @@ -1805,7 +1805,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation(), useAsInput); - if (useAsInput == getInput()) + if (useAsInput == super.getInput()) return true; this.input = null; return super.setInput(useAsInput); @@ -2174,6 +2174,18 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, return this.input; } + /** + * The super implementation returns the raw input (e.g. the workbench + * selection). The Git History Page however adapts that input before + * actually using it. If we don't return this adapted input, then the + * history drop down will show the same (adapted) history input multiple + * times. + */ + @Override + public Object getInput() { + return getInputInternal(); + } + void setWarningTextInUIThread(final Job j) { graph.getControl().getDisplay().asyncExec(new Runnable() { @Override @@ -2208,7 +2220,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener, GitTraceLocation.getTrace().trace( GitTraceLocation.HISTORYVIEW.getLocation(), "Setting input to table"); //$NON-NLS-1$ - final Object currentInput = getInput(); + final Object currentInput = GitHistoryPage.super.getInput(); searchBar.setInput(new ICommitsProvider() { @Override -- cgit v1.2.3