Wizard: minor, not to use reading context directly in some places
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ import java.awt.BorderLayout
|
|||||||
import javax.swing.JComponent
|
import javax.swing.JComponent
|
||||||
|
|
||||||
abstract class SubStep(
|
abstract class SubStep(
|
||||||
val readingContext: ReadingContext
|
readingContext: ReadingContext
|
||||||
) : DynamicComponent(readingContext) {
|
) : DynamicComponent(readingContext) {
|
||||||
protected abstract fun buildContent(): JComponent
|
protected abstract fun buildContent(): JComponent
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -57,7 +57,7 @@ class TemplatesSubStep(readingContext: ReadingContext) :
|
|||||||
}
|
}
|
||||||
read {
|
read {
|
||||||
allModules().forEach { module ->
|
allModules().forEach { module ->
|
||||||
module.apply { initDefaultValuesForSettings(readingContext.context) }
|
module.apply { initDefaultValuesForSettings() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,8 +70,9 @@ class TemplatesSubStep(readingContext: ReadingContext) :
|
|||||||
module.subModules.forEach(::addModule)
|
module.subModules.forEach(::addModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
readingContext.context.settingContext[KotlinPlugin::modules.reference]
|
read {
|
||||||
?.forEach(::addModule)
|
KotlinPlugin::modules.reference.notRequiredSettingValue
|
||||||
|
}?.forEach(::addModule)
|
||||||
|
|
||||||
return modules
|
return modules
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
package org.jetbrains.kotlin.tools.projectWizard.wizard.ui.secondStep
|
package org.jetbrains.kotlin.tools.projectWizard.wizard.ui.secondStep
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.idea.debugger.readAction
|
||||||
import org.jetbrains.kotlin.idea.projectWizard.UiEditorUsageStats
|
import org.jetbrains.kotlin.idea.projectWizard.UiEditorUsageStats
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.core.ReadingContext
|
import org.jetbrains.kotlin.tools.projectWizard.core.ReadingContext
|
||||||
import org.jetbrains.kotlin.tools.projectWizard.core.entity.ValidationResult
|
import org.jetbrains.kotlin.tools.projectWizard.core.entity.ValidationResult
|
||||||
@@ -63,7 +64,7 @@ class ModuleSettingsSubStep(
|
|||||||
uiEditorUsagesStats: UiEditorUsageStats
|
uiEditorUsagesStats: UiEditorUsageStats
|
||||||
) : SubStep(wizard.valuesReadingContext) {
|
) : SubStep(wizard.valuesReadingContext) {
|
||||||
private val sourcesetSettingsComponent = SourcesetSettingsComponent(wizard.valuesReadingContext).asSubComponent()
|
private val sourcesetSettingsComponent = SourcesetSettingsComponent(wizard.valuesReadingContext).asSubComponent()
|
||||||
private val moduleSettingsComponent = ModuleSettingsComponent(readingContext, uiEditorUsagesStats).asSubComponent()
|
private val moduleSettingsComponent = ModuleSettingsComponent(wizard.valuesReadingContext, uiEditorUsagesStats).asSubComponent()
|
||||||
private val nothingSelectedComponent = NothingSelectedComponent().asSubComponent()
|
private val nothingSelectedComponent = NothingSelectedComponent().asSubComponent()
|
||||||
|
|
||||||
private val panel = panel {
|
private val panel = panel {
|
||||||
|
|||||||
+2
-2
@@ -84,7 +84,7 @@ class TemplatesComponent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ChooseTemplateComponent(
|
class ChooseTemplateComponent(
|
||||||
private val readingContext: ReadingContext,
|
readingContext: ReadingContext,
|
||||||
private val onTemplateChosen: (Template) -> Unit
|
private val onTemplateChosen: (Template) -> Unit
|
||||||
) : DynamicComponent(readingContext) {
|
) : DynamicComponent(readingContext) {
|
||||||
private enum class State(val text: String) {
|
private enum class State(val text: String) {
|
||||||
@@ -105,7 +105,7 @@ class ChooseTemplateComponent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val allTemplates
|
private val allTemplates
|
||||||
get() = with(readingContext) {
|
get() = read {
|
||||||
TemplatesPlugin::templates.propertyValue
|
TemplatesPlugin::templates.propertyValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ class TargetsModel(
|
|||||||
fun add(module: Module) {
|
fun add(module: Module) {
|
||||||
uiEditorUsagesStats.modulesCreated++
|
uiEditorUsagesStats.modulesCreated++
|
||||||
with(readingContext) {
|
with(readingContext) {
|
||||||
module.apply { initDefaultValuesForSettings(context) }
|
module.apply { initDefaultValuesForSettings() }
|
||||||
}
|
}
|
||||||
addToTheTree(module, modifyValue = true, parent = tree.selectedNode ?: root)
|
addToTheTree(module, modifyValue = true, parent = tree.selectedNode ?: root)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ import org.jetbrains.kotlin.tools.projectWizard.wizard.ui.FocusableComponent
|
|||||||
|
|
||||||
abstract class SettingComponent<V : Any, T: SettingType<V>>(
|
abstract class SettingComponent<V : Any, T: SettingType<V>>(
|
||||||
val reference: SettingReference<V, T>,
|
val reference: SettingReference<V, T>,
|
||||||
val readingContext: ReadingContext
|
private val readingContext: ReadingContext
|
||||||
) : DynamicComponent(readingContext), Displayable, FocusableComponent {
|
) : DynamicComponent(readingContext), Displayable, FocusableComponent {
|
||||||
var value: V?
|
var value: V?
|
||||||
get() = reference.value
|
get() = reference.value
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ class Module(
|
|||||||
else -> "Module"
|
else -> "Module"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ReadingContext.initDefaultValuesForSettings(context: Context) {
|
fun ReadingContext.initDefaultValuesForSettings() {
|
||||||
configurator.safeAs<ModuleConfiguratorWithSettings>()?.initDefaultValuesFor(this@Module, context)
|
configurator.safeAs<ModuleConfiguratorWithSettings>()?.initDefaultValuesFor(this@Module, context)
|
||||||
template?.apply { initDefaultValuesFor(this@Module, context) }
|
template?.apply { initDefaultValuesFor(this@Module, context) }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user