Skip to content

Commit

Permalink
Merge pull request #443 from wuseal/fix-compatible
Browse files Browse the repository at this point in the history
[fix] runtime error exception when run in  IntelliJ IDEA 2024.3 and also Android Studio Meerkat
  • Loading branch information
wuseal authored Dec 3, 2024
2 parents 689dbb6 + 2b69e7f commit 0b0ed5b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
13 changes: 11 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.hildan.github.changelog.builder.DEFAULT_TIMEZONE
import org.hildan.github.changelog.builder.SectionDefinition
import org.jetbrains.changelog.closure
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
repositories {
Expand All @@ -11,15 +12,15 @@ buildscript {

plugins {
id("org.jetbrains.intellij") version "0.7.3"
kotlin("jvm") version "1.4.20"
kotlin("jvm") version "1.5.20"
id("org.jetbrains.changelog") version "1.1.1"
id("org.hildan.github.changelog") version "1.6.0"
}
group = "wu.seal"
version = System.getenv("TAG") ?: "Unreleased"

intellij {
version = "2017.1"
version = "2020.1"
pluginName = "JsonToKotlinClass"
}
tasks.patchPluginXml {
Expand Down Expand Up @@ -93,3 +94,11 @@ task("createGithubReleaseNotes") {
githubReleaseNoteFile.writeText(content)
}
}
tasks.withType(KotlinCompile::class.java).configureEach {
kotlinOptions {
jvmTarget = "1.8" // Set the JVM target to match the bytecode you are inlining
}
}
tasks.buildSearchableOptions {
enabled = false
}
11 changes: 7 additions & 4 deletions src/main/kotlin/wu/seal/jsontokotlin/ui/JsonInputDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.EditorFactory
import com.intellij.openapi.editor.event.DocumentEvent
import com.intellij.openapi.editor.event.DocumentListener
import com.intellij.openapi.fileChooser.FileChooser
import com.intellij.openapi.fileChooser.FileChooserDescriptor
import com.intellij.openapi.progress.util.DispatchThreadProgressWindow
Expand Down Expand Up @@ -140,10 +142,11 @@ class JsonInputDialog(classsName: String, private val project: Project) : Messag
val editorFactory = EditorFactory.getInstance()
val document = editorFactory.createDocument("").apply {
setReadOnly(false)
addDocumentListener(object : com.intellij.openapi.editor.event.DocumentListener {
override fun documentChanged(event: com.intellij.openapi.editor.event.DocumentEvent?) = revalidate()

override fun beforeDocumentChange(event: com.intellij.openapi.editor.event.DocumentEvent?) = Unit
addDocumentListener(object : DocumentListener {
override fun documentChanged(event: DocumentEvent) {
super.documentChanged(event)
revalidate()
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<depends>com.intellij.modules.lang</depends>

<depends>com.intellij.modules.json</depends>
<extensions defaultExtensionNs="com.intellij">
<postStartupActivity implementation="wu.seal.jsontokotlin.JsonToKotlinApplication"/>
</extensions>
Expand Down

0 comments on commit 0b0ed5b

Please sign in to comment.