From: Aleksey Pivovarov Date: Mon, 24 Oct 2016 15:19:55 +0000 (+0300) Subject: diff: "Jump to Source" - consume shortcut if action is disabled X-Git-Tag: appcode/171.432~75 X-Git-Url: https://git.jetbrains.org/?p=idea%2Fcommunity.git;a=commitdiff_plain;h=177e08adde2a831ab9d7bca84d7d58e9166f6ef2 diff: "Jump to Source" - consume shortcut if action is disabled --- diff --git a/platform/diff-impl/src/com/intellij/diff/actions/impl/OpenInEditorAction.java b/platform/diff-impl/src/com/intellij/diff/actions/impl/OpenInEditorAction.java index b6ea4bbeda81..59f84900277b 100644 --- a/platform/diff-impl/src/com/intellij/diff/actions/impl/OpenInEditorAction.java +++ b/platform/diff-impl/src/com/intellij/diff/actions/impl/OpenInEditorAction.java @@ -21,6 +21,7 @@ import com.intellij.diff.tools.util.DiffDataKeys; import com.intellij.diff.util.DiffUserDataKeys; import com.intellij.diff.util.DiffUtil; import com.intellij.ide.actions.EditSourceAction; +import com.intellij.openapi.actionSystem.ActionPlaces; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataKey; @@ -43,6 +44,11 @@ public class OpenInEditorAction extends EditSourceAction implements DumbAware { @Override public void update(@NotNull AnActionEvent e) { + if (!ActionPlaces.isToolbarPlace(e.getPlace())) { + e.getPresentation().setEnabledAndVisible(true); + return; + } + DiffRequest request = e.getData(DiffDataKeys.DIFF_REQUEST); DiffContext context = e.getData(DiffDataKeys.DIFF_CONTEXT); @@ -70,9 +76,11 @@ public class OpenInEditorAction extends EditSourceAction implements DumbAware { @Override public void actionPerformed(@NotNull AnActionEvent e) { Project project = e.getProject(); - assert project != null; + if (project == null) return; + + Navigatable navigatable = e.getData(CommonDataKeys.NAVIGATABLE); + if (navigatable == null) return; - Navigatable navigatable = e.getRequiredData(CommonDataKeys.NAVIGATABLE); openEditor(project, navigatable); }