diff --git a/CHANGELOG.md b/CHANGELOG.md index bb9d03599..1ea933fed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ### Added * Added even more debug info for future reports relating to issue [#R1](https://github.com/FWDekkerBot/intellij-randomness-issues/issues/1). +### Changed +* Changed icon instantiation to be more in line with guidelines, hopefully fixing [#R13](https://github.com/FWDekkerBot/intellij-randomness-issues/issues/13). + ## 3.3.1 -- 2024-05-06 ### Added @@ -24,7 +27,7 @@ * Disabled dynamic reloading of the plugin until a stable fix can be deployed. ([#522](https://github.com/FWDekker/intellij-randomness/pull/522)) ### Fixed -* Various incorrect uses of the platform API. ([#526](https://github.com/FWDekker/intellij-randomness/issues/526)) +* Fixed various incorrect uses of the platform API. ([#526](https://github.com/FWDekker/intellij-randomness/issues/526)) ## 3.2.0 -- 2024-01-10 diff --git a/src/main/kotlin/com/fwdekker/randomness/Bundle.kt b/src/main/kotlin/com/fwdekker/randomness/Bundle.kt index 5fac53f29..2ee5ae589 100644 --- a/src/main/kotlin/com/fwdekker/randomness/Bundle.kt +++ b/src/main/kotlin/com/fwdekker/randomness/Bundle.kt @@ -40,7 +40,7 @@ object Bundle { fun String.matchesFormat(format: String, vararg args: String) = Regex("%[0-9]+\\\$[Ssd]").findAll(format) .toList() - .reversed() + .asReversed() .fold(format) { acc, match -> if (match.value.drop(1).dropLast(2).toInt() > args.size) acc.replaceRange(match.range, ".*") diff --git a/src/main/kotlin/com/fwdekker/randomness/Icons.kt b/src/main/kotlin/com/fwdekker/randomness/Icons.kt index 34e75c440..018a31a87 100644 --- a/src/main/kotlin/com/fwdekker/randomness/Icons.kt +++ b/src/main/kotlin/com/fwdekker/randomness/Icons.kt @@ -18,57 +18,68 @@ object Icons { /** * The main icon of Randomness. */ - val RANDOMNESS get() = IconLoader.getIcon("/icons/randomness.svg", this.javaClass.classLoader) + @JvmField + val RANDOMNESS = IconLoader.getIcon("/icons/randomness.svg", javaClass) /** * The template icon for template icons. */ - val TEMPLATE get() = IconLoader.getIcon("/icons/template.svg", this.javaClass.classLoader) + @JvmField + val TEMPLATE = IconLoader.getIcon("/icons/template.svg", javaClass) /** * The template icon for scheme icons. */ - val SCHEME get() = IconLoader.getIcon("/icons/scheme.svg", this.javaClass.classLoader) + @JvmField + val SCHEME = IconLoader.getIcon("/icons/scheme.svg", javaClass) /** * An icon for settings. */ - val SETTINGS get() = IconLoader.getIcon("/icons/settings.svg", this.javaClass.classLoader) + @JvmField + val SETTINGS = IconLoader.getIcon("/icons/settings.svg", javaClass) /** * A filled-in version of [SETTINGS]. */ - val SETTINGS_FILLED get() = IconLoader.getIcon("/icons/settings-filled.svg", this.javaClass.classLoader) + @JvmField + val SETTINGS_FILLED = IconLoader.getIcon("/icons/settings-filled.svg", javaClass) /** * An icon for arrays. */ - val ARRAY get() = IconLoader.getIcon("/icons/array.svg", this.javaClass.classLoader) + @JvmField + val ARRAY = IconLoader.getIcon("/icons/array.svg", javaClass) /** * A filled-in version of [ARRAY]. */ - val ARRAY_FILLED get() = IconLoader.getIcon("/icons/array-filled.svg", this.javaClass.classLoader) + @JvmField + val ARRAY_FILLED = IconLoader.getIcon("/icons/array-filled.svg", javaClass) /** * An icon for references. */ - val REFERENCE get() = IconLoader.getIcon("/icons/reference.svg", this.javaClass.classLoader) + @JvmField + val REFERENCE = IconLoader.getIcon("/icons/reference.svg", javaClass) /** * A filled-in version of [REFERENCE]. */ - val REFERENCE_FILLED get() = IconLoader.getIcon("/icons/reference-filled.svg", this.javaClass.classLoader) + @JvmField + val REFERENCE_FILLED = IconLoader.getIcon("/icons/reference-filled.svg", javaClass) /** * An icon for repeated insertions. */ - val REPEAT get() = IconLoader.getIcon("/icons/repeat.svg", this.javaClass.classLoader) + @JvmField + val REPEAT = IconLoader.getIcon("/icons/repeat.svg", javaClass) /** * A filled-in version of [REPEAT]. */ - val REPEAT_FILLED get() = IconLoader.getIcon("/icons/repeat-filled.svg", this.javaClass.classLoader) + @JvmField + val REPEAT_FILLED = IconLoader.getIcon("/icons/repeat-filled.svg", javaClass) } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 09160531a..8c871331b 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -33,7 +33,7 @@ + icon="com.fwdekker.randomness.Icons.RANDOMNESS"> diff --git a/src/main/resources/icons/array-filled.svg b/src/main/resources/icons/array-filled.svg index 57f290193..2d606ba0d 100644 --- a/src/main/resources/icons/array-filled.svg +++ b/src/main/resources/icons/array-filled.svg @@ -1,5 +1,5 @@ - + @@ -7,4 +7,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/icons/array.svg b/src/main/resources/icons/array.svg index 97897dc0d..434f54ac0 100644 --- a/src/main/resources/icons/array.svg +++ b/src/main/resources/icons/array.svg @@ -1,7 +1,7 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/array_dark.svg b/src/main/resources/icons/array_dark.svg index fd7e402e4..781f208ff 100644 --- a/src/main/resources/icons/array_dark.svg +++ b/src/main/resources/icons/array_dark.svg @@ -1,9 +1,9 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/popup-filled.svg b/src/main/resources/icons/popup-filled.svg index 7248fe737..66a50a5cd 100644 --- a/src/main/resources/icons/popup-filled.svg +++ b/src/main/resources/icons/popup-filled.svg @@ -1,5 +1,5 @@ - + @@ -8,4 +8,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/icons/popup.svg b/src/main/resources/icons/popup.svg index cacdaecc2..9df6c8871 100644 --- a/src/main/resources/icons/popup.svg +++ b/src/main/resources/icons/popup.svg @@ -1,8 +1,8 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/popup_dark.svg b/src/main/resources/icons/popup_dark.svg index a03005c53..f60f9ce52 100644 --- a/src/main/resources/icons/popup_dark.svg +++ b/src/main/resources/icons/popup_dark.svg @@ -1,5 +1,5 @@ - + @@ -7,4 +7,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/icons/randomness.svg b/src/main/resources/icons/randomness.svg index 90f9b3f8d..92bc5759e 100644 --- a/src/main/resources/icons/randomness.svg +++ b/src/main/resources/icons/randomness.svg @@ -1,5 +1,5 @@ - + @@ -8,4 +8,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/icons/reference-filled.svg b/src/main/resources/icons/reference-filled.svg index 89cfc59d3..344c17009 100644 --- a/src/main/resources/icons/reference-filled.svg +++ b/src/main/resources/icons/reference-filled.svg @@ -1,5 +1,5 @@ - + @@ -8,4 +8,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/icons/reference.svg b/src/main/resources/icons/reference.svg index 6d00d6191..05e65fa09 100644 --- a/src/main/resources/icons/reference.svg +++ b/src/main/resources/icons/reference.svg @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/reference_dark.svg b/src/main/resources/icons/reference_dark.svg index d78ad980b..9138b5473 100644 --- a/src/main/resources/icons/reference_dark.svg +++ b/src/main/resources/icons/reference_dark.svg @@ -1,8 +1,8 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/repeat-filled.svg b/src/main/resources/icons/repeat-filled.svg index 6d0a5255a..bf9649b50 100644 --- a/src/main/resources/icons/repeat-filled.svg +++ b/src/main/resources/icons/repeat-filled.svg @@ -1,9 +1,9 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/repeat.svg b/src/main/resources/icons/repeat.svg index 00df41c6f..3aadd9707 100644 --- a/src/main/resources/icons/repeat.svg +++ b/src/main/resources/icons/repeat.svg @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/repeat_dark.svg b/src/main/resources/icons/repeat_dark.svg index 01e8334ea..2423df76e 100644 --- a/src/main/resources/icons/repeat_dark.svg +++ b/src/main/resources/icons/repeat_dark.svg @@ -1,8 +1,8 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/scheme.svg b/src/main/resources/icons/scheme.svg index 947f267b9..2cd5689eb 100644 --- a/src/main/resources/icons/scheme.svg +++ b/src/main/resources/icons/scheme.svg @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/settings-filled.svg b/src/main/resources/icons/settings-filled.svg index 17a1203b9..e08d6b4e6 100644 --- a/src/main/resources/icons/settings-filled.svg +++ b/src/main/resources/icons/settings-filled.svg @@ -1,9 +1,9 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/settings.svg b/src/main/resources/icons/settings.svg index 51c421120..224d4dee0 100644 --- a/src/main/resources/icons/settings.svg +++ b/src/main/resources/icons/settings.svg @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/settings_dark.svg b/src/main/resources/icons/settings_dark.svg index 6d5e3eba5..1f79d29f5 100644 --- a/src/main/resources/icons/settings_dark.svg +++ b/src/main/resources/icons/settings_dark.svg @@ -1,8 +1,8 @@ - + - \ No newline at end of file + diff --git a/src/main/resources/icons/template.svg b/src/main/resources/icons/template.svg index d1df06847..59122ddb7 100644 --- a/src/main/resources/icons/template.svg +++ b/src/main/resources/icons/template.svg @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt index aa03771a6..bc897ab6b 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt @@ -943,7 +943,7 @@ object TemplateJTreeTest : FunSpec({ } test("resets the selected template's scheme order") { - currentList.templates[0].schemes.setAll(currentList.templates[0].schemes.reversed()) + currentList.templates[0].schemes.setAll(currentList.templates[0].schemes.asReversed().toList()) guiRun { tree.reload() } currentList.templates[0].schemes.names() shouldContainExactly listOf("Scheme1", "Scheme0") diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt index 6fb831656..5b32703ff 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt @@ -130,7 +130,7 @@ object TemplateTest : FunSpec({ .also { it.random = Random(1) } .generateStrings()[0] - output1.split("-").reversed() shouldContainExactly output2.split("-") + output1.split("-").asReversed() shouldContainExactly output2.split("-") } test("sets the rng independent of the rng of other schemes") {