diff --git a/napi_IntelliJ_plugin/resources/images/openDisk.png b/napi_IntelliJ_plugin/resources/images/openDisk.png index 5e66baa62e361484a32069b4277e269bcdce722f..5956a0e538a400c7deaf41167ae5ea70348b8584 100644 Binary files a/napi_IntelliJ_plugin/resources/images/openDisk.png and b/napi_IntelliJ_plugin/resources/images/openDisk.png differ diff --git a/napi_IntelliJ_plugin/resources/images/text.png b/napi_IntelliJ_plugin/resources/images/text.png index e2442e2b179f2069f6345e8bbff808c3e6b0bb05..f42534169aa41dd830a7cb09792fe1428c2f34f7 100644 Binary files a/napi_IntelliJ_plugin/resources/images/text.png and b/napi_IntelliJ_plugin/resources/images/text.png differ diff --git a/napi_IntelliJ_plugin/src/com/sk/action/BrowseAction.java b/napi_IntelliJ_plugin/src/com/sk/action/BrowseAction.java index b8fca5f242d5246001aaca3c57676f10e2a662ae..1e1b3a3a9d2f5270e21e72cdabf71b4500ea41ae 100644 --- a/napi_IntelliJ_plugin/src/com/sk/action/BrowseAction.java +++ b/napi_IntelliJ_plugin/src/com/sk/action/BrowseAction.java @@ -32,7 +32,7 @@ import java.util.prefs.Preferences; /** * 接口文件选择框。 * - * @author: xudong + * @author: zhaoxudong@kaihong.com * @see: select file * @version: v1.0.0 * @since 2022-02-21 diff --git a/napi_IntelliJ_plugin/src/com/sk/action/GenAction.java b/napi_IntelliJ_plugin/src/com/sk/action/GenAction.java index bd6122f30d3d9fc78ef965894c2ebf84738d2538..7d31aa563a3ebf7ede9d08a014197beefeb95966 100644 --- a/napi_IntelliJ_plugin/src/com/sk/action/GenAction.java +++ b/napi_IntelliJ_plugin/src/com/sk/action/GenAction.java @@ -23,7 +23,7 @@ import java.awt.event.ActionListener; /** * 编译文件夹选择框 * - * @author: xudong + * @author: zhaoxudong@kaihong.com * @see: select generator file path * @version: v1.0.0 * @since 2022-02-21 diff --git a/napi_IntelliJ_plugin/src/com/sk/action/ScriptAction.java b/napi_IntelliJ_plugin/src/com/sk/action/ScriptAction.java index c2a172fb93003d7c2870666c4268f980a1372926..5f2c49c8a4631305cdc82bdc15b37e6edebecac1 100644 --- a/napi_IntelliJ_plugin/src/com/sk/action/ScriptAction.java +++ b/napi_IntelliJ_plugin/src/com/sk/action/ScriptAction.java @@ -23,7 +23,7 @@ import java.awt.event.ActionListener; /** * 脚本选择对话框 * - * @author: xudong + * @author: zhaoxudong@kaihong.com * @see: select compile script * @version: v1.0.0 * @since 2022-02-21 diff --git a/napi_IntelliJ_plugin/src/com/sk/action/SelectHAction.java b/napi_IntelliJ_plugin/src/com/sk/action/SelectHAction.java new file mode 100644 index 0000000000000000000000000000000000000000..2f13588eeb7b7d640a73ad9e7d15104628542671 --- /dev/null +++ b/napi_IntelliJ_plugin/src/com/sk/action/SelectHAction.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.sk.action; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JTextField; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 编译文件夹选择框 + * + * @author: zhaoxudong@kaihong.com + * @see: select generator file path + * @version: v1.0.0 + * @since 2022-02-21 + */ +public class SelectHAction implements ActionListener { + private final JButton button; + private final JTextField textField; + + public SelectHAction(JButton button, JTextField textField) { + this.button = button; + this.textField = textField; + } + + @Override + public void actionPerformed(ActionEvent actionEvent) { + if (actionEvent.getSource().equals(button)) { + JFileChooser fcDlg = new JFileChooser(); + fcDlg.setDialogTitle("请选择.h文件路径..."); + fcDlg.setFileSelectionMode(JFileChooser.FILES_ONLY); + FileNameExtensionFilter filter = new FileNameExtensionFilter("文本文件(*.h)", "h"); + fcDlg.setMultiSelectionEnabled(true); + fcDlg.setFileFilter(filter); + int returnVal = fcDlg.showOpenDialog(null); + if (returnVal == JFileChooser.APPROVE_OPTION) { + String filepath = fcDlg.getSelectedFile().getPath(); + textField.setText(filepath); + } + } + } +} diff --git a/napi_IntelliJ_plugin/src/com/sk/action/SelectOutPathAction.java b/napi_IntelliJ_plugin/src/com/sk/action/SelectOutPathAction.java new file mode 100644 index 0000000000000000000000000000000000000000..dc7a6991307c6a667fce0fbb42762a85d2fc93da --- /dev/null +++ b/napi_IntelliJ_plugin/src/com/sk/action/SelectOutPathAction.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.sk.action; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JTextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 编译文件夹选择框 + * + * @author: zhaoxudong@kaihong.com + * @see: select generator file path + * @version: v1.0.0 + * @since 2022-02-21 + */ +public class SelectOutPathAction implements ActionListener { + private final JButton button; + private final JTextField textField; + + public SelectOutPathAction(JButton button, JTextField textField) { + this.button = button; + this.textField = textField; + } + + @Override + public void actionPerformed(ActionEvent actionEvent) { + if (actionEvent.getSource().equals(button)) { + JFileChooser fcDlg = new JFileChooser(); + fcDlg.setDialogTitle("请选择输出目录路径..."); + fcDlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + int returnVal = fcDlg.showOpenDialog(null); + if (returnVal == JFileChooser.APPROVE_OPTION) { + String filepath = fcDlg.getSelectedFile().getPath(); + textField.setText(filepath); + } + } + } +} diff --git a/napi_IntelliJ_plugin/src/com/sk/dialog/ConfirmDiagPane.java b/napi_IntelliJ_plugin/src/com/sk/dialog/ConfirmDiagPane.java index 62cc25feca56d0fd733efc19c436fdce7ca665e2..0711d7f895e43452e327ccdc0c6d58543c9d75d8 100644 --- a/napi_IntelliJ_plugin/src/com/sk/dialog/ConfirmDiagPane.java +++ b/napi_IntelliJ_plugin/src/com/sk/dialog/ConfirmDiagPane.java @@ -23,7 +23,7 @@ import javax.swing.ImageIcon; * ConfirmDiagPane自定义确认对话框 * 解决ShowConfirmDiag 在Deveco里面会出现界面错位问题。 * - * @author: xudong + * @author: zhaoxudong@kaihong.com * @see: generator error dialog * @version: v1.0.0 * @since 2022-02-21 diff --git a/napi_IntelliJ_plugin/src/com/sk/dialog/ErrorDialog.java b/napi_IntelliJ_plugin/src/com/sk/dialog/ErrorDialog.java index 263cc10fd50cde3a547fd85b773c00e93a5fc2d5..517768d6aed51e834351d5d4c11fba8953975f09 100644 --- a/napi_IntelliJ_plugin/src/com/sk/dialog/ErrorDialog.java +++ b/napi_IntelliJ_plugin/src/com/sk/dialog/ErrorDialog.java @@ -30,7 +30,7 @@ import java.io.IOException; /** * ErrorDialog错误对话框 * - * @author: xudong + * @author: zhaoxudong@kaihong.com * @see: generator error dialog * @version: v1.0.0 * @since 2022-02-21 diff --git a/napi_IntelliJ_plugin/src/com/sk/dialog/GenResultDialog.java b/napi_IntelliJ_plugin/src/com/sk/dialog/GenResultDialog.java index bb0b1617ea67edf10d48b86a65acb41e864885be..2f531c753d8d128480388239ad493661e86a0e17 100644 --- a/napi_IntelliJ_plugin/src/com/sk/dialog/GenResultDialog.java +++ b/napi_IntelliJ_plugin/src/com/sk/dialog/GenResultDialog.java @@ -27,7 +27,7 @@ import java.util.List; /** * GenResultDialog结果生成框 * - * @author: xudong + * @author: zhaoxudong@kaihong.com * @see: generate success dialog * @version: v1.0.0 * @since 2022-02-21 diff --git a/napi_IntelliJ_plugin/src/com/sk/dialog/GenerateDialog.java b/napi_IntelliJ_plugin/src/com/sk/dialog/GenerateDialog.java index 0a3cfdd54cde729cae22023eccdd62f3a53ca7ed..2bd25c1ced8b51d6c2f8c23302c56476d528e116 100644 --- a/napi_IntelliJ_plugin/src/com/sk/dialog/GenerateDialog.java +++ b/napi_IntelliJ_plugin/src/com/sk/dialog/GenerateDialog.java @@ -21,8 +21,9 @@ import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.ValidationInfo; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.JComponent; + import javax.swing.Action; +import javax.swing.JComponent; import java.awt.Desktop; import java.awt.event.ActionEvent; import java.io.IOException; @@ -32,7 +33,7 @@ import java.net.URISyntaxException; /** * 主界面对话框Wrapper * - * @author: liulongc digitalchina.com + * @author: zhaoxudong@kaihong.com * @see: tool conversion plug-in * @version: v1.0.0 * @since 2022-05-27 @@ -47,10 +48,10 @@ public class GenerateDialog extends DialogWrapper { /** * 构造函数 * - * @param project projectid - * @param destPath 目录文件 + * @param project projectId + * @param destPath 目录文件 * @param directoryPath 文件夹目录 - * @param fileName 文件名 + * @param fileName 文件名 */ public GenerateDialog(Project project, String destPath, String directoryPath, String fileName) { super(true); @@ -124,8 +125,14 @@ public class GenerateDialog extends DialogWrapper { if (validationInfo != null) { LOG.info(validationInfo.message); } else { - if (genDiag.runFun()) { - close(CANCEL_EXIT_CODE); + if (genDiag.getSelectedIndex() == 0) { + if (genDiag.runFun()) { + close(CANCEL_EXIT_CODE); + } + } else { + if (genDiag.runFunH2ts()) { + close(CANCEL_EXIT_CODE); + } } } } diff --git a/napi_IntelliJ_plugin/src/com/sk/dialog/GenerateDialogPane.form b/napi_IntelliJ_plugin/src/com/sk/dialog/GenerateDialogPane.form index 5ca7577ae1e2f16f8a3dd61c1ad7245cffbdff22..0893f9fabfcd4a3d21215edcb5c48b10da0fd71d 100644 --- a/napi_IntelliJ_plugin/src/com/sk/dialog/GenerateDialogPane.form +++ b/napi_IntelliJ_plugin/src/com/sk/dialog/GenerateDialogPane.form @@ -14,190 +14,282 @@ limitations under the License. -->