Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.1 Build Support #116

Merged
merged 5 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ plugins {
// Gradle Qodana Plugin
id("org.jetbrains.qodana") version "0.1.13"
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
id("io.gitlab.arturbosch.detekt") version "1.22.0"
id("io.gitlab.arturbosch.detekt") version "1.23.1"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
id("org.jlleitschuh.gradle.ktlint") version "11.3.2"
id("org.jlleitschuh.gradle.ktlint") version "12.0.3"
}

group = properties("pluginGroup")
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
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

pluginGroup = io.unthrottled.doki.icons
pluginName = Doki Theme Icons
pluginVersion = 88.5-1.1.0
pluginVersion = 88.5-1.2.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 233.8264.8
pluginUntilBuild = 233.*
pluginSinceBuild = 233.11799.241
pluginUntilBuild = 241.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension
platformType = IU
platformVersion = 2023.3.2
platformVersion = 2024.1

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = Pythonid:233.13135.103
platformPlugins = Pythonid:241.14494.314

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.5
Expand Down
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
Loading
Loading