Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2018-11-04 09:48:06 +0000
committerThomas Wolf2018-11-09 20:49:30 +0000
commitf2cb571600ce8a919ba2db15d5762fb9827b5760 (patch)
tree23c36bda28316f86f424084816642447c6a39983
parent3efdfb6173b18fca665a72f849dd15e1c2731c84 (diff)
downloadegit-f2cb571600ce8a919ba2db15d5762fb9827b5760.tar.gz
egit-f2cb571600ce8a919ba2db15d5762fb9827b5760.tar.xz
egit-f2cb571600ce8a919ba2db15d5762fb9827b5760.zip
Fix editor context menu Team > Show in Repository
The handler needs to get the current editor from the context. The context information is lost by switching to the view. Therefore first remember the selection, then switch to the view. Bug: 540747 Change-Id: Ic6c303dd06a9e6062514444e732cd21245369158 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowRepositoriesViewActionHandler.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowRepositoriesViewActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowRepositoriesViewActionHandler.java
index 82b8eeb643..c3faff57e0 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowRepositoriesViewActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ShowRepositoriesViewActionHandler.java
@@ -18,6 +18,7 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.egit.ui.internal.repository.RepositoriesView;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ShowInContext;
@@ -31,10 +32,13 @@ public class ShowRepositoriesViewActionHandler extends RepositoryActionHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
RepositoriesView view;
try {
+ // remember selection before activating a new view
+ IStructuredSelection selection = getSelection(event);
+
view = (RepositoriesView) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().showView(
RepositoriesView.VIEW_ID);
- ShowInContext ctx = new ShowInContext(ResourcesPlugin.getWorkspace().getRoot(), getSelection(event));
+ ShowInContext ctx = new ShowInContext(ResourcesPlugin.getWorkspace().getRoot(), selection);
view.show(ctx);
} catch (PartInitException e) {
throw new ExecutionException(e.getMessage(), e);

Back to the top