Skip to content

Commit

Permalink
Refactor Key Promoter X and made it a dynamic plugin
Browse files Browse the repository at this point in the history
Major refactor of KeyPromoter.java and its functions.
Split the handling of Platform actions and raw AWT events.
Now these classes are instantiated separately using the Platform's listener and services.

With this refactor, the plugin should be finally a dynamic plugin which does not require a restart when updating.

Update the build system and fixed several places where services were not acquired dynamically.
  • Loading branch information
halirutan committed Oct 24, 2024
1 parent e55ad09 commit 46ffe0a
Show file tree
Hide file tree
Showing 17 changed files with 429 additions and 274 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
[![Banner](doc/img/kpxBanner.png)](https://github.com/sponsors/halirutan)

---
I'm grateful this project is currently receives sponsorship of $4/month from
[jlash13](https://github.com/jlash13),

I'm grateful this project is currently receives sponsorship of \$4/month from
[Indrek Toom](https://github.com/m2ger),
$2/month from
\$2/month from
[Mac Adamarczuk](https://github.com/macalac),
[Frank Harper](https://github.com/franklinharper),
[Hasnain Baxamoosa](https://github.com/hbaxamoosa),
[Brian Levis](https://github.com/brianlevis),
[PCoetzeeDev](https://github.com/PCoetzeeDev),
and $1/month from [14 other people](https://github.com/sponsors/halirutan).
[baffler](https://github.com/baffler)
and \$1/month from [13 other people](https://github.com/sponsors/halirutan).

- [Become a GitHub Sponsor and support the Key Promoter X development](https://github.com/sponsors/halirutan)

Expand Down
7 changes: 2 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import org.jetbrains.changelog.Changelog
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)

plugins {
id("java")
Expand All @@ -24,9 +23,7 @@ repositories {
dependencies {
implementation(libs.annotations)
intellijPlatform {
val type = properties("platformType").get()
val version = properties("platformVersion").get()
create(type, version)
create(properties("platformType"), properties("platformVersion"))
instrumentationTools()
pluginVerifier()
zipSigner()
Expand Down Expand Up @@ -92,7 +89,7 @@ intellijPlatform {
}
}

verifyPlugin {
pluginVerification {
ides {
recommended()
}
Expand Down
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
pluginGroup=de.halirutan.keypromoterx
pluginName=Key Promoter X
pluginRepositoryUrl=https://github.com/halirutan/IntelliJ-Key-Promoter-X
pluginVersion=2024.2.0
pluginVersion=2024.2.2-beta-1
pluginSinceBuild=241
pluginUntilBuild=
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
# See https://jb.gg/intellij-platform-builds-list for available build versions
pluginVerifierIdeVersions=IC-231.8109.2, IC-232.8660.185, IC-241.14494.240
platformType=IC
platformVersion=2024.1.4
gradleVersion=8.9
gradleVersion=8.10.2
kotlin.stdlib.default.dependency=false
org.gradle.configuration-cache=false
org.gradle.caching=false
Expand Down
10 changes: 3 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
annotations = "24.1.0"

# plugins
kotlin = "1.9.23"
changelog = "2.2.0"
gradleIntelliJPlugin = "2.0.0-RC1"
qodana = "0.1.13"
kover = "0.7.6"
changelog = "2.2.1"
gradleIntelliJPlugin = "2.1.0"
kotlin = "1.9.25"

[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
Expand All @@ -16,5 +14,3 @@ annotations = { group = "org.jetbrains", name = "annotations", version.ref = "an
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
gradleIntelliJPlugin = { id = "org.jetbrains.intellij.platform", version.ref = "gradleIntelliJPlugin" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
14 changes: 7 additions & 7 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@
<vendor>halirutan</vendor>
<depends>com.intellij.modules.lang</depends>

<application-components>
<component>
<implementation-class>de.halirutan.keypromoterx.KeyPromoter</implementation-class>
</component>
</application-components>

<extensions defaultExtensionNs="com.intellij">
<notificationGroup
displayType="BALLOON"
id="Key Promoter X"
/>

<postStartupActivity implementation="de.halirutan.keypromoterx.KeyPromoterXStartupNotification"/>
<applicationService serviceImplementation="de.halirutan.keypromoterx.statistic.KeyPromoterStatistics"/>
<applicationService serviceImplementation="de.halirutan.keypromoterx.KeyPromoterSettings"/>
Expand All @@ -36,4 +29,11 @@
<applicationConfigurable id="keyPromoterConfiguration" displayName="Key Promoter X"
instance="de.halirutan.keypromoterx.KeyPromoterConfiguration" groupId="tools"/>
</extensions>

<applicationListeners>
<listener class="de.halirutan.keypromoterx.KeyPromoterAWTListener"
topic="com.intellij.ide.AppLifecycleListener"/>
<listener class="de.halirutan.keypromoterx.KeyPromoterActionListener"
topic="com.intellij.openapi.actionSystem.ex.AnActionListener"/>
</applicationListeners>
</idea-plugin>
2 changes: 1 addition & 1 deletion resources/messages/KeyPromoterBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
kp.notification.startup=Sponsor now: Your support helps to dedicate more time to new releases and bug fixes!
kp.notification.startup=Looking for sponsors: Your support drives innovation, new releases, and faster bug fixes!
kp.dialog.reset.statistic.text=Do you really want to reset your Key Promoter X statistics? This cannot be undone!
kp.dialog.reset.statistic.title=Reset Statistics
kp.dialog.tip=<html><body><center>Command <u><b>{0}</b></u> missed {1} time(s)</center><center>Press <b>{2}</b> to close the dialog</center></body></html>
Expand Down
207 changes: 0 additions & 207 deletions src/de/halirutan/keypromoterx/KeyPromoter.java

This file was deleted.

Loading

0 comments on commit 46ffe0a

Please sign in to comment.