Wizard: allow enabling new wizard in UI
This commit is contained in:
+1
@@ -14,6 +14,7 @@ import com.intellij.openapi.ui.Messages
|
|||||||
import com.intellij.util.SystemProperties
|
import com.intellij.util.SystemProperties
|
||||||
import org.jetbrains.kotlin.idea.framework.KotlinModuleSettingStep
|
import org.jetbrains.kotlin.idea.framework.KotlinModuleSettingStep
|
||||||
import org.jetbrains.kotlin.idea.framework.KotlinTemplatesFactory
|
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.idea.util.application.runWriteAction
|
||||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.core.Failure
|
import org.jetbrains.kotlin.tools.projectWizard.core.Failure
|
||||||
|
|||||||
-13
@@ -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"/>
|
restartRequired="false"/>
|
||||||
<fileEditorProvider implementation="org.jetbrains.kotlin.idea.scratch.ui.KtScratchFileEditorProvider"/>
|
<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"/>
|
<moduleBuilder builderClass="org.jetbrains.kotlin.tools.projectWizard.wizard.NewProjectWizardModuleBuilder"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.idea.KotlinPluginUpdater
|
|||||||
import org.jetbrains.kotlin.idea.KotlinPluginUtil
|
import org.jetbrains.kotlin.idea.KotlinPluginUtil
|
||||||
import org.jetbrains.kotlin.idea.PluginUpdateStatus
|
import org.jetbrains.kotlin.idea.PluginUpdateStatus
|
||||||
import org.jetbrains.kotlin.idea.configuration.ui.KotlinLanguageConfigurationForm
|
import org.jetbrains.kotlin.idea.configuration.ui.KotlinLanguageConfigurationForm
|
||||||
|
import org.jetbrains.kotlin.idea.projectWizard.NewProjectWizardService
|
||||||
import org.jetbrains.kotlin.j2k.J2kConverterExtension
|
import org.jetbrains.kotlin.j2k.J2kConverterExtension
|
||||||
import javax.swing.JComponent
|
import javax.swing.JComponent
|
||||||
|
|
||||||
@@ -65,11 +66,13 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
|
|||||||
|
|
||||||
override fun isModified() =
|
override fun isModified() =
|
||||||
form.useNewJ2kCheckBox.isSelected != J2kConverterExtension.isNewJ2k
|
form.useNewJ2kCheckBox.isSelected != J2kConverterExtension.isNewJ2k
|
||||||
|
|| form.useNewProjectWizardCheckBox.isSelected != NewProjectWizardService.isEnabled
|
||||||
|
|
||||||
override fun apply() {
|
override fun apply() {
|
||||||
// Selected channel is now saved automatically
|
// Selected channel is now saved automatically
|
||||||
|
|
||||||
J2kConverterExtension.isNewJ2k = form.useNewJ2kCheckBox.isSelected
|
J2kConverterExtension.isNewJ2k = form.useNewJ2kCheckBox.isSelected
|
||||||
|
NewProjectWizardService.isEnabled = form.useNewProjectWizardCheckBox.isSelected
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setInstalledVersion(installedVersion: String?, installingStatus: String?) {
|
private fun setInstalledVersion(installedVersion: String?, installingStatus: String?) {
|
||||||
@@ -79,6 +82,7 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
|
|||||||
|
|
||||||
override fun createComponent(): JComponent? {
|
override fun createComponent(): JComponent? {
|
||||||
form.useNewJ2kCheckBox.isSelected = J2kConverterExtension.isNewJ2k
|
form.useNewJ2kCheckBox.isSelected = J2kConverterExtension.isNewJ2k
|
||||||
|
form.useNewProjectWizardCheckBox.isSelected = NewProjectWizardService.isEnabled
|
||||||
form.updateCheckProgressIcon.suspend()
|
form.updateCheckProgressIcon.suspend()
|
||||||
form.updateCheckProgressIcon.setPaintPassiveIcon(false)
|
form.updateCheckProgressIcon.setPaintPassiveIcon(false)
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -150,7 +150,7 @@
|
|||||||
</component>
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</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"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<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"/>
|
<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"/>
|
<text value="Use New Java to Kotlin Converter"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</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>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
<vspacer id="73440">
|
<vspacer id="73440">
|
||||||
|
|||||||
+1
@@ -28,6 +28,7 @@ public class KotlinLanguageConfigurationForm {
|
|||||||
private JPanel bundledCompilerVersionPanel;
|
private JPanel bundledCompilerVersionPanel;
|
||||||
private JTextPane compilerVersion;
|
private JTextPane compilerVersion;
|
||||||
public JCheckBox useNewJ2kCheckBox;
|
public JCheckBox useNewJ2kCheckBox;
|
||||||
|
public JCheckBox useNewProjectWizardCheckBox;
|
||||||
|
|
||||||
public KotlinLanguageConfigurationForm() {
|
public KotlinLanguageConfigurationForm() {
|
||||||
showVerifierDisabledStatus();
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user