Skip to content

Commit

Permalink
Merge pull request #25 from mdddj/3.3.2.as
Browse files Browse the repository at this point in the history
3.3.2.as
  • Loading branch information
mdddj authored May 29, 2023
2 parents 81162f4 + 381edfd commit e8ced49
Show file tree
Hide file tree
Showing 39 changed files with 697 additions and 507 deletions.
5 changes: 5 additions & 0 deletions .fleet/run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"configurations": [

]
}
3 changes: 3 additions & 0 deletions .fleet/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"backend.maxHeapSizeMb": 1500
}
30 changes: 20 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id("org.jetbrains.intellij") version "1.13.3"
}
group = "shop.itbug"
version = "3.3.2"
version = "3.3.3.as"
repositories {
mavenCentral()
google()
Expand All @@ -14,16 +14,17 @@ repositories {
}



intellij {
version.set("2023.1")
type.set("IC")
version.set("2022.2.1.18")
type.set("AI")
plugins.set(
listOf(
"yaml",
"Dart:231.8109.91",
"io.flutter:73.0.4",
"markdown",
"terminal"
"Dart:222.4582",
"io.flutter:73.0.2",
"org.intellij.plugins.markdown",
"terminal", "java"
)
)
}
Expand Down Expand Up @@ -126,14 +127,23 @@ tasks {
}

patchPluginXml {
sinceBuild.set("231")
untilBuild.set("231.*")
sinceBuild.set("222")
untilBuild.set("222.*")
changeNotes.set(
"""
<div>
<h1>3.3.2</h1>
<h1>3.3.3.as</h1>
<ul>
<li>Optimize the Dio request window tool</li>
<li>freezed class model add <pre>ff</pre> command,Quickly generate the from Json function </li>
<img src='https://github.com/mdddj/dd_flutter_idea_plugin/blob/3.3.2.as/images/freezed_ff.png?raw=true' />
</ul>
</div>
<div>
<h1>3.3.2.as</h1>
<ul>
<li>Optimize the Dio request window tool</li>
<li>OpenAI function removal</li>
</ul>
</div>
Expand Down
Binary file added images/freezed_ff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion src/main/kotlin/note/jdbc/FlutterCollectService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,22 @@ object FlutterCollectService {
select * from ${SqliteConnectManager.FlutterPluginTableName}
""".trimIndent()
val query = SqlExecutor.query(SqliteConnectManager.connect, sql, EntityListHandler())
println(query.size)
list = query.toList()
}
return list

}




///禁用检查
fun disableCheckPlugin( pluginName: String,check: Boolean) {
check {
val sql = """
""".trimIndent()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,28 @@ import shop.itbug.fluttercheckversionx.document.copyTextToClipboard
class ApiCopyAll:MyAction({"Copy All"}) {
override fun actionPerformed(e: AnActionEvent) {
val api = e.api()!!
val dataMap = mapOf(
val dataMap = mutableMapOf(
"url" to api.url,
"method" to api.method,
"headers" to api.headers,
"queryParams" to api.queryParams,
"bodyJsonObject" to api.body,
"statusCode" to api.statusCode,
"body" to api.body,
"requestTime" to api.createDate,
"timestamp" to api.timestamp
)

api.queryParams?.apply {
if(this.isNotEmpty()){
dataMap["queryParams"] = this
}
}
api.body?.apply {
if(this is Map<*, *> && this.isNotEmpty()){
dataMap["body"] = this
}
}

dataMap["responseStatusCode"] = api.statusCode
dataMap["response"] = api.getDataJson()
dataMap["requestTime"] = api.createDate
dataMap["timestamp"] = api.timestamp

val toJSONString = JSON.toJSONString(dataMap, JSONWriter.Feature.PrettyFormat)
toJSONString.copyTextToClipboard()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
package shop.itbug.fluttercheckversionx.actions

import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.util.indexing.FileBasedIndex
import shop.itbug.fluttercheckversionx.common.MyToggleAction
import shop.itbug.fluttercheckversionx.inlay.DartAISetting

/**
* dart 文件的ai设定
*/
class DartAiSwitchAction : MyToggleAction({ "Display AI operations" }) {

val setting = DartAISetting.getInstance()

override fun isSelected(e: AnActionEvent): Boolean {
return setting.state.showInEditor
}

override fun setSelected(e: AnActionEvent, state: Boolean) {
println("进来了...")
setting.loadState(setting.state.copy(showInEditor = state))

val file = FileEditorManager.getInstance(e.project!!).selectedEditor?.file!!

FileBasedIndex.getInstance().requestReindex(file)
}


override fun update(e: AnActionEvent) {
val file = FileEditorManager.getInstance(e.project!!).selectedEditor?.file
e.presentation.isEnabled = e.project!=null && file != null
super.update(e)
}

companion object {
fun getInstance(): AnAction = ActionManager.getInstance().getAction("DartAiSwitchAction")!!
}
}
//package shop.itbug.fluttercheckversionx.actions
//
//import com.intellij.openapi.actionSystem.ActionManager
//import com.intellij.openapi.actionSystem.AnAction
//import com.intellij.openapi.actionSystem.AnActionEvent
//import com.intellij.openapi.fileEditor.FileEditorManager
//import com.intellij.util.indexing.FileBasedIndex
//import shop.itbug.fluttercheckversionx.common.MyToggleAction
//import shop.itbug.fluttercheckversionx.inlay.DartAISetting
//
///**
// * dart 文件的ai设定
// */
//class DartAiSwitchAction : MyToggleAction({ "Display AI operations" }) {
//
// val setting = DartAISetting.getInstance()
//
// override fun isSelected(e: AnActionEvent): Boolean {
// return setting.state.showInEditor
// }
//
// override fun setSelected(e: AnActionEvent, state: Boolean) {
// println("进来了...")
// setting.loadState(setting.state.copy(showInEditor = state))
//
// val file = FileEditorManager.getInstance(e.project!!).selectedEditor?.file!!
//
// FileBasedIndex.getInstance().requestReindex(file)
// }
//
//
// override fun update(e: AnActionEvent) {
// val file = FileEditorManager.getInstance(e.project!!).selectedEditor?.file
// e.presentation.isEnabled = e.project!=null && file != null
// super.update(e)
// }
//
// companion object {
// fun getInstance(): AnAction = ActionManager.getInstance().getAction("DartAiSwitchAction")!!
// }
//}
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
package shop.itbug.fluttercheckversionx.actions

import com.alibaba.fastjson2.JSON
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataKey
import com.intellij.openapi.project.Project
import shop.itbug.fluttercheckversionx.form.components.ApiListPanel
import shop.itbug.fluttercheckversionx.form.socket.Request


fun Request.getDataJson() : Any {
if(data is Map<*, *>) {
return data
}
if(data is String && JSON.isValid(data)) {
return JSON.parse(data)
}
return data ?: ""
}

fun AnActionEvent.api(): Request? {
return getData(DataKey.create(ApiListPanel.SELECT_KEY))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.psi.PsiElement
import com.intellij.ui.dsl.builder.Align
import com.intellij.ui.dsl.builder.bindSelected
import com.intellij.ui.dsl.builder.panel
import com.jetbrains.lang.dart.psi.impl.DartClassDefinitionImpl
Expand Down Expand Up @@ -56,7 +55,7 @@ class MoveClassToOtherFile : MyAction({ "将类转移到其他文件" }) {
row ("转移到文件") {
textFieldWithBrowseButton("选择文件",project, FileChooserDescriptorFactory.createSingleFileDescriptor("dart").withRoots(
ProjectRootManager.getInstance(project).contentSourceRoots.first()
)).align(Align.FILL)
))
}
row ("转移的类") {
label(psiElement.name?:"...?")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package shop.itbug.fluttercheckversionx.activity
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.ProjectActivity
import com.intellij.openapi.startup.StartupActivity
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.openapi.vfs.newvfs.BulkFileListener
Expand All @@ -17,7 +17,7 @@ import shop.itbug.fluttercheckversionx.util.MyDartPsiElementUtil
* 当项目打开的时候,会执行这个类的runActivity方法
* 在这里启动一个子线程去检测项目中的pubspec.yaml文件.并执行检测新版本
*/
class FlutterProjectOpenActivity : ProjectActivity, Disposable {
class FlutterProjectOpenActivity : StartupActivity, Disposable {

/**
* 项目在idea中打开时执行函数
Expand All @@ -39,7 +39,7 @@ class FlutterProjectOpenActivity : ProjectActivity, Disposable {

}

override suspend fun execute(project: Project) {
fun execute(project: Project) {
///监听assets资源目录更改事件
ApplicationManager.getApplication().messageBus.connect(this).subscribe(VirtualFileManager.VFS_CHANGES, object :
BulkFileListener {
Expand Down Expand Up @@ -71,4 +71,8 @@ class FlutterProjectOpenActivity : ProjectActivity, Disposable {
CacheUtil.clean()
}

override fun runActivity(p0: Project) {
execute(p0)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package shop.itbug.fluttercheckversionx.common

import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.ui.components.JBList
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import shop.itbug.fluttercheckversionx.services.JSONResult
import javax.swing.DefaultListModel
import javax.swing.JComponent
import javax.swing.ListCellRenderer




abstract class MySelecterAction : MyComboBoxAction() {
override fun createPopupActionGroup(button: JComponent, dataContext: DataContext): DefaultActionGroup {

return super.createPopupActionGroup(button, dataContext)
}
}

///我的选择器
abstract class MySelecter<T> : JBList<T>() {


val listModel = DefaultListModel<T>()
private val listRender = ListCellRenderer { _, value, index, isSelected, _ -> getCompeont(value, index,isSelected) }
abstract fun getData(): Call<JSONResult<List<T>>>


init {
model = listModel
cellRenderer = listRender
this.getData().enqueue(object : Callback<JSONResult<List<T>>> {
override fun onResponse(call: Call<JSONResult<List<T>>>, response: Response<JSONResult<List<T>>>) {
response.body()?.data?.apply {
listModel.addAll(this)
}
}

override fun onFailure(call: Call<JSONResult<List<T>>>, throwable: Throwable) {
println("加载失败")
}

})
}


abstract fun getCompeont(value: T, index: Int, isSelected : Boolean) : JComponent

}


Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package shop.itbug.fluttercheckversionx.dialog

import com.intellij.openapi.project.Project
import com.intellij.ui.dsl.builder.Align
import com.intellij.ui.dsl.builder.bindText
import com.intellij.ui.dsl.builder.panel
import shop.itbug.fluttercheckversionx.common.MyDialogWrapper
Expand All @@ -21,7 +20,7 @@ class AiApiKeyConfigDialog(override val project: Project) : MyDialogWrapper(proj
override fun createCenterPanel(): JComponent {
return panel {
row("ApiKey") {
passwordField().bindText({ apiKey }, { apiKey = it }).align(Align.FILL)
textField().bindText({ apiKey }, { apiKey = it })
}
row {
comment("The plugin will not collect your data, it will be securely saved locally")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ package shop.itbug.fluttercheckversionx.dialog
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogPanel
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.ui.dsl.builder.*
import com.intellij.ui.dsl.builder.BottomGap
import com.intellij.ui.dsl.builder.bindSelected
import com.intellij.ui.dsl.builder.bindText
import com.intellij.ui.dsl.builder.panel
import shop.itbug.fluttercheckversionx.config.GenerateAssetsClassConfig
import shop.itbug.fluttercheckversionx.config.GenerateAssetsClassConfigModel
import javax.swing.Action
Expand Down Expand Up @@ -48,7 +51,7 @@ class AssetsAutoGenerateClassActionConfigDialog(project: Project) : DialogWrappe
println(configModel)
GenerateAssetsClassConfig.getInstance().loadState(configModel)
super.doOKAction()
}.align(Align.FILL)
}
}
}
return p
Expand Down
Loading

0 comments on commit e8ced49

Please sign in to comment.