diff options
| author | Andrey Loskutov | 2017-01-14 08:55:26 +0000 |
|---|---|---|
| committer | Andrey Loskutov | 2017-01-14 08:55:26 +0000 |
| commit | cefb94f242e015aec561edda2990af011335a61d (patch) | |
| tree | 72fd91bd8747d73470e893cc3a89e3af09e7e96e | |
| parent | 6c442627c885d19b7a5aca9f574dfe12e5ed1792 (diff) | |
| download | egit-cefb94f242e015aec561edda2990af011335a61d.tar.gz egit-cefb94f242e015aec561edda2990af011335a61d.tar.xz egit-cefb94f242e015aec561edda2990af011335a61d.zip | |
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 <loskutov@gmx.de>
| -rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java | 22 |
1 files 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 8ca1b1f144..96d902aaed 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, |
