@NotNull
@Override
public ValidationResult validate(@NotNull String baseDirPath) {
- /*if (PythonSdkType.isRemote(myProjectAction.getSdk())) {
+ /*if (PythonSdkType.isRemote(myProjectAction.findPythonSdk())) {
if (PythonRemoteInterpreterManager.getInstance() == null) {
return new ValidationResult(PythonRemoteInterpreterManager.WEB_DEPLOYMENT_PLUGIN_IS_DISABLED);
}
@Nullable
public static PyFile getUserSkeletonForModuleQName(@NotNull String qName, @NotNull PsiElement foothold) {
- final Sdk sdk = PythonSdkType.getSdk(foothold);
+ final Sdk sdk = PythonSdkType.findPythonSdk(foothold);
if (sdk != null) {
final Project project = foothold.getProject();
final PythonSdkPathCache cache = PythonSdkPathCache.getInstance(project, sdk);
myIsEnabled = false;
}
else if (isPyCharm) {
- myIsEnabled = PythonSdkType.getSdk(anchor) != null || PyUtil.isInScratchFile(anchor);
+ myIsEnabled = PythonSdkType.findPythonSdk(anchor) != null || PyUtil.isInScratchFile(anchor);
}
else {
myIsEnabled = true;
val containingName = QualifiedNameFinder.findCanonicalImportPath(containingDirectory, null)
if (containingName != null && containingName.componentCount > 0) {
val absoluteName = containingName.append(name)
- val sdk = PythonSdkType.getSdk(footholdFile) ?: return emptyList()
+ val sdk = PythonSdkType.findPythonSdk(footholdFile) ?: return emptyList()
val skeletonsVirtualFile = PySdkUtil.findSkeletonsDir(sdk) ?: return emptyList()
val skeletonsDir = context.psiManager.findDirectory(skeletonsVirtualFile)
return resolveModuleAt(absoluteName, skeletonsDir, context)
if (file != null) {
final VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile != null) {
- final Sdk sdk = PythonSdkType.getSdk(element);
+ final Sdk sdk = PythonSdkType.findPythonSdk(element);
if (sdk != null) {
final VirtualFile skeletonsDir = findSkeletonsDir(sdk);
if (skeletonsDir != null && VfsUtilCore.isAncestor(skeletonsDir, virtualFile, false)) {
return null;
}
+ @Nullable
+ public static Sdk findPythonSdk(@NotNull final PsiElement element) {
+ return findPythonSdk(ModuleUtilCore.findModuleForPsiElement(element));
+ }
+
@Nullable
public static Sdk findSdkByPath(@Nullable String path) {
if (path != null) {
return false;
}
+ @Deprecated
@Nullable
public static Sdk getSdk(@NotNull final PsiElement element) {
- Module module = ModuleUtilCore.findModuleForPsiElement(element);
- if (module == null) {
- return null;
- }
- return ModuleRootManager.getInstance(module).getSdk();
+ return findPythonSdk(element);
}
@NotNull