Skip to content

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
0xlau committed Jun 15, 2022
2 parents 7811996 + 1c55842 commit a9dd543
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 52 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

## [0.1.1] - 2022-06-15
- 修复 #I5BW1N 关于java代码编辑器中的chain错误跳转问题
- https://gitee.com/liupeiqiang/LiteFlowX/issues/I5BW1N
- 修复 #I5BPP6 修复组件多层继承而无法正确跳转问题
- https://gitee.com/liupeiqiang/LiteFlowX/issues/I5BPP6

## [0.1.0] - 2022-06-09
### 新增
- 特性 #I5B89P Xml文件中支持Ctrl+鼠标左键点击表达式直接跳转到定义
Expand Down
41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ English | [简体中文](./README.zh-CN.md)
<!-- Plugin description -->
<h3>LiteFlowX is designed to increase productivity when you use the <a href="https://github.com/dromara/liteflow">LiteFlow framework</a>.</h3>



LiteFlowX plugin features:
- Svg icons, easily identifiable icons.
- Able to identify Component, Node, Chain, Slot.
- Jump between Component, Node, Chain and XML files.
- Java code and Chain jump to each other.
- Automatic completion prompt of Xml, can prompt Component, Node, Chain.
- Adapt to the declarative version of LiteFlow 2.6.14.
- Provide LiteFLow toolbox, the Component, Node, Chain, Slot of the entire project is clear at a glance, and supports double-click to jump.
- Identify LiteFlow's Component, Slot and Xml files in the project column and display them with specific icons.
## 🍬 LiteFlowX Features:
- Specific file Svg icons for easy identification of LiteFlow elements
- Able to identify Component, Node, Chain, Slot
- Jump between Component, Node, Chain and XML files
- Java code and Chain jump to each other
- Jump between Xml files and LiteFlow elements
- Auto-complete prompt for Xml, able to prompt Component, Node, Chain
- Provides LiteFLow toolbox
- Support file jump to liteflow.ruleSource property
- Both old and new versions of v2.6.x and v2.7.x are compatible
- ...more features to come

<!-- Plugin description end -->
Expand All @@ -62,8 +60,19 @@ For full details of install plugins, <a href="https://www.jetbrains.com/help/ide
> 4. Select the plugin archive file and click **OK**.
> 5. Click **OK** to apply the changes and restart the IDE if prompted.
## 👀 Screenshot
![演示1](https://s1.ax1x.com/2022/05/30/X1EPJg.png)
![演示4](https://s1.ax1x.com/2022/05/30/X1ECFS.gif)
![演示2](https://s1.ax1x.com/2022/05/30/X1ESdf.png)
![演示3](https://s1.ax1x.com/2022/05/30/X1Epo8.png)
## 🌈 Demonstration
### Java to Chain
![Java代码跳转到Chain](https://liteflow.yomahub.com/img/liteflowx/JavaToChain.gif)

### LiteFlowTool
![LiteFlowTool工具箱](https://liteflow.yomahub.com/img/liteflowx/LiteFlowTool.gif)

### Jump to ruleSource
![ruleSource跳转](https://liteflow.yomahub.com/img/liteflowx/ruleSourceJump.gif)

### Xml to Chain
![Xml跳转到Chain](https://liteflow.yomahub.com/img/liteflowx/XmlToChain.gif)

### Xml to Component
![Xml跳转Component](https://liteflow.yomahub.com/img/liteflowx/XmlToComponent.gif)
![Xml跳转Component2](https://liteflow.yomahub.com/img/liteflowx/XmlToManyComponent.gif)
41 changes: 26 additions & 15 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
<!-- Plugin description -->
<h3>LiteFlowX 是一款 IDEA 插件,它能够大幅度提高你在使用<a href="https://gitee.com/dromara/liteFlow"> LiteFlow 框架 </a>进行开发时的工作效率。</h3>

目前 LiteFlowX 的特色:
- Svg 图标,容易识别的图标。
- 能够识别Component、Node、Chain、Slot
- Component、Node、Chain和XML文件的互相跳转
- Java代码和Chain的互相跳转。
- Xml的自动完成提示,能够提示Component、Node、Chain。
- 对LiteFlow 2.6.14版本的声明式组件进行适配。
- 提供LiteFLow工具箱,LiteFlowTool工具箱,整个工程的Component、Node、Chain、Slot一目了然,并且支持双击跳转
- 在工程栏目里对LiteFlow的Component、Slot和Xml文件进行识别,并且用特定的图标显示。
- 支持对liteflow.ruleSource属性的文件跳转
## 🍬 LiteFlowX 特性
- 特定的文件 Svg 图标,容易识别 LiteFlow 元素
- 能够识别Component、Node、Chain、Slot
- Component、Node、Chain和XML文件的互相跳转
- Java 代码和 Chain 的互相跳转
- Xml 文件与 LiteFlow 元素的互相跳转
- Xml 的自动完成提示,能够提示Component、Node、Chain
- 提供LiteFLow工具箱,整个工程的Component、Node、Chain、Slot一目了然,并且支持双击跳转
- 支持对 liteflow.ruleSource 属性的文件跳转
- v2.6.x 与 v2.7.x 的新旧版本双兼容
- ...更多特性敬请期待

<!-- Plugin description end -->
Expand All @@ -60,11 +60,22 @@
> 4. 选择在第一步下载好的插件并点击 **OK**
> 5. 如果提示重启IDE,点击 **OK** 应用更改即可。
## 👀 部分功能截图
![演示1](https://s1.ax1x.com/2022/05/30/X1EPJg.png)
![演示4](https://s1.ax1x.com/2022/05/30/X1ECFS.gif)
![演示2](https://s1.ax1x.com/2022/05/30/X1ESdf.png)
![演示3](https://s1.ax1x.com/2022/05/30/X1Epo8.png)
## 🌈 功能演示
### Java代码跳转到Chain
![Java代码跳转到Chain](https://liteflow.yomahub.com/img/liteflowx/JavaToChain.gif)

### LiteFlowTool工具箱
![LiteFlowTool工具箱](https://liteflow.yomahub.com/img/liteflowx/LiteFlowTool.gif)

### ruleSource跳转
![ruleSource跳转](https://liteflow.yomahub.com/img/liteflowx/ruleSourceJump.gif)

### Xml跳转到Chain
![Xml跳转到Chain](https://liteflow.yomahub.com/img/liteflowx/XmlToChain.gif)

### Xml跳转Component
![Xml跳转Component](https://liteflow.yomahub.com/img/liteflowx/XmlToComponent.gif)
![Xml跳转Component2](https://liteflow.yomahub.com/img/liteflowx/XmlToManyComponent.gif)



Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pluginGroup = top.xystudio.plugin.idea
pluginName = LiteFlowX
# SemVer format -> https://semver.org
pluginVersion = 0.1.0
pluginVersion = 0.1.1

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public class Clazz {

public static final String FlowExecutor = "com.yomahub.liteflow.core.FlowExecutor";

public static final String JavaObject = "java.lang.Object";

}
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
package top.xystudio.plugin.idea.liteflowx.service;

import com.intellij.find.findUsages.PsiElement2UsageTargetAdapter;
import com.intellij.find.usages.api.UsageSearcher;
import com.intellij.ide.lightEdit.LightEditService;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.JavadocManager;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.PsiSearchHelper;
import com.intellij.psi.search.UsageSearchContext;
import com.intellij.usages.UsageSearchPresentation;
import com.intellij.util.xml.DomFileElement;
import com.intellij.util.xml.DomService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.javac.ast.api.JavacRef;
import top.xystudio.plugin.idea.liteflowx.constant.Annotation;
import top.xystudio.plugin.idea.liteflowx.constant.Clazz;
import top.xystudio.plugin.idea.liteflowx.constant.Interface;
Expand All @@ -26,9 +18,7 @@
import top.xystudio.plugin.idea.liteflowx.util.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;

public class LiteFlowService implements Serializable {
Expand Down Expand Up @@ -158,8 +148,12 @@ public String getLiteFlowComponentNameByPsiClass(@NotNull PsiClass psiClass){
* @return
*/
public boolean isLiteFlowClass(@NotNull PsiClass psiClass){
String qualifiedName = psiClass.getSuperClass().getQualifiedName();
if (qualifiedName.equals(Clazz.NodeComponent) || qualifiedName.equals(Clazz.NodeCondComponent)){
if (psiClass.getText().contains("abstract class")){
return false;
}
PsiClass nodeComponent = JavaService.getInstance(project).getClassByQualifiedName(Clazz.NodeComponent);
PsiClass nodeCondComponent = JavaService.getInstance(project).getClassByQualifiedName(Clazz.NodeCondComponent);
if (psiClass.isInheritor(nodeComponent, true) || psiClass.isInheritor(nodeCondComponent, true)){
return true;
}
PsiAnnotation liteflowCmpDefine = psiClass.getAnnotation(Annotation.LiteflowCmpDefine);
Expand All @@ -175,7 +169,7 @@ public boolean isLiteFlowClass(@NotNull PsiClass psiClass){
*/
public boolean isLiteFlowSlot(@NotNull PsiClass psiClass){
while (psiClass.getSuperClassType() != null &&
!psiClass.getSuperClassType().equals(PsiClassType.getJavaLangObject(PsiManager.getInstance(this.project), GlobalSearchScope.allScope(this.project)))){
!psiClass.getSuperClassType().equals(Clazz.JavaObject)){
psiClass = psiClass.getSuperClass();
}
PsiClassType[] implementsListTypes = psiClass.getImplementsListTypes();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package top.xystudio.plugin.idea.liteflowx.system.search;

import com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler;
import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiJavaToken;
import org.jetbrains.annotations.Nls;
Expand All @@ -23,7 +19,7 @@ public class JavaToChainGotoDeclarationHandler implements GotoDeclarationHandler
@Override
public PsiElement @Nullable [] getGotoDeclarationTargets(@Nullable PsiElement sourceElement, int offset, Editor editor) {
Project project = sourceElement.getProject();
if (!(sourceElement instanceof PsiJavaToken)){
if (!isTargetElement(sourceElement)){
return null;
}
String name = sourceElement.getText().replace("\"", "");
Expand All @@ -34,6 +30,16 @@ public class JavaToChainGotoDeclarationHandler implements GotoDeclarationHandler
return new PsiElement[]{result.get()};
}

private boolean isTargetElement(PsiElement psiElement){
if (!(psiElement instanceof PsiJavaToken)){
return false;
}
if (((PsiJavaToken) psiElement).getTokenType() != JavaTokenType.STRING_LITERAL){
return false;
}
return true;
}

@Override
public @Nullable @Nls(capitalization = Nls.Capitalization.Title) String getActionText(@NotNull DataContext context) {
return GotoDeclarationHandler.super.getActionText(context);
Expand Down

0 comments on commit a9dd543

Please sign in to comment.