From cefb94f242e015aec561edda2990af011335a61d Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Sat, 14 Jan 2017 09:55:26 +0100 Subject: [PATCH] Staging view should react on editor activation Last change for bug 349763 broke the staging view updates on editor activation, this commit restores the previous code related to the part activation handling in staging view, while keeping the original fix for bug 349763. Bug: 349763 Change-Id: I7d980da5f1852d8cc540c8eb242987826fa1de11 Signed-off-by: Andrey Loskutov --- .../egit/ui/internal/staging/StagingView.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java index 8ca1b1f14..96d902aae 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java @@ -501,10 +501,28 @@ public class StagingView extends ViewPart @Override public void partActivated(IWorkbenchPartReference partRef) { - if (lastSelection != null && isMe(partRef)) { - reactOnSelection(lastSelection); + if (isMe(partRef)) { + if (lastSelection != null) { + // view activated: synchronize with last active part + // selection + reactOnSelection(lastSelection); + lastSelection = null; + } + return; + } + IWorkbenchPart part = partRef.getPart(false); + StructuredSelection sel = getSelectionOfPart(part); + if (isViewHidden) { + // remember last selection in the part so that we can + // synchronize on it as soon as we will be visible + lastSelection = sel; + } else { lastSelection = null; + if (sel != null) { + reactOnSelection(sel); + } } + } private void updateHiddenState(IWorkbenchPartReference partRef, -- 2.11.4.GIT