diff --git a/build.gradle b/build.gradle index a09e842..34820f0 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { group 'cn.bugstack.idea.plugin' -version '2.4.9' +version '2.5.0' apply plugin: 'java' apply plugin: 'idea' diff --git a/src/main/java/cn/bugstack/guide/idea/plugin/action/Vo2DtoGenerateAction.java b/src/main/java/cn/bugstack/guide/idea/plugin/action/Vo2DtoGenerateAction.java index ccede05..5a7f41c 100644 --- a/src/main/java/cn/bugstack/guide/idea/plugin/action/Vo2DtoGenerateAction.java +++ b/src/main/java/cn/bugstack/guide/idea/plugin/action/Vo2DtoGenerateAction.java @@ -18,7 +18,7 @@ public void actionPerformed(@NotNull AnActionEvent event) { // 织入代码 generateVo2Dto.doGenerate(event.getProject(), event.getDataContext(), event.getData(LangDataKeys.PSI_FILE)); } catch (Exception e) { - Messages.showErrorDialog(event.getProject(), "请按规:先复制对象后,例如:A a,再光标放到需要织入的对象上,例如:B b!", "错误提示"); + Messages.showErrorDialog(event.getProject(), "请按规:先复制对象后,例如:A a,再光标放到需要织入的对象上,例如:B b!联系作者:小傅哥 微信:fustack", "错误提示"); } } diff --git a/src/main/java/cn/bugstack/guide/idea/plugin/domain/service/AbstractGenerateVo2Dto.java b/src/main/java/cn/bugstack/guide/idea/plugin/domain/service/AbstractGenerateVo2Dto.java index 656a333..449868a 100644 --- a/src/main/java/cn/bugstack/guide/idea/plugin/domain/service/AbstractGenerateVo2Dto.java +++ b/src/main/java/cn/bugstack/guide/idea/plugin/domain/service/AbstractGenerateVo2Dto.java @@ -8,6 +8,7 @@ import cn.bugstack.guide.idea.plugin.infrastructure.DataSetting; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.Messages; import com.intellij.psi.*; import java.util.ArrayList; @@ -80,7 +81,9 @@ protected MethodVO getMethods(PsiClass psiClass, String regex, String typeStr) { Pattern p = Pattern.compile("static.*?final|final.*?static"); PsiField[] fields = psiClass.getFields(); for (PsiField psiField : fields) { - String fieldVal = Objects.requireNonNull(psiField.getNameIdentifier().getContext()).getText(); + PsiElement context = psiField.getNameIdentifier().getContext(); + if (null == context) continue; + String fieldVal = context.getText(); // serialVersionUID 判断 if (fieldVal.contains("serialVersionUID")) { continue; @@ -102,6 +105,8 @@ protected MethodVO getMethods(PsiClass psiClass, String regex, String typeStr) { } } + Messages.showErrorDialog(""+fieldNameList.size(),""); + return new MethodVO(fieldNameList, methodNameList); } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index db6d023..d9e2742 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -84,6 +84,10 @@ +

V2.5.0

+ ]]>