Skip to content

Commit 995d547

Browse files
3.2.2 release
1 parent 66459ae commit 995d547

File tree

4 files changed

+33
-31
lines changed

4 files changed

+33
-31
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ What I do is generate dart beans based on json, as well as generics parameters a
1818
* If you need generic conversions in your network requests, use the jsonconvert.fromjsonast method directly.
1919
* If you don't want to use the FlutterJsonBeanFactory in your project, you can add flutter-json: enable: false to the pubspec.yaml file
2020
![image](https://github.com/zhangruiyu/FlutterJsonBeanFactory/blob/master/filter_json_config.png)
21-
* [中文移步](https://www.jianshu.com/p/14cbcbaa74b7)
21+
*如果你有任何问题,添加QQGroup(963752388)随时提问 [中文移步](https://www.jianshu.com/p/14cbcbaa74b7)
2222

2323
### Others
2424
* Welcome anyone to raise new issue.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
kotlin_version=1.3.61
2-
pluginVersion=3.2.1
2+
pluginVersion=3.2.2
33
#每次修改这里去打包
44
ideaVersionPrefix=193
55
ideaVersion=

src/main/java/com/ruiyu/workers/Initializer.kt

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
package com.ruiyu.workers
22

3-
import com.intellij.json.psi.JsonElementGenerator
4-
import com.intellij.json.psi.JsonFile
5-
import com.intellij.json.psi.JsonProperty
6-
import com.intellij.openapi.application.ApplicationManager
7-
import com.intellij.openapi.application.runWriteAction
8-
import com.intellij.openapi.command.undo.UndoManager
9-
import com.intellij.openapi.editor.event.DocumentEvent
3+
//import com.jetbrains.lang.dart.psi.*
4+
//import com.jetbrains.lang.dart.util.DartElementGenerator
5+
106
import com.intellij.openapi.editor.event.DocumentListener
117
import com.intellij.openapi.project.Project
128
import com.intellij.openapi.startup.StartupActivity
9+
import com.intellij.openapi.vfs.VirtualFileManager
10+
import com.intellij.openapi.vfs.newvfs.BulkFileListener
11+
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
1312
import com.intellij.psi.PsiDocumentManager
1413
import com.intellij.psi.PsiElement
15-
import com.intellij.psi.PsiErrorElement
16-
import com.intellij.psi.PsiManager
17-
import com.intellij.psi.search.FilenameIndex
18-
import com.intellij.psi.search.GlobalSearchScope
19-
import com.intellij.psi.util.PsiTreeUtil
14+
import com.intellij.util.messages.MessageBusConnection
2015
import com.ruiyu.Log
21-
//import com.jetbrains.lang.dart.psi.*
22-
//import com.jetbrains.lang.dart.util.DartElementGenerator
16+
import com.ruiyu.beanfactory.FlutterBeanFactoryAction
2317
import com.ruiyu.file.FileHelpers
24-
import io.flutter.pub.PubRoot
25-
import java.util.*
18+
import org.jetbrains.annotations.NotNull
2619
import java.util.regex.Pattern
27-
import kotlin.concurrent.scheduleAtFixedRate
20+
2821

2922
/**
3023
* User: zhangruiyu
@@ -36,6 +29,25 @@ class Initializer : StartupActivity, DocumentListener {
3629

3730
override fun runActivity(project: Project) {
3831
documentManager = PsiDocumentManager.getInstance(project)
32+
val connection: MessageBusConnection = project.messageBus.connect()
33+
34+
connection.subscribe(VirtualFileManager.VFS_CHANGES, object : BulkFileListener {
35+
override fun after(@NotNull events: List<VFileEvent>) {
36+
if (FileHelpers.shouldActivateFor(project)) {
37+
//如果改动文件包括了自动生成的entity.dart
38+
if (events.firstOrNull {
39+
it.path.endsWith("_entity.dart")
40+
} != null) {
41+
//那么此刻就去自动刷新
42+
FlutterBeanFactoryAction.generateAllFile(project)
43+
}
44+
/*for (event in events) {
45+
println("event = $event")
46+
}*/
47+
}
48+
49+
}
50+
})
3951
/*
4052
Timer().scheduleAtFixedRate(0, 1000) {
4153
if (FileHelpers.shouldActivateFor(project)) {

src/main/resources/META-INF/plugin.xml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>com.ruiyu.ruiyu</id>
33
<name>FlutterJsonBeanFactory</name>
4-
<vendor email="157418979@qq.com" url="https://github.com/zhangruiyu/FlutterJsonBeanFactory">ruiyu</vendor>
4+
<vendor email="157418979@qq.com" url="https://github.com/zhangruiyu/FlutterJsonBeanFactory">ruiyu-QQGroup(963752388)</vendor>
55

66
<description><![CDATA[
77
<br>Json to dart beans are provided, and dart files ending in entity are provided to generate dart bean factory for use.</br>
@@ -10,24 +10,14 @@
1010
<br>If you need generic conversions in your network requests, use the jsonconvert.fromjsonast method directly.</br>
1111
]]></description>
1212
<change-notes><![CDATA[
13+
<br>if you change the fields, the helper and JsonConvert are automatically regenerated</br>
1314
<br>support such as @JSONField(name:"end_time",format: "yyyy/MM/dd hh:mm:ss",deserialize: true,serialize: false)</br>
1415
<br>add format support for datetime</br>
1516
<br>if you don't want to use the FlutterJsonBeanFactory in your project, you can close the plugin by adding flutter-json: enable: false to the pubspec.yaml file</br>
1617
<br>shortcut key is changed to Alt + j</br>
1718
<br>if the first jsonobject in the jsonarray is not perfect, the data will not be complete</br>
1819
<br>rebuild will delete redundant files</br>
1920
<br>version 3.1 has been released,Provide JsonConvert.dart,EntityFactory is deprecated</br>
20-
<br>fixed error occurred when try casting null to List<String></br>
21-
<br>fixed new file bug</br>
22-
<br>fixed an empty collection bug</br>
23-
<br>fixed field naming bug</br>
24-
<br>change null to dynamic to prevent exception resolution</br>
25-
<br>fixed field forEach method when not converted to list</br>
26-
<br>fixed the bug of plural to singular</br>
27-
<br>fixed import bug under Windows</br>
28-
<br>fixed the dart keyword prob <br>support for custom model suffix names</br>
29-
<br>support android studio</br>
30-
<br>Json to dart beans are provided</br>
3121
]]>
3222
</change-notes>
3323
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html

0 commit comments

Comments
 (0)