Skip to content

Commit

Permalink
Merge pull request #27 from mdddj/3.5.0
Browse files Browse the repository at this point in the history
release 3.5.0.as
  • Loading branch information
mdddj authored Jul 25, 2023
2 parents 0b324db + 65ff83b commit 3f0118a
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 41 deletions.
17 changes: 10 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.21"
}
group = "shop.itbug"
version = "3.5.0.eap"
version = "3.5.0.as"
repositories {
mavenCentral()
google()
Expand All @@ -17,15 +17,15 @@ repositories {


intellij {
version.set("LATEST-EAP-SNAPSHOT")
type.set("IC")
version.set("2022.2.1.18")
type.set("AI")
plugins.set(
listOf(
"yaml",
"Dart:232.8660.129",
"io.flutter:74.0.5",
"Dart:222.4582",
"io.flutter:74.0.2",
"org.intellij.plugins.markdown",
"terminal", "java", "maven"
"terminal"
)
)
}
Expand Down Expand Up @@ -77,20 +77,23 @@ tasks {

patchPluginXml {
sinceBuild.set("222")
untilBuild.set("222.*")
changeNotes.set(
"""
<div>
<h1>3.5.0.eap (2023-07-25)</h1>
<h1>3.5.0.as (2023-07-25)</h1>
<ul>
<li>添加freezed快捷操作菜单</li>
<li>新增韩语,日语,繁体等多国语言</li>
<li>其他若干细节优化</li>
</ul>
<hr/>
<ul>
<li>freezedショートカットメニューの追加</li>
<li>韓国語、日本語、繁体字など多言語を追加</li>
<li>その他の詳細の最適化</li>
</ul>
<hr/>
<ul>
<li>freezed 바로 가기 메뉴 추가</li>
<li>한국어, 일본어, 번체 등 다국어 추가</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.progress.Task
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
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
import io.flutter.sdk.FlutterSdk
import org.jetbrains.plugins.terminal.TerminalToolWindowManager
import shop.itbug.fluttercheckversionx.config.GenerateAssetsClassConfig
import shop.itbug.fluttercheckversionx.icons.MyIcons
import shop.itbug.fluttercheckversionx.services.FlutterService
import shop.itbug.fluttercheckversionx.services.Release
import shop.itbug.fluttercheckversionx.util.CacheUtil
import shop.itbug.fluttercheckversionx.util.MyDartPsiElementUtil
import shop.itbug.fluttercheckversionx.util.RunUtil

/**
* 梁典典
* 当项目打开的时候,会执行这个类的runActivity方法
* 在这里启动一个子线程去检测项目中的pubspec.yaml文件.并执行检测新版本
*/
class FlutterProjectOpenActivity : ProjectActivity, Disposable {
class FlutterProjectOpenActivity : StartupActivity, Disposable {

/**
* 项目在idea中打开时执行函数
Expand Down Expand Up @@ -85,10 +85,7 @@ class FlutterProjectOpenActivity : ProjectActivity, Disposable {
}


override suspend fun execute(project: Project) {
run(project)
checkFlutterLastVersion(project)
}



/**
Expand Down Expand Up @@ -128,22 +125,24 @@ class FlutterProjectOpenActivity : ProjectActivity, Disposable {



createNotification.addAction(object : AnAction("Upgrade") {
override fun actionPerformed(p0: AnActionEvent) {
TerminalToolWindowManager.getInstance(project).createLocalShellWidget(project.basePath,"flutter upgrade").executeCommand("flutter upgrade")
createNotification.hideBalloon()
}
createNotification.addAction(
object : AnAction("Upgrade") {
override fun actionPerformed(p0: AnActionEvent) {
RunUtil.runCommand(project,"flutter upgrade","flutter upgrade")
createNotification.hideBalloon()
}

override fun update(e: AnActionEvent) {
e.presentation.icon = MyIcons.flutter
super.update(e)
}
override fun update(e: AnActionEvent) {
e.presentation.icon = MyIcons.flutter
super.update(e)
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}
override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}

},)
},
)
createNotification.addAction(object : AnAction("Cancel"){
override fun actionPerformed(p0: AnActionEvent) {
createNotification.hideBalloon()
Expand All @@ -152,4 +151,9 @@ class FlutterProjectOpenActivity : ProjectActivity, Disposable {
})
createNotification.notify(project)
}

override fun runActivity(project: Project) {
run(project)
checkFlutterLastVersion(project)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ fun settingPanel(
override fun afterChange(listener: (String) -> Unit) {
}

override fun afterChange(listener: (String) -> Unit, parentDisposable: Disposable) {
}

override fun get(): String {
return model.lang
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import com.intellij.ui.awt.RelativePoint
import com.intellij.ui.dsl.builder.panel
import com.jetbrains.lang.dart.psi.impl.DartClassDefinitionImpl
import com.jetbrains.lang.dart.psi.impl.DartFactoryConstructorDeclarationImpl
import org.jetbrains.plugins.terminal.TerminalToolWindowManager
import shop.itbug.fluttercheckversionx.common.MyAction
import shop.itbug.fluttercheckversionx.dialog.JsonToFreezedInputDialog
import shop.itbug.fluttercheckversionx.inlay.HintsInlayPresentationFactory
import shop.itbug.fluttercheckversionx.manager.DartClassManager
import shop.itbug.fluttercheckversionx.util.RunUtil
import shop.itbug.fluttercheckversionx.util.dart.DartClassUtil
import shop.itbug.fluttercheckversionx.util.exByModifyAllPsiElementText
import shop.itbug.fluttercheckversionx.util.toast
Expand Down Expand Up @@ -179,9 +179,7 @@ class FreezedInlayCollector(val edit: Editor) : FactoryInlayHintsCollector(edit)
})
add(object : MyAction({ "Run build runner" }) {
override fun actionPerformed(e: AnActionEvent) {
TerminalToolWindowManager.getInstance(psiElement.project)
.createLocalShellWidget(psiElement.project.basePath, "FlutterCheckVersionX")
.executeCommand("flutter pub run build_runner build")
RunUtil.runCommand(psiElement.project,"FlutterCheckVersionX","flutter pub run build_runner build")
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import com.intellij.openapi.wm.StatusBarWidget
import com.intellij.openapi.wm.StatusBarWidgetFactory
import com.intellij.ui.awt.RelativePoint
import com.intellij.ui.components.JBLabel
import org.jetbrains.plugins.terminal.TerminalToolWindowManager
import shop.itbug.fluttercheckversionx.constance.discordUrl
import shop.itbug.fluttercheckversionx.dialog.JsonToFreezedInputDialog
import shop.itbug.fluttercheckversionx.dialog.SearchDialog
import shop.itbug.fluttercheckversionx.i18n.PluginBundle
import shop.itbug.fluttercheckversionx.icons.MyIcons
import shop.itbug.fluttercheckversionx.services.PluginActions.*
import shop.itbug.fluttercheckversionx.util.RunUtil
import java.awt.Point
import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent
Expand Down Expand Up @@ -115,7 +115,7 @@ class MyUserAccountBar(var project: Project) : CustomStatusBarWidget {
}

private fun createPop(): JBPopup {
return JBPopupFactory.getInstance().createPopupChooserBuilder(values().asList())
return JBPopupFactory.getInstance().createPopupChooserBuilder(entries)
.setItemChosenCallback { doActions(it) }
.setRenderer { _, value, _, _, _ ->
return@setRenderer JBLabel(value.title).apply {
Expand Down Expand Up @@ -154,8 +154,7 @@ class MyUserAccountBar(var project: Project) : CustomStatusBarWidget {
}

private fun runCommand(code: String) {
TerminalToolWindowManager.getInstance(project).createLocalShellWidget(project.basePath, "FlutterCheckVersionX")
.executeCommand(code)
RunUtil.runCommand(project,"FlutterCheckVersionX",code)
}

}
11 changes: 11 additions & 0 deletions src/main/kotlin/shop/itbug/fluttercheckversionx/util/RunUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package shop.itbug.fluttercheckversionx.util

import com.intellij.openapi.project.Project
import org.jetbrains.plugins.terminal.TerminalView

object RunUtil {

fun runCommand(project: Project,title: String,command: String){
TerminalView.getInstance(project).createLocalShellWidget(project.basePath,title).executeCommand(command)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fun PsiElement.runWriteCommandAction(runnable: Runnable) {
* @param findText 要查找的文本
*/
fun PsiFile.findPsiElementByText(findText: String) : PsiElement? {
val c = MyPsiElementUtil.findAllMatchingElements(this){ text: String, psiElement: PsiElement ->
val c = MyPsiElementUtil.findAllMatchingElements(this){ text: String, _: PsiElement ->
return@findAllMatchingElements findText == text
}
return if(c.isNotEmpty()) c.first() else null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,11 @@ open class EditorTextPanel @JvmOverloads constructor(
CellRendererPane::class.java as Class<out CellRendererPane?>,
this as Component
) != null && (StartupUiUtil
.isUnderDarcula || UIUtil.isUnderIntelliJLaF())
.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())
) {
return parent.background
}
if (StartupUiUtil.isUnderDarcula) return UIUtil.getTextFieldBackground()
if (StartupUiUtil.isUnderDarcula()) return UIUtil.getTextFieldBackground()
return if (enabled) colorsScheme.defaultBackground else UIUtil.getInactiveTextFieldBackgroundColor()
}

Expand Down Expand Up @@ -533,8 +533,8 @@ open class EditorTextPanel @JvmOverloads constructor(
val size: Dimension = JBUI.size(1, 10)
if (myEditor != null) {
size.height = myEditor!!.lineHeight
if (UIUtil.isUnderDefaultMacTheme() || StartupUiUtil.isUnderDarcula || UIUtil.isUnderIntelliJLaF()) {
size.height = Math.max(size.height, scale(16))
if (UIUtil.isUnderDefaultMacTheme() || StartupUiUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
size.height = size.height.coerceAtLeast(scale(16))
}
JBInsets.addTo(size, insets)
JBInsets.addTo(size, myEditor!!.insets)
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<depends optional="true" config-file="actions.xml">com.intellij.modules.lang</depends>
<depends optional="true" config-file="jobs_actions.xml">com.intellij.modules.lang</depends>
<depends>Dart</depends>
<depends>org.jetbrains.idea.maven</depends>
<depends>io.flutter</depends>
<depends>org.jetbrains.kotlin</depends>
<depends>org.intellij.plugins.markdown</depends>
Expand Down

0 comments on commit 3f0118a

Please sign in to comment.