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:
@@ -16,6 +16,7 @@
|
||||
package com.jetbrains.python.newProject;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -40,7 +41,7 @@ public class PythonNewDirectoryProjectAction extends NewDirectoryProjectAction {
|
||||
private boolean myInstallFramework;
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project == null) {
|
||||
project = ProjectManager.getInstance().getDefaultProject();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jetbrains.rest;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
@@ -25,7 +26,7 @@ public class RestPythonUtil {
|
||||
public static Presentation updateSphinxQuickStartRequiredAction(final AnActionEvent e) {
|
||||
final Presentation presentation = e.getPresentation();
|
||||
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project != null) {
|
||||
Module module = e.getData(LangDataKeys.MODULE);
|
||||
if (module == null) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.process.ProcessTerminatedListener;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
@@ -27,7 +28,7 @@ import javax.swing.*;
|
||||
public class CompileQrcAction extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
VirtualFile[] vFiles = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
|
||||
assert vFiles != null;
|
||||
Module module = e.getData(LangDataKeys.MODULE);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateUtil;
|
||||
import com.intellij.ide.util.DirectoryChooserUtil;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -32,7 +33,7 @@ public class CreatePackageAction extends DumbAwareAction {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
final PsiDirectory directory = DirectoryChooserUtil.getOrChooseDirectory(view);
|
||||
|
||||
if (directory == null) return;
|
||||
@@ -90,7 +91,7 @@ public class CreatePackageAction extends DumbAwareAction {
|
||||
}
|
||||
|
||||
private static boolean isEnabled(AnActionEvent e) {
|
||||
Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
final IdeView ideView = e.getData(LangDataKeys.IDE_VIEW);
|
||||
if (project == null || ideView == null) {
|
||||
return false;
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ExecuteInConsoleAction extends AnAction {
|
||||
|
||||
private static void execute(final AnActionEvent e, final String selectionText) {
|
||||
final Editor editor = PlatformDataKeys.EDITOR.getData(e.getDataContext());
|
||||
Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Module module = e.getData(LangDataKeys.MODULE);
|
||||
|
||||
findCodeExecutor(e, new Consumer<PyCodeExecutor>() {
|
||||
@@ -227,7 +227,7 @@ public class ExecuteInConsoleAction extends AnAction {
|
||||
}
|
||||
|
||||
private static boolean canFindConsole(AnActionEvent e) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
if (project != null) {
|
||||
Collection<RunContentDescriptor> descriptors = getConsoles(project);
|
||||
return descriptors.size() > 0;
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
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.project.DumbAware;
|
||||
@@ -31,14 +32,14 @@ public class PyOpenDebugConsoleAction extends AnAction implements DumbAware {
|
||||
public void update(final AnActionEvent e) {
|
||||
e.getPresentation().setVisible(false);
|
||||
e.getPresentation().setEnabled(true);
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project != null) {
|
||||
e.getPresentation().setVisible(getConsoles(project).size() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project != null) {
|
||||
selectRunningProcess(e.getDataContext(), project, new Consumer<PythonDebugLanguageConsoleView>() {
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -45,7 +46,7 @@ public class RunPythonConsoleAction extends AnAction implements DumbAware {
|
||||
public void update(final AnActionEvent e) {
|
||||
e.getPresentation().setVisible(true);
|
||||
e.getPresentation().setEnabled(false);
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project != null) {
|
||||
Pair<Sdk, Module> sdkAndModule = findPythonSdkAndModule(project, e.getData(LangDataKeys.MODULE));
|
||||
if (sdkAndModule.first != null) {
|
||||
@@ -55,7 +56,7 @@ public class RunPythonConsoleAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
runPythonConsole(project, e.getData(LangDataKeys.MODULE));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.ide.fileTemplates.actions.CreateFromTemplateAction;
|
||||
import com.intellij.ide.fileTemplates.ui.CreateFromTemplateDialog;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
@@ -55,7 +56,7 @@ public class CreateSetupPyAction extends CreateFromTemplateAction {
|
||||
|
||||
@Override
|
||||
public AttributesDefaults getAttributesDefaults(DataContext dataContext) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
final AttributesDefaults defaults = new AttributesDefaults("setup.py").withFixedName(true);
|
||||
if (project != null) {
|
||||
defaults.add("Package_name", project.getName());
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.intellij.ide.DataManager;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationListener;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -235,7 +236,7 @@ public class PythonSdkType extends SdkType {
|
||||
}
|
||||
|
||||
public void showCustomCreateUI(SdkModel sdkModel, final JComponent parentComponent, final Consumer<Sdk> sdkCreatedCallback) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(parentComponent));
|
||||
Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(parentComponent));
|
||||
InterpreterPathChooser.show(project, sdkModel.getSdks(), RelativePoint.getCenterOf(parentComponent), true, new NullableConsumer<Sdk>() {
|
||||
@Override
|
||||
public void consume(@Nullable Sdk sdk) {
|
||||
@@ -477,10 +478,10 @@ public class PythonSdkType extends SdkType {
|
||||
ownerComponent = ownerComponentRef.get();
|
||||
}
|
||||
if (ownerComponent != null) {
|
||||
project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(ownerComponent));
|
||||
project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(ownerComponent));
|
||||
}
|
||||
else {
|
||||
project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
|
||||
project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
|
||||
}
|
||||
setupSdkPaths(sdk, project, ownerComponent);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jetbrains.python.sdk.flavors;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -32,7 +33,7 @@ public class VirtualEnvSdkFlavor extends CPythonSdkFlavor {
|
||||
|
||||
@Override
|
||||
public Collection<String> suggestHomePaths() {
|
||||
final Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
|
||||
final Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
|
||||
List<String> candidates = new ArrayList<String>();
|
||||
if (project != null) {
|
||||
VirtualFile rootDir = project.getBaseDir();
|
||||
|
||||
Reference in New Issue
Block a user