Skip to content

Commit

Permalink
Updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unthrottled committed Apr 21, 2024
1 parent 1fd2c1e commit 7246c94
Show file tree
Hide file tree
Showing 42 changed files with 376 additions and 361 deletions.
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ intellij {
val activePlugins: MutableList<Any> =
properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty).toMutableList()

activePlugins.add(
project(":doki-theme")
)
// activePlugins.add(
// project(":doki-theme")
// )

plugins.set(activePlugins)
}
Expand Down Expand Up @@ -132,11 +132,11 @@ tasks {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end))
}.joinToString("\n").run { markdownToHTML(this) }
}.joinToString("\n").run { markdownToHTML(this) },
)

changeNotes.set(
projectDir.resolve("RELEASE-NOTES.md").readText().run { markdownToHTML(this) }
projectDir.resolve("RELEASE-NOTES.md").readText().run { markdownToHTML(this) },
)
}

Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = "doki-theme-icons-jetbrains"

include(":doki-theme")
project(":doki-theme").projectDir = file("../doki-theme-jetbrains")
// include(":doki-theme")
// project(":doki-theme").projectDir = file("../doki-theme-jetbrains")
3 changes: 1 addition & 2 deletions src/main/kotlin/icons/DokiThemeIconz.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ object DokiThemeIconz {
val EXPANDED = load("doki/icons/chevron_down_13x13.svg")
}

private fun load(path: String): Icon =
IconLoader.getIcon(path, DokiThemeIconz::class.java)
private fun load(path: String): Icon = IconLoader.getIcon(path, DokiThemeIconz::class.java)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import io.unthrottled.doki.icons.jetbrains.tools.toOptional
import java.util.Optional

object DokiThemeIcons {

fun getVersion(): Optional<String> =
PluginManagerCore.getPlugin(PluginId.getId(Constants.PLUGIN_ID))
.toOptional()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ data class DokiThemeInformation(
val displayName: String,
val group: String,
val listName: String,
val colors: Map<String, String>
val colors: Map<String, String>,
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentMap

class PluginMaster : ProjectManagerListener, Disposable, Logging {

companion object {
init {
ExperimentalUIFixer.fixExperimentalUI()
}

val instance: PluginMaster
get() = ApplicationManager.getApplication().getService(PluginMaster::class.java)
}
Expand Down Expand Up @@ -62,9 +62,8 @@ class PluginMaster : ProjectManagerListener, Disposable, Logging {
}

internal data class ProjectListeners(
private val project: Project
private val project: Project,
) : Disposable {

override fun dispose() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import io.unthrottled.doki.icons.jetbrains.DokiThemeIcons.getVersion
import io.unthrottled.doki.icons.jetbrains.onboarding.UpdateNotification

class ShowUpdateNotification : AnAction(), DumbAware {

override fun actionPerformed(e: AnActionEvent) {
getVersion()
.ifPresent {
UpdateNotification.display(
e.project!!,
it
it,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fun Application.getConfig(): Config = this.getService(Config::class.java)

@State(
name = "doki-theme-icon-config",
storages = [Storage("doki-theme-icons.xml")]
storages = [Storage("doki-theme-icons.xml")],
)
class Config : PersistentStateComponent<Config>, Cloneable {
companion object {
Expand All @@ -32,8 +32,7 @@ class Config : PersistentStateComponent<Config>, Cloneable {
var isMyIcons: Boolean = false
var syncWithDokiTheme: Boolean = true

override fun getState(): Config? =
createCopy(this)
override fun getState(): Config? = createCopy(this)

override fun loadState(state: Config) {
copyBean(state, this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ interface IconConfigListener : EventListener {
val TOPIC: Topic<IconConfigListener> =
Topic(IconConfigListener::class.java)
}
fun iconConfigUpdated(previousState: IconSettingsModel, newState: IconSettingsModel)

fun iconConfigUpdated(
previousState: IconSettingsModel,
newState: IconSettingsModel,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ data class IconSettingsModel(
var isNamedFolderIcons: Boolean,
var isMyIcons: Boolean,
var currentThemeId: String,
var syncWithDokiTheme: Boolean
var syncWithDokiTheme: Boolean,
)

object IconSettings {
Expand All @@ -52,29 +52,33 @@ object IconSettings {
isGlyphIcons = Config.instance.isGlyphIcon,
isNamedFolderIcons = Config.instance.isNamedFolderIcons,
isMyIcons = Config.instance.isMyIcons,
currentThemeId = IconThemeManager.instance.getThemeById(
Config.instance.currentThemeId
).orElseGet {
IconThemeManager.instance.defaultTheme
}.id,
syncWithDokiTheme = Config.instance.syncWithDokiTheme
currentThemeId =
IconThemeManager.instance.getThemeById(
Config.instance.currentThemeId,
).orElseGet {
IconThemeManager.instance.defaultTheme
}.id,
syncWithDokiTheme = Config.instance.syncWithDokiTheme,
)

fun createThemeComboBoxModel(settingsSupplier: () -> IconSettingsModel): ComboBox<ThemeComboItem> {
val themeList = IconThemeManager.instance.allThemes
.sortedBy { theme -> theme.listName }
.map { ThemeComboItem(it) }
val themeComboBox = ComboBox(
DefaultComboBoxModel(
Vector(
themeList
)
val themeList =
IconThemeManager.instance.allThemes
.sortedBy { theme -> theme.listName }
.map { ThemeComboItem(it) }
val themeComboBox =
ComboBox(
DefaultComboBoxModel(
Vector(
themeList,
),
),
)
)

themeComboBox.model.selectedItem = themeList.find {
it.id == settingsSupplier().currentThemeId
}
themeComboBox.model.selectedItem =
themeList.find {
it.id == settingsSupplier().currentThemeId
}

themeComboBox.addActionListener {
settingsSupplier().currentThemeId = (themeComboBox.model.selectedItem as ThemeComboItem).id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ class ErrorReporter : ErrorReportSubmitter() {
events: Array<out IdeaLoggingEvent>,
additionalInfo: String?,
parentComponent: Component,
consumer: Consumer<in SubmittedReportInfo>
consumer: Consumer<in SubmittedReportInfo>,
): Boolean {
ApplicationManager.getApplication()
.executeOnPooledThread {
Sentry.setUser(
User().apply {
this.id = Config.instance.userId
}
},
)
runSafely({
Sentry.init { options: SentryOptions ->
options.dsn =
RestClient.performGet(
"https://jetbrains.assets.unthrottled.io/doki-theme-icons/sentry-dsn.txt"
"https://jetbrains.assets.unthrottled.io/doki-theme-icons/sentry-dsn.txt",
)
.map { it.trim() }
.orElse(
"https://[email protected]/6684182"
"https://[email protected]/6684182",
)
}
}) {
Expand All @@ -71,12 +71,13 @@ class ErrorReporter : ErrorReportSubmitter() {
this.level = SentryLevel.ERROR
this.serverName = getAppName().second
this.setExtra("Additional Info", additionalInfo ?: "None")
}
},
).apply {
this.message = Message().apply {
this.message = it.throwableText
}
}
this.message =
Message().apply {
this.message = it.throwableText
}
},
)
}
consumer.consume(SubmittedReportInfo(SubmittedReportInfo.SubmissionStatus.NEW_ISSUE))
Expand All @@ -103,10 +104,11 @@ class ErrorReporter : ErrorReportSubmitter() {
}

private fun getJRE(properties: Properties): String {
val javaVersion = properties.getProperty(
"java.runtime.version",
properties.getProperty("java.version", "unknown")
)
val javaVersion =
properties.getProperty(
"java.runtime.version",
properties.getProperty("java.version", "unknown"),
)
val arch = properties.getProperty("os.arch", "")
return IdeBundle.message("about.box.jre", javaVersion, arch)
}
Expand All @@ -117,8 +119,9 @@ class ErrorReporter : ErrorReportSubmitter() {
return IdeBundle.message("about.box.vm", vmVersion, vmVendor)
}

private fun getGC() = ManagementFactory.getGarbageCollectorMXBeans().stream()
.map { it.name }.collect(Collectors.joining(","))
private fun getGC() =
ManagementFactory.getGarbageCollectorMXBeans().stream()
.map { it.name }.collect(Collectors.joining(","))

private fun getBuildInfo(appInfo: ApplicationInfo): String {
var buildInfo = IdeBundle.message("about.box.build.number", appInfo.build.asString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import javassist.expr.ExprEditor
import javassist.expr.MethodCall

object PlatformHacker : Logging {

init {
IconPathReplacementComponent.installComponents()
hackPlatform()
Expand All @@ -31,8 +30,8 @@ object PlatformHacker : Logging {
val cp = ClassPool(true)
cp.insertClassPath(
ClassClassPath(
Class.forName("com.intellij.execution.ui.RunState")
)
Class.forName("com.intellij.execution.ui.RunState"),
),
)
val ctClass = cp.get("com.intellij.execution.ui.StopWithDropDownAction")
val doPaintText = ctClass.getDeclaredMethods("update")[0]
Expand All @@ -43,7 +42,7 @@ object PlatformHacker : Logging {
m.replace("{ \$_ = \$1; }")
}
}
}
},
)
ctClass.toClass()
}) {
Expand All @@ -56,8 +55,8 @@ object PlatformHacker : Logging {
val cp = ClassPool(true)
cp.insertClassPath(
ClassClassPath(
Class.forName("com.intellij.execution.ui.RunState")
)
Class.forName("com.intellij.execution.ui.RunState"),
),
)
val ctClass = cp.get("com.intellij.execution.ui.RunWidgetButtonLook")
val doPaintText = ctClass.getDeclaredMethods("paintIcon")[0]
Expand All @@ -68,7 +67,7 @@ object PlatformHacker : Logging {
m.replace("{ \$_ = \$1; }")
}
}
}
},
)
ctClass.toClass()
}) {
Expand All @@ -79,8 +78,8 @@ object PlatformHacker : Logging {
val cp = ClassPool(true)
cp.insertClassPath(
ClassClassPath(
Class.forName("com.intellij.execution.ui.RunState")
)
Class.forName("com.intellij.execution.ui.RunState"),
),
)
val ctClass = cp.get("com.intellij.execution.ui.RedesignedRunConfigurationSelector")
val doPaintText = ctClass.getDeclaredMethods("update")[0]
Expand All @@ -91,7 +90,7 @@ object PlatformHacker : Logging {
m.replace("{ \$_ = \$1; }")
}
}
}
},
)
ctClass.toClass()
}) {
Expand All @@ -104,8 +103,8 @@ object PlatformHacker : Logging {
val cp = ClassPool(true)
cp.insertClassPath(
ClassClassPath(
Class.forName("com.intellij.openapi.wm.impl.SideStack")
)
Class.forName("com.intellij.openapi.wm.impl.SideStack"),
),
)
val ctClass = cp.get("com.intellij.openapi.wm.impl.SquareStripeButtonLook")
val doPaintText = ctClass.getDeclaredMethods("paintIcon")[0]
Expand All @@ -116,7 +115,7 @@ object PlatformHacker : Logging {
m.replace("{ \$_ = \$1; }")
}
}
}
},
)
ctClass.toClass()
}) {
Expand Down
Loading

0 comments on commit 7246c94

Please sign in to comment.