diff --git a/build.gradle b/build.gradle deleted file mode 100644 index e25a8db..0000000 --- a/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -plugins { - id 'java' - id 'org.jetbrains.kotlin.jvm' version "1.3.72" -// id "org.jetbrains.intellij" version "0.3.12" - id "org.jetbrains.intellij" version "0.4.21" -} - -group 'no.tornado' -version '1.7.18' - -repositories { - mavenCentral() -} - -intellij { - version '2020.1' // 2018.2 2018.3.6 2019.1.4, 2019.2, 2019.3.5 , 2020.1 - plugins = ['Kotlin','properties', 'java'] - patchPluginXml { - untilBuild = "" // Be forward compatible - // sinceBuild is inferred from the version above - } -} - -publishPlugin { - username publishUsername - password publishPassword -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..261f8b4 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,46 @@ +import org.jetbrains.intellij.tasks.RunIdeTask +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.intellij.tasks.PatchPluginXmlTask +import org.jetbrains.intellij.tasks.PublishTask + +plugins { + idea apply true + java + kotlin("jvm") version "1.4.0" + id("org.jetbrains.intellij") version "0.4.21" +} + +group = "no.tornado" +version = "1.7.20" + +val publishUsername: String by rootProject.extra +val publishPassword: String by rootProject.extra + +repositories { + mavenCentral() +} + +intellij { + version = "2020.2" + //updateSinceUntilBuild = false + setPlugins("java", "properties", "org.jetbrains.kotlin:1.4.0-release-IJ2020.2-1") +} + +tasks { + // withType { } + + withType { + username(publishUsername) + password(publishPassword) + } + + withType { + sourceCompatibility = "1.8" + targetCompatibility = "1.8" + } + + withType { + kotlinOptions.jvmTarget = "1.8" + } +} + diff --git a/gradle.properties b/gradle.properties index 6a62fe5..d08076b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ publishUsername="REPLACE_WITH_USERNAME" publishPassword="REPLACE_WITH_PASSWORD" -gradleVersion=4.10.2 +gradleVersion=6.5 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7dc503f..186b715 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/no/tornado/tornadofx/idea/TornadoFXConfigurable.java b/src/main/java/no/tornado/tornadofx/idea/TornadoFXConfigurable.java deleted file mode 100644 index b3041c2..0000000 --- a/src/main/java/no/tornado/tornadofx/idea/TornadoFXConfigurable.java +++ /dev/null @@ -1,109 +0,0 @@ -package no.tornado.tornadofx.idea; - -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.options.SearchableConfigurable; -import com.intellij.ui.HyperlinkAdapter; -import com.intellij.ui.HyperlinkLabel; -import no.tornado.tornadofx.idea.TornadoFXSettings; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import javax.swing.event.HyperlinkEvent; -import java.awt.*; -import java.io.IOException; -import java.net.URI; - -public class TornadoFXConfigurable implements SearchableConfigurable { - private TornadoFXSettings settings; - private ConfigUI ui; - - public TornadoFXConfigurable(TornadoFXSettings settings) { - this.settings = settings; - } - - @NotNull - @Override - public String getId() { - return getHelpTopic(); - } - - @Nullable - @Override - public Runnable enableSearch(String option) { - return null; - } - - @Nls - @Override - public String getDisplayName() { - return "TornadoFX"; - } - - @Nullable - @Override - public String getHelpTopic() { - return "preferences.TornadoFX"; - } - - @Override - public boolean isModified() { - return ui.isModified(settings); - } - - @Override - public void disposeUIResources() { - ui = null; - } - - @Override - public void apply() throws ConfigurationException { - ui.apply(settings); - } - - @Nullable - @Override - public JComponent createComponent() { - ui = new ConfigUI(); - return ui.mainPanel; - } - - @Override - public void reset() { - ui.reset(settings); - } - - public static class ConfigUI { - private JPanel mainPanel; - private JCheckBox alternativePropertySyntaxCheckbox; - private HyperlinkLabel propertySyntaxLink; - - public ConfigUI() { - propertySyntaxLink.setHyperlinkText("More"); - propertySyntaxLink.addHyperlinkListener(new HyperlinkAdapter() { - @Override - protected void hyperlinkActivated(HyperlinkEvent e) { - try { - Desktop.getDesktop().browse(URI.create("https://edvin.gitbooks.io/tornadofx-guide/content/part2/Property%20Delegates.html#alternative-property-syntax")); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - }); - } - - void reset(TornadoFXSettings settings) { - alternativePropertySyntaxCheckbox.setSelected(settings.getAlternativePropertySyntax()); - } - - void apply(TornadoFXSettings settings) { - settings.setAlternativePropertySyntax(alternativePropertySyntaxCheckbox.isSelected()); - } - - boolean isModified(TornadoFXSettings settings) { - return settings.getAlternativePropertySyntax() != alternativePropertySyntaxCheckbox.isSelected(); - } - - } -} diff --git a/src/main/kotlin/no/tornado/tornadofx/idea/TornadoFXConfigurable.kt b/src/main/kotlin/no/tornado/tornadofx/idea/TornadoFXConfigurable.kt new file mode 100644 index 0000000..ea3f6bf --- /dev/null +++ b/src/main/kotlin/no/tornado/tornadofx/idea/TornadoFXConfigurable.kt @@ -0,0 +1,72 @@ +package no.tornado.tornadofx.idea + +import com.intellij.openapi.options.SearchableConfigurable +import com.intellij.ui.HyperlinkAdapter +import com.intellij.ui.HyperlinkLabel +import java.awt.Desktop +import java.io.IOException +import java.net.URI +import javax.swing.JCheckBox +import javax.swing.JComponent +import javax.swing.JPanel +import javax.swing.event.HyperlinkEvent + +class TornadoFXConfigurable : SearchableConfigurable { + private val id = "preferences.TornadoFX" + private val displayName = "TornadoFX" + private val settings by lazy { TornadoFXSettings.getInstance() } + private var ui: ConfigUI? = null + + override fun createComponent(): JComponent? = ui?.mainPanel ?: ConfigUI().also { ui = it }.mainPanel + + override fun isModified(): Boolean = ui?.isModified(settings) ?: false + + override fun apply() { + ui?.apply(settings) + } + + override fun getDisplayName(): String = displayName + + override fun getId(): String = id + + override fun getHelpTopic(): String? = id + + override fun disposeUIResources() { + ui = null + } + + override fun reset() { + ui?.reset(settings) + } + + class ConfigUI { + internal var mainPanel: JPanel? = null + private var alternativePropertySyntaxCheckbox: JCheckBox? = null + private var propertySyntaxLink: HyperlinkLabel? = null + + fun reset(settings: TornadoFXSettings) { + alternativePropertySyntaxCheckbox!!.isSelected = settings.alternativePropertySyntax + } + + fun apply(settings: TornadoFXSettings) { + settings.alternativePropertySyntax = alternativePropertySyntaxCheckbox!!.isSelected + } + + fun isModified(settings: TornadoFXSettings): Boolean { + return settings.alternativePropertySyntax != alternativePropertySyntaxCheckbox!!.isSelected + } + + init { + propertySyntaxLink!!.setHyperlinkText("More") + propertySyntaxLink!!.addHyperlinkListener(object : HyperlinkAdapter() { + override fun hyperlinkActivated(e: HyperlinkEvent) { + try { + Desktop.getDesktop().browse(URI.create("https://edvin.gitbooks.io/tornadofx-guide/content/part2/Property%20Delegates.html#alternative-property-syntax")) + } catch (e1: IOException) { + e1.printStackTrace() + } + } + }) + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/no/tornado/tornadofx/idea/configurations/TornadoFXRunConfigurationProducer.kt b/src/main/kotlin/no/tornado/tornadofx/idea/configurations/TornadoFXRunConfigurationProducer.kt index d94564e..1b0492a 100644 --- a/src/main/kotlin/no/tornado/tornadofx/idea/configurations/TornadoFXRunConfigurationProducer.kt +++ b/src/main/kotlin/no/tornado/tornadofx/idea/configurations/TornadoFXRunConfigurationProducer.kt @@ -1,7 +1,10 @@ package no.tornado.tornadofx.idea.configurations import com.intellij.execution.actions.ConfigurationContext +import com.intellij.execution.actions.LazyRunConfigurationProducer import com.intellij.execution.actions.RunConfigurationProducer +import com.intellij.execution.configurations.ConfigurationFactory +import com.intellij.execution.configurations.runConfigurationType import com.intellij.openapi.util.Ref import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiElement @@ -13,7 +16,14 @@ import org.jetbrains.kotlin.idea.refactoring.memberInfo.qualifiedClassNameForRen import org.jetbrains.kotlin.idea.search.allScope import org.jetbrains.kotlin.psi.KtClass -class TornadoFXRunConfigurationProducer : RunConfigurationProducer(TornadoFXConfigurationType()){ +class TornadoFXRunConfigurationProducer : LazyRunConfigurationProducer() { + private val tornadoFXConfigurationType by lazy { runConfigurationType() } + + + override fun getConfigurationFactory(): ConfigurationFactory { + return tornadoFXConfigurationType.configurationFactories[0] + } + override fun setupConfigurationFromContext(configuration: TornadoFXConfiguration, context: ConfigurationContext, sourceElement: Ref): Boolean { val ktClass = sourceElement.get() as? KtClass ?: return false val psiFacade = JavaPsiFacade.getInstance(ktClass.project) diff --git a/src/main/kotlin/no/tornado/tornadofx/idea/facet/TornadoFXFacet.kt b/src/main/kotlin/no/tornado/tornadofx/idea/facet/TornadoFXFacet.kt index 505dec1..568ef6c 100644 --- a/src/main/kotlin/no/tornado/tornadofx/idea/facet/TornadoFXFacet.kt +++ b/src/main/kotlin/no/tornado/tornadofx/idea/facet/TornadoFXFacet.kt @@ -7,6 +7,9 @@ import com.intellij.openapi.module.Module import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer import com.intellij.psi.codeStyle.PackageEntry +import com.jetbrains.rd.util.string.print +import org.jetbrains.kotlin.daemon.common.experimental.log +import org.jetbrains.kotlin.idea.core.formatter.KotlinPackageEntry import org.jetbrains.kotlin.idea.formatter.kotlinCustomSettings import org.jetbrains.kotlin.idea.util.projectStructure.allModules @@ -43,9 +46,12 @@ class TornadoFXFacet( val codeStyleSettings = CodeStyle.getDefaultSettings() val settings = codeStyleSettings.kotlinCustomSettings if (!settings.PACKAGES_TO_USE_STAR_IMPORTS.contains("tornadofx")) { - settings.PACKAGES_TO_USE_STAR_IMPORTS.addEntry(PackageEntry(false, "tornadofx", false)) + // PackageEntry(false, "tornadofx", false) + val entry = KotlinPackageEntry("tornadofx", false) + settings.PACKAGES_TO_USE_STAR_IMPORTS.addEntry(entry) } } catch (ignored: Exception) { + ignored.printStackTrace() } } } \ No newline at end of file diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index dcc18db..4d7062c 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ no.tornado.tornadofx.idea TornadoFX - 1.7.18 + 1.7.20 SYSE Run configurations, templates, actions and intentions for TornadoFX. 1.7.20 2020-08-24 +
    +
  • Support kotlin 1.4
  • +
+

1.7.17.1 2018-10-01

  • General bug fix and compatibility release
  • @@ -23,7 +28,7 @@ org.jetbrains.kotlin com.intellij.properties - + @@ -77,7 +82,7 @@ - + @@ -107,6 +112,7 @@ description="Generate a new TornadoFX View" icon="/icons/action.png"> + diff --git a/src/main/resources/META-INF/pluginIcon.svg b/src/main/resources/META-INF/pluginIcon.svg new file mode 100644 index 0000000..ac2ea80 --- /dev/null +++ b/src/main/resources/META-INF/pluginIcon.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/META-INF/pluginIcon_dark.svg b/src/main/resources/META-INF/pluginIcon_dark.svg new file mode 100644 index 0000000..2554384 --- /dev/null +++ b/src/main/resources/META-INF/pluginIcon_dark.svg @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/projectTemplates/tornadofx-gradle-project-kts.zip b/src/main/resources/projectTemplates/tornadofx-gradle-project-kts.zip new file mode 100644 index 0000000..adc661f Binary files /dev/null and b/src/main/resources/projectTemplates/tornadofx-gradle-project-kts.zip differ diff --git a/src/main/resources/projectTemplates/tornadofx-gradle-project.zip b/src/main/resources/projectTemplates/tornadofx-gradle-project.zip new file mode 100644 index 0000000..22167c1 Binary files /dev/null and b/src/main/resources/projectTemplates/tornadofx-gradle-project.zip differ diff --git a/src/main/resources/projectTemplates/tornadofx-maven-osgi-ds-project.zip b/src/main/resources/projectTemplates/tornadofx-maven-osgi-ds-project.zip index a9dc24a..f9eee24 100644 Binary files a/src/main/resources/projectTemplates/tornadofx-maven-osgi-ds-project.zip and b/src/main/resources/projectTemplates/tornadofx-maven-osgi-ds-project.zip differ diff --git a/src/main/resources/projectTemplates/tornadofx-maven-osgi-project.zip b/src/main/resources/projectTemplates/tornadofx-maven-osgi-project.zip index 581496b..a32d9a3 100644 Binary files a/src/main/resources/projectTemplates/tornadofx-maven-osgi-project.zip and b/src/main/resources/projectTemplates/tornadofx-maven-osgi-project.zip differ diff --git a/src/main/resources/projectTemplates/tornadofx-maven-project.zip b/src/main/resources/projectTemplates/tornadofx-maven-project.zip index 7732457..5051dc0 100644 Binary files a/src/main/resources/projectTemplates/tornadofx-maven-project.zip and b/src/main/resources/projectTemplates/tornadofx-maven-project.zip differ diff --git a/template-projects/tornadofx-gradle-project-kts/build.gradle.kts b/template-projects/tornadofx-gradle-project-kts/build.gradle.kts index b303886..30ca866 100644 --- a/template-projects/tornadofx-gradle-project-kts/build.gradle.kts +++ b/template-projects/tornadofx-gradle-project-kts/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.3.72" + kotlin("jvm") version "1.4.0" application } group = "com.test" diff --git a/template-projects/tornadofx-gradle-project/build.gradle b/template-projects/tornadofx-gradle-project/build.gradle index 7f8b94d..a4dbd33 100644 --- a/template-projects/tornadofx-gradle-project/build.gradle +++ b/template-projects/tornadofx-gradle-project/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.jetbrains.kotlin.jvm' version '1.3.72' + id 'org.jetbrains.kotlin.jvm' version "1.4.0" id 'application' } group = 'com.test' diff --git a/template-projects/tornadofx-maven-osgi-ds-project/pom.xml b/template-projects/tornadofx-maven-osgi-ds-project/pom.xml index bdd1b08..af77920 100644 --- a/template-projects/tornadofx-maven-osgi-ds-project/pom.xml +++ b/template-projects/tornadofx-maven-osgi-ds-project/pom.xml @@ -11,8 +11,8 @@ bundle - 1.2.60 - 1.7.17 + 1.4.20 + 1.7.20 diff --git a/template-projects/tornadofx-maven-osgi-project/pom.xml b/template-projects/tornadofx-maven-osgi-project/pom.xml index 69d6a27..55e5c2a 100644 --- a/template-projects/tornadofx-maven-osgi-project/pom.xml +++ b/template-projects/tornadofx-maven-osgi-project/pom.xml @@ -12,8 +12,8 @@ bundle - 1.2.60 - 1.7.17 + 1.4.0 + 1.7.20 diff --git a/template-projects/tornadofx-maven-project/pom.xml b/template-projects/tornadofx-maven-project/pom.xml index 360aa63..547851f 100644 --- a/template-projects/tornadofx-maven-project/pom.xml +++ b/template-projects/tornadofx-maven-project/pom.xml @@ -10,8 +10,8 @@ jar - 1.2.60 - 1.7.17 + 1.4.0 + 1.7.20