Skip to content

Commit 81162f4

Browse files
authored
release 3.3.2
release 3.3.2
2 parents 0e09fc7 + c7e72f7 commit 81162f4

26 files changed

Lines changed: 390 additions & 287 deletions

build.gradle.kts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
plugins {
2-
id("org.jetbrains.kotlin.jvm") version "1.8.0"
2+
id("org.jetbrains.kotlin.jvm") version "1.8.21"
33
id("org.jetbrains.intellij") version "1.13.3"
44
}
55
group = "shop.itbug"
6-
version = "3.3.1"
6+
version = "3.3.2"
77
repositories {
88
mavenCentral()
99
google()
@@ -28,6 +28,14 @@ intellij {
2828
)
2929
}
3030

31+
kotlin {
32+
sourceSets.all {
33+
languageSettings {
34+
languageVersion = "2.0"
35+
}
36+
}
37+
}
38+
3139
///
3240
dependencies {
3341
implementation("com.squareup.retrofit2:retrofit:2.9.0") {
@@ -111,16 +119,24 @@ tasks {
111119

112120
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
113121
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
122+
compilerOptions.languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
114123
}
115124

116125
listProductsReleases {
117126
}
118127

119128
patchPluginXml {
120-
sinceBuild.set("231.0000.*")
121-
untilBuild.set("231.9999.*")
129+
sinceBuild.set("231")
130+
untilBuild.set("231.*")
122131
changeNotes.set(
123132
"""
133+
<div>
134+
<h1>3.3.2</h1>
135+
<ul>
136+
<li>Optimize the Dio request window tool</li>
137+
</ul>
138+
</div>
139+
124140
<div>
125141
<h1>3.3.1</h1>
126142
<ul>
@@ -303,15 +319,6 @@ tasks {
303319
}
304320

305321
configurations.all {
306-
// exclude(group = "org.jetbrains.kotlinx",module = "kotlinx-coroutines-core")
307-
// exclude(group = "org.jetbrains.kotlinx",module = "kotlinx-coroutines-core-jvm")
308-
// exclude(group = "org.jetbrains.kotlinx",module = "kotlinx-coroutines-jdk8")
309-
// exclude(group = "org.jetbrains.kotlinx",module = "kotlinx-coroutines-slf4j")
310-
// exclude(group = "org.jetbrains.kotlin",module = "kotlin-stdlib")
311-
// exclude(group = "org.jetbrains.kotlin",module = "kotlin-stdlib-common")
312-
// exclude(group = "org.jetbrains.kotlin",module = "kotlin-stdlib-jdk7")
313-
// exclude(group = "org.jetbrains.kotlin",module = "kotlin-stdlib-jdk8")
314-
// exclude(group = "org.slf4j",module = "slf4j-api")
315322
exclude(group = "io.ktor", module = "kotlinx-coroutines-jdk8")
316323
exclude(group = "io.ktor", module = "kotlinx-coroutines-core")
317324
exclude(group = "com.aallam.openai", module = "kotlinx-coroutines-jdk8")
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package shop.itbug.fluttercheckversionx.actions
2+
3+
import com.alibaba.fastjson2.JSON
4+
import com.alibaba.fastjson2.JSONWriter
5+
import com.intellij.openapi.actionSystem.AnActionEvent
6+
import shop.itbug.fluttercheckversionx.common.MyAction
7+
import shop.itbug.fluttercheckversionx.document.copyTextToClipboard
8+
9+
class ApiCopyAll:MyAction({"Copy All"}) {
10+
override fun actionPerformed(e: AnActionEvent) {
11+
val api = e.api()!!
12+
val dataMap = mapOf(
13+
"url" to api.url,
14+
"method" to api.method,
15+
"headers" to api.headers,
16+
"queryParams" to api.queryParams,
17+
"bodyJsonObject" to api.body,
18+
"statusCode" to api.statusCode,
19+
"body" to api.body,
20+
"requestTime" to api.createDate,
21+
"timestamp" to api.timestamp
22+
)
23+
val toJSONString = JSON.toJSONString(dataMap, JSONWriter.Feature.PrettyFormat)
24+
toJSONString.copyTextToClipboard()
25+
}
26+
27+
28+
override fun update(e: AnActionEvent) {
29+
e.presentation.isEnabled = e.api()!=null
30+
super.update(e)
31+
}
32+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package shop.itbug.fluttercheckversionx.actions
2+
3+
import cn.hutool.core.util.URLUtil
4+
import com.intellij.openapi.actionSystem.AnActionEvent
5+
import shop.itbug.fluttercheckversionx.common.MyAction
6+
import shop.itbug.fluttercheckversionx.document.copyTextToClipboard
7+
import shop.itbug.fluttercheckversionx.util.toast
8+
9+
10+
///复制路径
11+
class ApiCopyPathAction: MyAction({"Copy Path"}) {
12+
override fun actionPerformed(e: AnActionEvent) {
13+
val url = e.api()!!.url
14+
val path = URLUtil.getPath(url)
15+
16+
path.copyTextToClipboard().apply {
17+
e.apiListProject()?.toast("Copy succeeded!")
18+
}
19+
}
20+
21+
override fun update(e: AnActionEvent) {
22+
e.presentation.isEnabled = e.api()!=null
23+
super.update(e)
24+
}
25+
26+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package shop.itbug.fluttercheckversionx.actions
2+
3+
import com.intellij.openapi.actionSystem.AnActionEvent
4+
import com.intellij.openapi.actionSystem.CommonDataKeys
5+
import com.intellij.openapi.command.WriteCommandAction
6+
import com.intellij.openapi.editor.Document
7+
import com.intellij.psi.PsiDocumentManager
8+
import com.intellij.psi.PsiElement
9+
import com.intellij.ui.dsl.builder.bindText
10+
import com.intellij.ui.dsl.builder.panel
11+
import shop.itbug.fluttercheckversionx.common.MyAction
12+
import shop.itbug.fluttercheckversionx.dialog.createDialogAndShow
13+
import shop.itbug.fluttercheckversionx.dialog.showCodePreviewDialog
14+
import shop.itbug.fluttercheckversionx.util.MyDartPsiElementUtil
15+
import shop.itbug.fluttercheckversionx.util.reformat
16+
17+
18+
///在编辑器当前光标下插入一个新的psi element
19+
fun AnActionEvent.insetNewPsiElementWithCurrentOffset(newPsiElement: PsiElement) {
20+
val editor = this.getData(CommonDataKeys.EDITOR)!!
21+
val document: Document = editor.document
22+
val offset = editor.caretModel.offset
23+
val element = PsiDocumentManager.getInstance(project!!).getPsiFile(document)!!
24+
.findElementAt(offset)?.prevSibling
25+
element?.apply {
26+
WriteCommandAction.runWriteCommandAction(project) {
27+
this.addAfter(newPsiElement, this.nextSibling)
28+
project.reformat(getData(CommonDataKeys.PSI_ELEMENT)!!)
29+
}
30+
}
31+
}
32+
33+
34+
///创建单例类
35+
class GenerateClassSingletonModel : MyAction() {
36+
37+
override fun actionPerformed(e: AnActionEvent) {
38+
var className = ""
39+
val result = e.project?.createDialogAndShow("Create a singleton object") {
40+
return@createDialogAndShow panel {
41+
row("Class name") {
42+
textField().bindText({ className }, { className = it })
43+
}
44+
}
45+
}
46+
if (result == true) {
47+
val classObject = MyDartPsiElementUtil.genClassConstructor(e.project!!, className)!!
48+
e.project?.showCodePreviewDialog(classObject.firstChild.text)
49+
}
50+
51+
}
52+
53+
}

src/main/kotlin/shop/itbug/fluttercheckversionx/activity/FlutterProjectOpenActivity.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.intellij.openapi.vfs.VirtualFileManager
99
import com.intellij.openapi.vfs.newvfs.BulkFileListener
1010
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
1111
import shop.itbug.fluttercheckversionx.config.GenerateAssetsClassConfig
12+
import shop.itbug.fluttercheckversionx.util.CacheUtil
1213
import shop.itbug.fluttercheckversionx.util.MyDartPsiElementUtil
1314

1415
/**
@@ -59,6 +60,15 @@ class FlutterProjectOpenActivity : ProjectActivity, Disposable {
5960
super.after(events)
6061
}
6162
})
63+
64+
cleanPubPluginsCache()
65+
}
66+
67+
68+
69+
///清理插件的数据缓存
70+
private fun cleanPubPluginsCache() {
71+
CacheUtil.clean()
6272
}
6373

6474
}

src/main/kotlin/shop/itbug/fluttercheckversionx/common/AnyExtend.kt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,35 @@ import com.alibaba.fastjson2.JSONWriter
77
import com.intellij.openapi.project.Project
88
import com.intellij.openapi.vfs.LocalFileSystem
99
import com.intellij.openapi.vfs.VirtualFile
10+
import com.intellij.ui.components.JBScrollPane
1011
import shop.itbug.fluttercheckversionx.dialog.FreezedClassesGenerateDialog
1112
import shop.itbug.fluttercheckversionx.services.impl.ModelToFreezedModelServiceImpl
1213
import shop.itbug.fluttercheckversionx.util.toastWithError
14+
import javax.swing.JComponent
1315

14-
fun Any.toJsonFormart() : String {
15-
return JSONObject.toJSONString(this,JSONWriter.Feature.PrettyFormat)
16+
fun Any.toJsonFormart(): String {
17+
return JSONObject.toJSONString(this, JSONWriter.Feature.PrettyFormat)
1618
}
1719

18-
fun String.getVirtualFile() : VirtualFile? {
19-
return LocalFileSystem.getInstance().findFileByPath(this)
20+
/**
21+
* 设置为滚动面板
22+
*/
23+
fun JComponent.scroll(): JComponent {
24+
return JBScrollPane(this)
25+
}
26+
27+
fun String.getVirtualFile(): VirtualFile? {
28+
return LocalFileSystem.getInstance().findFileByPath(this)
2029
}
2130

2231
fun Project.jsonToFreezedRun(jsonText: String) {
2332
try {
2433

2534
val jsonObject = JSON.parseObject(jsonText, JSONReader.Feature.SupportArrayToBean)
26-
val jsonObjectToFreezedCovertModelList = ModelToFreezedModelServiceImpl().jsonObjectToFreezedCovertModelList(jsonObject)
27-
FreezedClassesGenerateDialog(this,jsonObjectToFreezedCovertModelList).show()
28-
}catch (e: Exception) {
35+
val jsonObjectToFreezedCovertModelList =
36+
ModelToFreezedModelServiceImpl().jsonObjectToFreezedCovertModelList(jsonObject)
37+
FreezedClassesGenerateDialog(this, jsonObjectToFreezedCovertModelList).show()
38+
} catch (e: Exception) {
2939
println("json to freezed error:$e")
3040
toastWithError("$e")
3141
e.printStackTrace()

src/main/kotlin/shop/itbug/fluttercheckversionx/common/MyAction.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package shop.itbug.fluttercheckversionx.common
22

3-
import com.intellij.openapi.actionSystem.ActionUpdateThread
4-
import com.intellij.openapi.actionSystem.AnAction
5-
import com.intellij.openapi.actionSystem.ToggleAction
3+
import com.intellij.openapi.actionSystem.*
64
import com.intellij.openapi.actionSystem.ex.ComboBoxAction
75
import com.intellij.openapi.project.DumbAwareAction
6+
import shop.itbug.fluttercheckversionx.services.ItbugService
7+
import shop.itbug.fluttercheckversionx.services.SERVICE
88
import java.util.function.Supplier
99
import javax.swing.Icon
10+
import javax.swing.JComponent
1011

1112
abstract class MyAction : AnAction {
1213

@@ -51,4 +52,5 @@ abstract class MyComboBoxAction : ComboBoxAction() {
5152
override fun getActionUpdateThread(): ActionUpdateThread {
5253
return ActionUpdateThread.BGT
5354
}
55+
5456
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package shop.itbug.fluttercheckversionx.dialog
2+
3+
import com.intellij.openapi.fileTypes.PlainTextLanguage
4+
import com.intellij.openapi.project.Project
5+
import com.intellij.ui.LanguageTextField
6+
import com.intellij.ui.dsl.builder.Align
7+
import com.intellij.ui.dsl.builder.panel
8+
import shop.itbug.fluttercheckversionx.common.MyDialogWrapper
9+
import shop.itbug.fluttercheckversionx.document.copyTextToClipboard
10+
import javax.swing.JComponent
11+
12+
13+
fun Project.showCodePreviewDialog(code: String) {
14+
CodeCopyDialog(this,code).show()
15+
}
16+
17+
class CodeCopyDialog(override val project: Project, val code: String) : MyDialogWrapper(project) {
18+
19+
val editor = LanguageTextField(
20+
PlainTextLanguage.INSTANCE,
21+
project,
22+
code,
23+
false
24+
25+
)
26+
27+
init {
28+
super.init()
29+
title = "Copy code dialog"
30+
super.setOKButtonText("Copy Code")
31+
}
32+
33+
override fun createCenterPanel(): JComponent {
34+
return panel {
35+
row {
36+
scrollCell(editor).align(Align.FILL)
37+
}
38+
}
39+
}
40+
41+
42+
override fun doOKAction() {
43+
editor.text.copyTextToClipboard()
44+
super.doOKAction()
45+
}
46+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package shop.itbug.fluttercheckversionx.dialog
2+
3+
import com.intellij.openapi.project.Project
4+
import shop.itbug.fluttercheckversionx.common.MyDialogWrapper
5+
import javax.swing.JComponent
6+
7+
///创建一个dialog并显示
8+
fun Project.createDialogAndShow(title: String, ui: () -> JComponent) : Boolean {
9+
return createDialog(project = this, title = title, ui)
10+
}
11+
12+
fun createDialog(project: Project, title: String, ui: () -> JComponent) : Boolean {
13+
val dialog = object : MyDialogWrapper(project) {
14+
init {
15+
super.init()
16+
this.title = title
17+
}
18+
19+
override fun createCenterPanel(): JComponent {
20+
return ui()
21+
}
22+
23+
24+
}
25+
return dialog.showAndGet()
26+
}

src/main/kotlin/shop/itbug/fluttercheckversionx/fix/NewVersionFix.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import shop.itbug.fluttercheckversionx.util.CacheUtil
1717
class NewVersionFix(
1818
psiElement: PsiElement,
1919
private val newVersion: String,
20-
private val model: PubVersionDataModel
20+
private val pubVersionDataModel: PubVersionDataModel,
21+
val invokeCallback: () -> Unit
2122
) : LocalQuickFixOnPsiElement(psiElement) {
2223

2324
override fun getFamilyName(): String {
@@ -32,7 +33,8 @@ class NewVersionFix(
3233
val pluginName = (startElement as YAMLKeyValueImpl).keyText
3334
val newElement = YAMLElementGenerator.getInstance(project).createYamlKeyValue(pluginName, newVersion)
3435
startElement.replace(newElement)
35-
CacheUtil.remove(model.name)
36+
CacheUtil.remove(pubVersionDataModel.name)
37+
invokeCallback()
3638
}
3739

3840
}

0 commit comments

Comments
 (0)