Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-11-13 15:09:57 +0000
committerThomas Wolf2016-11-13 15:09:57 +0000
commit47213bad0d4e033734e797d090386d574300a3ac (patch)
tree2a02d556a26eb8bc7e9f8b24c1bbd3624c5b3e93
parent77d731f6a14499ba3db3c7ee67ad4b908cd8d7ee (diff)
downloadegit-47213bad0d4e033734e797d090386d574300a3ac.tar.gz
egit-47213bad0d4e033734e797d090386d574300a3ac.tar.xz
egit-47213bad0d4e033734e797d090386d574300a3ac.zip
Consider active editor input only if active part is an editor
The active editor input may be set even if the active part is not an editor. Ensure that EGit considers text selections and the active editor input only if the active part is indeed an editor. Otherwise EGit menu contributions may appear in too many places. Bug: 507398 Change-Id: I4c4822344db0c10240b357fa6986883853f50c9a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java
index 5900eebf96..429b5a43e9 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/selection/SelectionUtils.java
@@ -327,6 +327,10 @@ public class SelectionUtils {
private static IStructuredSelection getSelectionFromEditorInput(
IEvaluationContext context) {
+ Object part = context.getVariable(ISources.ACTIVE_PART_NAME);
+ if (!(part instanceof IEditorPart)) {
+ return StructuredSelection.EMPTY;
+ }
Object object = context.getVariable(ISources.ACTIVE_EDITOR_INPUT_NAME);
Object editor = context.getVariable(ISources.ACTIVE_EDITOR_NAME);
if (editor instanceof MultiPageEditorPart) {

Back to the top