mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,7 +23,6 @@ import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
@@ -32,6 +31,7 @@ import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SmartEnterAction extends EditorAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Editor getEditor(final DataContext dataContext) {
|
||||
protected Editor getEditor(@NotNull final DataContext dataContext) {
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
if (editor == null) return null;
|
||||
Project project = editor.getProject();
|
||||
|
||||
+4
-3
@@ -51,8 +51,9 @@ public abstract class EditorAction extends AnAction implements DumbAware {
|
||||
if (!myHandlersLoaded) {
|
||||
myHandlersLoaded = true;
|
||||
final String id = ActionManager.getInstance().getId(this);
|
||||
for (int i = Extensions.getExtensions(EditorActionHandlerBean.EP_NAME).length - 1; i >= 0; i--) {
|
||||
final EditorActionHandlerBean handlerBean = Extensions.getExtensions(EditorActionHandlerBean.EP_NAME)[i];
|
||||
EditorActionHandlerBean[] extensions = Extensions.getExtensions(EditorActionHandlerBean.EP_NAME);
|
||||
for (int i = extensions.length - 1; i >= 0; i--) {
|
||||
final EditorActionHandlerBean handlerBean = extensions[i];
|
||||
if (handlerBean.action.equals(id)) {
|
||||
myHandler = handlerBean.getHandler(myHandler);
|
||||
}
|
||||
@@ -68,7 +69,7 @@ public abstract class EditorAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Editor getEditor(final DataContext dataContext) {
|
||||
protected Editor getEditor(@NotNull DataContext dataContext) {
|
||||
return CommonDataKeys.EDITOR.getData(dataContext);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -24,6 +24,7 @@ import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class InactiveEditorAction extends EditorAction {
|
||||
@@ -33,7 +34,7 @@ public class InactiveEditorAction extends EditorAction {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Editor getEditor(final DataContext dataContext) {
|
||||
protected Editor getEditor(@NotNull final DataContext dataContext) {
|
||||
return CommonDataKeys.EDITOR_EVEN_IF_INACTIVE.getData(dataContext);
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.intellij.openapi.editor.textarea.TextComponentEditor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.text.JTextComponent;
|
||||
@@ -30,18 +31,18 @@ import javax.swing.text.JTextComponent;
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class TextComponentEditorAction extends EditorAction {
|
||||
protected TextComponentEditorAction(final EditorActionHandler defaultHandler) {
|
||||
protected TextComponentEditorAction(@NotNull EditorActionHandler defaultHandler) {
|
||||
super(defaultHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Editor getEditor(final DataContext dataContext) {
|
||||
protected Editor getEditor(@NotNull final DataContext dataContext) {
|
||||
return getEditorFromContext(dataContext);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Editor getEditorFromContext(final DataContext dataContext) {
|
||||
public static Editor getEditorFromContext(@NotNull DataContext dataContext) {
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
if (editor != null) return editor;
|
||||
final Object data = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
|
||||
|
||||
Reference in New Issue
Block a user