From 5d66c57ca09784f39d90f125a40b3898cd844cb3 Mon Sep 17 00:00:00 2001 From: duanledexianxianxian Date: Wed, 16 Oct 2019 09:45:51 +0800 Subject: [PATCH] sync --- .../plugin/idea/action/MainAction.java | 33 +++++++++++++++++++ .../plugin/idea/ui/MybatisConfigForum.form | 31 +++++++++++++++++ .../plugin/idea/ui/MybatisConfigForum.java | 12 +++++++ 3 files changed, 76 insertions(+) create mode 100644 plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/action/MainAction.java create mode 100644 plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/ui/MybatisConfigForum.form create mode 100644 plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/ui/MybatisConfigForum.java diff --git a/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/action/MainAction.java b/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/action/MainAction.java new file mode 100644 index 0000000..dda8f67 --- /dev/null +++ b/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/action/MainAction.java @@ -0,0 +1,33 @@ +package com.duanledexianxianxian.plugin.idea.action; + +import com.intellij.database.psi.DbTable; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.LangDataKeys; +import com.intellij.openapi.ui.Messages; +import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; + +/** + * 点击打开插件配置页面 + * + * @author duanledexianxianxian + * @date 2019/10/16 0:28 + * @since 1.0.0 + */ +public class MainAction extends AnAction { + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + PsiElement[] psiElements = e.getData(LangDataKeys.PSI_ELEMENT_ARRAY); + if (psiElements == null || psiElements.length == 0) { + Messages.showMessageDialog("Please select one or more tables", "Notice", Messages.getInformationIcon()); + return; + } + for (PsiElement psiElement : psiElements) { + if (!(psiElement instanceof DbTable)) { + Messages.showMessageDialog("Please select one or more tables", "Notice", Messages.getInformationIcon()); + return; + } + } + } +} diff --git a/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/ui/MybatisConfigForum.form b/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/ui/MybatisConfigForum.form new file mode 100644 index 0000000..671b35f --- /dev/null +++ b/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/ui/MybatisConfigForum.form @@ -0,0 +1,31 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/ui/MybatisConfigForum.java b/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/ui/MybatisConfigForum.java new file mode 100644 index 0000000..85ceb23 --- /dev/null +++ b/plugin-gradle/src/main/java/com/duanledexianxianxian/plugin/idea/ui/MybatisConfigForum.java @@ -0,0 +1,12 @@ +package com.duanledexianxianxian.plugin.idea.ui; + +import javax.swing.*; + +/** + * @author duanledexianxianxian + * @date 2019/10/16 1:05 + * @since 1.0.0 + */ +public class MybatisConfigForum { + private JTextField textField1; +} -- GitLab