Wizard: allow enabling new wizard in UI

This commit is contained in:
Ilya Kirillov
2020-01-23 13:16:15 +03:00
parent fa4cba341b
commit 3d6aa79f45
7 changed files with 34 additions and 18 deletions
@@ -14,6 +14,7 @@ import com.intellij.openapi.ui.Messages
import com.intellij.util.SystemProperties
import org.jetbrains.kotlin.idea.framework.KotlinModuleSettingStep
import org.jetbrains.kotlin.idea.framework.KotlinTemplatesFactory
import org.jetbrains.kotlin.idea.projectWizard.NewProjectWizardService
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.tools.projectWizard.core.Failure
@@ -1,13 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.tools.projectWizard.wizard
import com.intellij.openapi.util.registry.Registry
object NewProjectWizardService {
val isEnabled: Boolean
get() = Registry.`is`("kotlin.experimental.project.wizard", false)
}
@@ -129,10 +129,6 @@
restartRequired="false"/>
<fileEditorProvider implementation="org.jetbrains.kotlin.idea.scratch.ui.KtScratchFileEditorProvider"/>
<registryKey key="kotlin.experimental.project.wizard"
description="Use experimental project wizard for creating new Kotlin projects"
defaultValue="false"
restartRequired="false"/>
<moduleBuilder builderClass="org.jetbrains.kotlin.tools.projectWizard.wizard.NewProjectWizardModuleBuilder"/>
</extensions>
</idea-plugin>
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.idea.KotlinPluginUpdater
import org.jetbrains.kotlin.idea.KotlinPluginUtil
import org.jetbrains.kotlin.idea.PluginUpdateStatus
import org.jetbrains.kotlin.idea.configuration.ui.KotlinLanguageConfigurationForm
import org.jetbrains.kotlin.idea.projectWizard.NewProjectWizardService
import org.jetbrains.kotlin.j2k.J2kConverterExtension
import javax.swing.JComponent
@@ -65,11 +66,13 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
override fun isModified() =
form.useNewJ2kCheckBox.isSelected != J2kConverterExtension.isNewJ2k
|| form.useNewProjectWizardCheckBox.isSelected != NewProjectWizardService.isEnabled
override fun apply() {
// Selected channel is now saved automatically
J2kConverterExtension.isNewJ2k = form.useNewJ2kCheckBox.isSelected
NewProjectWizardService.isEnabled = form.useNewProjectWizardCheckBox.isSelected
}
private fun setInstalledVersion(installedVersion: String?, installingStatus: String?) {
@@ -79,6 +82,7 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
override fun createComponent(): JComponent? {
form.useNewJ2kCheckBox.isSelected = J2kConverterExtension.isNewJ2k
form.useNewProjectWizardCheckBox.isSelected = NewProjectWizardService.isEnabled
form.updateCheckProgressIcon.suspend()
form.updateCheckProgressIcon.setPaintPassiveIcon(false)
@@ -150,7 +150,7 @@
</component>
</children>
</grid>
<grid id="15a75" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="15a75" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="6" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
@@ -169,6 +169,14 @@
<text value="Use New Java to Kotlin Converter"/>
</properties>
</component>
<component id="8a05f" class="javax.swing.JCheckBox" binding="useNewProjectWizardCheckBox">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Use New Project Wizard"/>
</properties>
</component>
</children>
</grid>
<vspacer id="73440">
@@ -28,6 +28,7 @@ public class KotlinLanguageConfigurationForm {
private JPanel bundledCompilerVersionPanel;
private JTextPane compilerVersion;
public JCheckBox useNewJ2kCheckBox;
public JCheckBox useNewProjectWizardCheckBox;
public KotlinLanguageConfigurationForm() {
showVerifierDisabledStatus();
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.projectWizard
import com.intellij.ide.util.PropertiesComponent
object NewProjectWizardService {
private const val optionName = "kotlin.experimental.project.wizard"
private const val enabledByDefault = false
var isEnabled
get() = PropertiesComponent.getInstance().getBoolean(optionName, enabledByDefault)
set(value) {
PropertiesComponent.getInstance().setValue(optionName, value, enabledByDefault)
}
}