mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix NPE via GotoDeclarationAction.update
This commit is contained in:
@@ -21,7 +21,6 @@ import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -68,7 +67,7 @@ public abstract class BaseCodeInsightAction extends CodeInsightAction {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Editor getBaseEditor(final DataContext dataContext, final Project project) {
|
||||
protected Editor getBaseEditor(@NotNull final DataContext dataContext, @NotNull final Project project) {
|
||||
return super.getEditor(dataContext, project);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class ShowContainerInfoAction extends BaseCodeInsightAction{
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Editor getBaseEditor(final DataContext dataContext, final Project project) {
|
||||
protected Editor getBaseEditor(@NotNull final DataContext dataContext, @NotNull final Project project) {
|
||||
return CommonDataKeys.EDITOR_EVEN_IF_INACTIVE.getData(dataContext);
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -271,7 +271,13 @@ public class GotoDeclarationAction extends BaseCodeInsightAction implements Code
|
||||
if (component != null) {
|
||||
Point point = ((MouseEvent)inputEvent).getPoint();
|
||||
Component componentAt = SwingUtilities.getDeepestComponentAt(component, point.x, point.y);
|
||||
Editor editor = getBaseEditor(event.getDataContext(), event.getProject());
|
||||
Project project = event.getProject();
|
||||
if (project == null) {
|
||||
event.getPresentation().setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Editor editor = getBaseEditor(event.getDataContext(), project);
|
||||
if (componentAt instanceof EditorGutterComponentEx) {
|
||||
event.getPresentation().setEnabled(false);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user