Skip to content

Commit

Permalink
Be compatible with latest PyCharm.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaneg committed Apr 13, 2021
1 parent abbb2a4 commit 4b518a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ hs_err_pid*

#Intellij settings
*.iml
.idea/
out/
7 changes: 4 additions & 3 deletions META-INF/plugin.xml → resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<idea-plugin version="2">
<idea-plugin>
<id>JythonHelper</id>
<name>JythonHelper</name>
<version>1.2</version>
<version>1.3</version>
<vendor email="[email protected]">Kane</vendor>
<idea-version since-build="117.105"/>
<idea-version since-build="203"/>
<depends>com.intellij.modules.python</depends>
<description>
Goal:Generate Python skeleton for Java classes in Jython projects.
Expand All @@ -12,6 +12,7 @@
Code at github: https://github.com/kaneg/JythonHelper
</description>
<change-notes>
1.3: Support latest IDEA/PyCharm.
1.2: No longer needs to manually set Target Directory. All skeletons can be generated into SDK's binary folder.
</change-notes>
<depends>com.intellij.modules.python</depends>
Expand Down
7 changes: 3 additions & 4 deletions src/gz/jythonhelper/JythonHelperAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.python.sdk.PythonSdkType;
import com.jetbrains.python.sdk.PythonSdkUtil;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -43,12 +42,12 @@ public void actionPerformed(@NotNull AnActionEvent event) {

private String getTargetDirectory(VirtualFile vf, Project project) {
Module module = ModuleUtil.findModuleForFile(vf, project);
Sdk sdk = PythonSdkType.findPythonSdk(module);
Sdk sdk = PythonSdkUtil.findPythonSdk(module);
if (sdk == null) {
Messages.showErrorDialog(project, "No SDK FOUND", "No SDK FOUND");
return null;
}
return PythonSdkType.getSkeletonsPath(PathManager.getSystemPath(), sdk.getHomePath());
return PythonSdkUtil.getSkeletonsPath(sdk);
}

private void generatePy(String outputDir, String[] libs, String... files) {
Expand Down

0 comments on commit 4b518a8

Please sign in to comment.