mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix yellow code producing by CommonDataKeys
This commit is contained in:
@@ -49,7 +49,7 @@ public class ExecuteInConsoleAction extends AnAction {
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext());
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
|
||||
if (editor != null) {
|
||||
final String selectionText = getSelectionText(editor);
|
||||
if (selectionText != null) {
|
||||
@@ -93,7 +93,7 @@ public class ExecuteInConsoleAction extends AnAction {
|
||||
}
|
||||
|
||||
private static void execute(final AnActionEvent e, final String selectionText) {
|
||||
final Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext());
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Module module = e.getData(LangDataKeys.MODULE);
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ExecuteInConsoleAction extends AnAction {
|
||||
}
|
||||
|
||||
public void update(AnActionEvent e) {
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext());
|
||||
Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
|
||||
Presentation presentation = e.getPresentation();
|
||||
|
||||
boolean enabled = false;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.jetbrains.python.hierarchy;
|
||||
import com.intellij.ide.hierarchy.HierarchyBrowser;
|
||||
import com.intellij.ide.hierarchy.HierarchyProvider;
|
||||
import com.intellij.ide.hierarchy.TypeHierarchyBrowserBase;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
@@ -25,7 +26,7 @@ public class PyTypeHierachyProvider implements HierarchyProvider {
|
||||
public PsiElement getTarget(@NotNull DataContext dataContext) {
|
||||
PsiElement element = LangDataKeys.PSI_ELEMENT.getData(dataContext);
|
||||
if (element == null) {
|
||||
final Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (editor != null && file != null) {
|
||||
element = file.findElementAt(editor.getCaretModel().getOffset());
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package com.jetbrains.python.refactoring.changeSignature;
|
||||
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
@@ -57,7 +58,7 @@ public class PyChangeSignatureHandler implements ChangeSignatureHandler {
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, @Nullable DataContext dataContext) {
|
||||
if (elements.length != 1) return;
|
||||
Editor editor = dataContext == null ? null : PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
Editor editor = dataContext == null ? null : CommonDataKeys.EDITOR.getData(dataContext);
|
||||
invokeOnElement(project, elements[0], editor);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jetbrains.python.refactoring.classes;
|
||||
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
@@ -48,7 +49,7 @@ public abstract class PyClassRefactoringHandler implements RefactoringActionHand
|
||||
|
||||
public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
|
||||
final PsiFile file = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
final Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
|
||||
doRefactor(project, elements[0], elements[elements.length - 1], editor, file, dataContext);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user