mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
Initial implementation of background caching of packages (PY-18039)
This commit is contained in:
committed by
Mikhail Golubev
parent
58b6cd235a
commit
2401d62f80
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.jetbrains.rest;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
@@ -26,8 +25,11 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.jetbrains.python.packaging.PyPackage;
|
||||
import com.jetbrains.python.packaging.PyPackageManager;
|
||||
import com.jetbrains.python.packaging.PyPackageUtil;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User : catherine
|
||||
*/
|
||||
@@ -45,15 +47,11 @@ public class RestPythonUtil {
|
||||
module = modules.length == 0 ? null : modules [0];
|
||||
}
|
||||
if (module != null) {
|
||||
Sdk sdk = PythonSdkType.findPythonSdk(module);
|
||||
final Sdk sdk = PythonSdkType.findPythonSdk(module);
|
||||
if (sdk != null) {
|
||||
PyPackageManager manager = PyPackageManager.getInstance(sdk);
|
||||
try {
|
||||
final PyPackage sphinx = manager.findPackage("Sphinx", false);
|
||||
presentation.setEnabled(sphinx != null);
|
||||
}
|
||||
catch (ExecutionException ignored) {
|
||||
}
|
||||
final List<PyPackage> packages = PyPackageManager.getInstance(sdk).getPackages();
|
||||
final PyPackage sphinx = packages != null ? PyPackageUtil.findPackage(packages, "Sphinx") : null;
|
||||
presentation.setEnabled(sphinx != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,13 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.jetbrains.python.packaging.PyPackage;
|
||||
import com.jetbrains.python.packaging.PyPackageManager;
|
||||
import com.jetbrains.python.packaging.PyPackageUtil;
|
||||
import com.jetbrains.rest.run.RestConfigurationEditor;
|
||||
import com.jetbrains.rest.run.RestRunConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User : catherine
|
||||
*/
|
||||
@@ -42,14 +45,13 @@ public class SphinxRunConfiguration extends RestRunConfiguration {
|
||||
protected SettingsEditor<? extends RunConfiguration> createConfigurationEditor() {
|
||||
final SphinxTasksModel model = new SphinxTasksModel();
|
||||
if (!model.contains("pdf") && getSdk() != null) {
|
||||
try {
|
||||
final PyPackage rst2pdf = PyPackageManager.getInstance(getSdk()).findPackage("rst2pdf");
|
||||
final List<PyPackage> packages = PyPackageManager.getInstance(getSdk()).getPackages();
|
||||
if (packages != null) {
|
||||
final PyPackage rst2pdf = PyPackageUtil.findPackage(packages,"rst2pdf");
|
||||
if (rst2pdf != null) {
|
||||
model.add(13, "pdf");
|
||||
}
|
||||
}
|
||||
catch (ExecutionException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
RestConfigurationEditor editor = new RestConfigurationEditor(getProject(), this, model);
|
||||
|
||||
Reference in New Issue
Block a user