Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
YiiGuxing committed Dec 7, 2021
1 parent 100c133 commit ba46706
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/cn/yiiguxing/plugin/figlet/DataManager.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.yiiguxing.plugin.figlet

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.util.xmlb.annotations.CollectionBean
Expand All @@ -23,7 +23,7 @@ class DataManager : PersistentStateComponent<DataManager.State> {

companion object {
val instance: DataManager
get() = ServiceManager.getService(DataManager::class.java)
get() = ApplicationManager.getApplication().getService(DataManager::class.java)
}

data class State(var lastUsedFont: String, @CollectionBean var commonFonts: List<String>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.intellij.openapi.ui.popup.ListSeparator
import com.intellij.openapi.ui.popup.PopupStep
import com.intellij.openapi.ui.popup.util.BaseListPopupStep
import com.intellij.ui.awt.RelativePoint
import com.intellij.ui.scale.JBUIScale
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
import java.awt.*
Expand Down Expand Up @@ -81,8 +82,8 @@ class FigFontComboBoxButton(
g as Graphics2D
super.paint(g)

val x = (width - JBUI.scale(20)).toDouble()
val y = (height - JBUI.scale(5.0f)) * 0.5
val x = (width - JBUIScale.scale(20)).toDouble()
val y = (height - JBUIScale.scale(5.0f)) * 0.5
g.translate(x, y)

if (!isUnderDarcula) {
Expand All @@ -99,8 +100,8 @@ class FigFontComboBoxButton(
private fun createArrowShape(): Shape {
return GeneralPath().apply {
moveTo(0.0f, 0.0f)
lineTo(JBUI.scale(10.0f), 0.0f)
lineTo(JBUI.scale(5.0f), 5.0f)
lineTo(JBUIScale.scale(10.0f), 0.0f)
lineTo(JBUIScale.scale(5.0f), 5.0f)
closePath()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.openapi.util.Disposer
import org.slf4j.LoggerFactory
import java.util.*
import javax.swing.Action
import javax.swing.JComponent
import kotlin.collections.set
Expand All @@ -31,12 +30,12 @@ class GenerateASCIIArtDialog(project: Project, defaultInputText: String = "") :
Disposer.register(disposable, form)
}

override fun createCenterPanel(): JComponent? = form.component
override fun createCenterPanel(): JComponent = form.component

override fun createActions(): Array<Action> = arrayOf(okAction, cancelAction)

override fun getPreferredFocusedComponent(): JComponent? {
return form.preferredFocusedComponent ?: super.getPreferredFocusedComponent()
override fun getPreferredFocusedComponent(): JComponent {
return form.preferredFocusedComponent
}

fun showAndGetResult(): String? {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/cn/yiiguxing/plugin/figlet/Settings.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.yiiguxing.plugin.figlet

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage

Expand All @@ -25,6 +25,6 @@ class Settings : PersistentStateComponent<Settings> {

companion object {
val instance: Settings
get() = ServiceManager.getService(Settings::class.java)
get() = ApplicationManager.getApplication().getService(Settings::class.java)
}
}

0 comments on commit ba46706

Please sign in to comment.