Skip to content

Commit

Permalink
Release 1.3.1
Browse files Browse the repository at this point in the history
修复旧版本兼容问题
修复可能的NPE问题
  • Loading branch information
0xlau committed Apr 19, 2024
1 parent 6174d29 commit 7a15971
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

## [1.3.1] - 2024-04-19
- 修复 旧版本兼容性问题
- 修复 可能的 NPE 问题

## [1.3.0] - 2024-04-15
- 新增 新增决策表特性的支持
- 新增 类级别和方法级别声明式的统一
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Expand Up @@ -9,7 +9,7 @@ plugins {
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.6.10"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij") version "1.12.0"
id("org.jetbrains.intellij") version "1.13.3"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "1.3.1"
}
Expand Down
14 changes: 9 additions & 5 deletions gradle.properties
Expand Up @@ -4,23 +4,27 @@
pluginGroup = top.xystudio.plugin.idea
pluginName = LiteFlowX
# SemVer format -> https://semver.org
pluginVersion = 1.3.0
pluginVersion = 1.3.1

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild = 203
pluginSinceBuild = 211
pluginUntilBuild = 241.*

# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
platformType = IU
platformVersion = 2024.1
platformVersion = 2021.1

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = com.intellij.java, com.intellij.properties, org.jetbrains.plugins.yaml, org.intellij.intelliLang, JavaScript

# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
javaVersion = 17
# Java language level used to compile sources and to generate the files for -
# Java 11 is required since 2020.3
# Java 17 is required since 2022.2
# Java 21 is required since 2024.2
# https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#platformVersions
javaVersion = 11

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 7.4
Expand Down
Expand Up @@ -173,7 +173,7 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass, boo
String componentValue = javaService.getAnnotationAttributeValue(psiClass, Annotation.Component, "value");
if (componentValue != null){
/* 如果获取的value值为空,则默认使用字符串首字母小写的Class名称 */
if (componentValue.equals("")){
if (componentValue.isEmpty()){
componentValue = StringUtils.lowerFirst(className);
}
return componentValue;
Expand All @@ -187,7 +187,7 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass, boo
String name = StringUtil.isEmpty(liteFlowComponentValue)? liteFlowComponentId : liteFlowComponentValue;
if (name != null){
/* 如果获取的value或者id值为空,则默认使用字符串首字母小写的Class名称 */
if (name.equals("")){
if (name.isEmpty()){
name = StringUtils.lowerFirst(className);
}
return name;
Expand All @@ -200,10 +200,11 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass, boo
for (Node node : nodes.getNodeList()) {
String clazzValue = node.getClazz().getStringValue();
String idValue = node.getId().getStringValue();
if (psiClass.getQualifiedName()==null || clazzValue == null || idValue==null) {
String psiClassQualifiedName = psiClass.getQualifiedName();
if (psiClassQualifiedName == null || clazzValue == null || idValue == null) {
continue;
}
if (psiClass.getQualifiedName().equals(clazzValue)){
if (psiClassQualifiedName.equals(clazzValue)){
return idValue;
}
}
Expand All @@ -213,8 +214,12 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass, boo
}

private boolean _isLiteFlow(PsiElement psiElement, String clazz, String nodeTypeEnum){
if (psiElement instanceof PsiClass psiClass){
if (psiElement instanceof PsiClass){
PsiClass psiClass = (PsiClass) psiElement;
// 判断是否类组件
if (psiClass.getQualifiedName() == null){
return false;
}
// 排除所有包名以 com.yomahub.liteflow.core. 开头的Class
if (psiClass.getQualifiedName().indexOf("com.yomahub.liteflow.core.") == 0){
return false;
Expand All @@ -232,8 +237,12 @@ private boolean _isLiteFlow(PsiElement psiElement, String clazz, String nodeType
return false;
}
return nodeTypeEnum.equals(nodeType.split("\\(")[0]);
} else if (psiElement instanceof PsiMethod psiMethod) {
} else if (psiElement instanceof PsiMethod) {
PsiMethod psiMethod = (PsiMethod) psiElement;
// 判断是否方法声明组件
if (psiMethod.getContainingClass() == null || psiMethod.getContainingClass().getQualifiedName() == null){
return false;
}
// 排除所有包名以 com.yomahub.liteflow.core. 开头的Class
if (psiMethod.getContainingClass().getQualifiedName().indexOf("com.yomahub.liteflow.core.") == 0){
return false;
Expand Down
Expand Up @@ -34,10 +34,12 @@ private Icon getLiteFlowFileIcon(PsiElement element) {
if (!language.isKindOf(JavaLanguage.INSTANCE)){
return null;
}
if (!(element instanceof PsiClass psiClass)){
if (!(element instanceof PsiClass)){
return null;
}

PsiClass psiClass = (PsiClass) element;

Icon icon = getIcon(psiClass);
if (icon != null){
return icon;
Expand Down

0 comments on commit 7a15971

Please sign in to comment.