diff --git a/figures/IntelliJ_env_edit_config.png b/figures/IntelliJ_env_edit_config.png new file mode 100644 index 0000000000000000000000000000000000000000..8f3d3650db4e17bc518c417e704ea73dbd6d68bc Binary files /dev/null and b/figures/IntelliJ_env_edit_config.png differ diff --git a/napi_IntelliJ_plugin/generator/.idea/misc.xml b/napi_IntelliJ_plugin/generator/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..ccf05f98c1c2b9d4f778d3100dacdc48b19912c9 --- /dev/null +++ b/napi_IntelliJ_plugin/generator/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/napi_IntelliJ_plugin/generator/.idea/modules.xml b/napi_IntelliJ_plugin/generator/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..6d1acc9dd2f1ff3521bcadf9e550018d4305263f --- /dev/null +++ b/napi_IntelliJ_plugin/generator/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/napi_IntelliJ_plugin/generator/.idea/vcs.xml b/napi_IntelliJ_plugin/generator/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ b/napi_IntelliJ_plugin/generator/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/napi_IntelliJ_plugin/generator/.idea/workspace.xml b/napi_IntelliJ_plugin/generator/.idea/workspace.xml new file mode 100644 index 0000000000000000000000000000000000000000..f7e789f06e01cad91c681af58fb8ce482e2c2c74 --- /dev/null +++ b/napi_IntelliJ_plugin/generator/.idea/workspace.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1655977297065 + + + + \ No newline at end of file diff --git a/napi_IntelliJ_plugin/generator/README_zh.md b/napi_IntelliJ_plugin/generator/README_zh.md index a3202496d6206cb58831fbbf27fd1c3ba90d90f9..a3c00d0f8be67adedd86561f980f5725356196bf 100644 --- a/napi_IntelliJ_plugin/generator/README_zh.md +++ b/napi_IntelliJ_plugin/generator/README_zh.md @@ -8,11 +8,11 @@ JDK 11 ,IDEA Community 2021.3.3 2.打开IDEA Community 应用程序。 -依次点击项目File>Open 选择napi_generator/src/generator项目文件夹。 +依次点击项目File>Open 选择napi_generator/napi_IntelliJ_plugin/generator项目文件夹。 ![](../../figures/IntelliJ_env_config_open_proj.png) -3.项目配置 -项目打开完成,点击File>Project Structure +3.配置Project +项目打开完成,点击File>Project Structure,在出现的界面中点击Project,下图的SDK选择JDK 11,选择或者新建complier output目录为项目文件下的out目录。 ![](../../figures/IntelliJ_env_proj_structure.png) @@ -21,19 +21,20 @@ Project Settings > Modules 新建Modules.点击上方“-”删除原有的Modul ![](../../figures/IntelliJ_env_Proj_Module.png) -5.配置Module SDK. +5.配置Module SDK.(若SDKs中有相应的Plugin SDK和JDK 11,可以选择默认的Module SDK,点击图中next) 在New Modules对话框中,选择IntelliJ Platform Plugin。若为首次环境配置,请在Module SDK 下拉框中点击 Add IntelliJ Platform Plugin SDK 选择IDEA Community安装目录,点击OK,在Select Internal Java Platform 选择 JAVA SDK 11(213版本只支持 11) ![](../../figures/IntelliJ_env_Proj_Module_New.png) 6.配置Root Content. -在上图界面点击Next,选择Content root:为napi_generator/src/generator文件夹,module name会自动变为generator,若出现提示已存在是否覆盖的提示,请点“是”完成配置。 +在上图界面点击Next,选择Content root:选择或者理性为项目根目录(注意:此处必须为项目文件夹的目录),module name会自动变为generator,若出现提示已存在是否覆盖的提示,请点“Finish”完成配置。 ![](../../figures/IntelliJ_env_module_root.png) 7.配置完成Modules后,若在SDKs中无相应JDK和Plugin SDK,请点击+号分别添加 Add Java JDK和Add Intellij PlantForm Plugin SDK,Java JDK为java11的安装目录,Plugin SDK为 IDEA Community 2021.3.3的安装目录。 ![](../../figures/IntelliJ_env_config_SDKs.png) -8.若完成步骤7配置,点击OK完成配置。Rebuild项目,若IDEA依然不能点击右上角的运行。请重新配置一次Modules。 +8.若完成步骤7配置,点击OK完成配置。Rebuild项目,若IDEA依然不能点击右上角的运行。请点击Edit configuration编译选择Use classpath of Mode为前面配置好的Module名称。 +![](../../figures/IntelliJ_env_edit_config.png) 9.项目运行成功后,会另起一个IDEA应用程序。插件运行在IDEA中,只需要新建一个Grandle Project,添加相应的TS文件到项目文件夹里面,就可以右击文件,选择Generate napi Frame出现插件主界面进行相应操作。 diff --git a/napi_IntelliJ_plugin/generator/src/com/sk/ng/GenDTS.java b/napi_IntelliJ_plugin/generator/src/com/sk/ng/GenDTS.java index 020bc614d318c25b005e9922fe35d72d6b3a0a15..e49acc2335aa4b07894e0ad65879f9bac6c74a24 100644 --- a/napi_IntelliJ_plugin/generator/src/com/sk/ng/GenDTS.java +++ b/napi_IntelliJ_plugin/generator/src/com/sk/ng/GenDTS.java @@ -46,11 +46,6 @@ public class GenDTS extends AnAction { if (project == null) { return; } - String baseFile = project.getBasePath(); - - if (FileUtil.checkProjectSDK(project, baseFile)) { - return; - } String destPath = file.getPath(); String directoryPath = file.getParent().getPath(); diff --git a/napi_IntelliJ_plugin/generator/src/com/sk/ng/GenMenuDTS.java b/napi_IntelliJ_plugin/generator/src/com/sk/ng/GenMenuDTS.java index f69f004996d4a6364a71a7d14a07d9f43f3f3286..f994436ce3a39a396a94cbb73df51558f3f8e848 100644 --- a/napi_IntelliJ_plugin/generator/src/com/sk/ng/GenMenuDTS.java +++ b/napi_IntelliJ_plugin/generator/src/com/sk/ng/GenMenuDTS.java @@ -18,7 +18,6 @@ import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.project.Project; import com.sk.dialog.GenerateDialog; -import com.sk.utils.FileUtil; import org.jetbrains.annotations.NotNull; /** @@ -38,11 +37,6 @@ public class GenMenuDTS extends AnAction { if (project == null) { return; } - String baseFile = project.getBasePath(); - - if (FileUtil.checkProjectSDK(project, baseFile)) { - return; - } GenerateDialog wrapper = new GenerateDialog(project, "", "", ""); wrapper.showAndGet();