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
|
||||
|
||||
abstract class SubStep(
|
||||
val readingContext: ReadingContext
|
||||
readingContext: ReadingContext
|
||||
) : DynamicComponent(readingContext) {
|
||||
protected abstract fun buildContent(): JComponent
|
||||
|
||||
|
||||
+4
-3
@@ -57,7 +57,7 @@ class TemplatesSubStep(readingContext: ReadingContext) :
|
||||
}
|
||||
read {
|
||||
allModules().forEach { module ->
|
||||
module.apply { initDefaultValuesForSettings(readingContext.context) }
|
||||
module.apply { initDefaultValuesForSettings() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,8 +70,9 @@ class TemplatesSubStep(readingContext: ReadingContext) :
|
||||
module.subModules.forEach(::addModule)
|
||||
}
|
||||
|
||||
readingContext.context.settingContext[KotlinPlugin::modules.reference]
|
||||
?.forEach(::addModule)
|
||||
read {
|
||||
KotlinPlugin::modules.reference.notRequiredSettingValue
|
||||
}?.forEach(::addModule)
|
||||
|
||||
return modules
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
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.tools.projectWizard.core.ReadingContext
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.entity.ValidationResult
|
||||
@@ -63,7 +64,7 @@ class ModuleSettingsSubStep(
|
||||
uiEditorUsagesStats: UiEditorUsageStats
|
||||
) : SubStep(wizard.valuesReadingContext) {
|
||||
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 panel = panel {
|
||||
|
||||
+2
-2
@@ -84,7 +84,7 @@ class TemplatesComponent(
|
||||
}
|
||||
|
||||
class ChooseTemplateComponent(
|
||||
private val readingContext: ReadingContext,
|
||||
readingContext: ReadingContext,
|
||||
private val onTemplateChosen: (Template) -> Unit
|
||||
) : DynamicComponent(readingContext) {
|
||||
private enum class State(val text: String) {
|
||||
@@ -105,7 +105,7 @@ class ChooseTemplateComponent(
|
||||
}
|
||||
|
||||
private val allTemplates
|
||||
get() = with(readingContext) {
|
||||
get() = read {
|
||||
TemplatesPlugin::templates.propertyValue
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ class TargetsModel(
|
||||
fun add(module: Module) {
|
||||
uiEditorUsagesStats.modulesCreated++
|
||||
with(readingContext) {
|
||||
module.apply { initDefaultValuesForSettings(context) }
|
||||
module.apply { initDefaultValuesForSettings() }
|
||||
}
|
||||
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>>(
|
||||
val reference: SettingReference<V, T>,
|
||||
val readingContext: ReadingContext
|
||||
private val readingContext: ReadingContext
|
||||
) : DynamicComponent(readingContext), Displayable, FocusableComponent {
|
||||
var value: V?
|
||||
get() = reference.value
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ class Module(
|
||||
else -> "Module"
|
||||
}
|
||||
|
||||
fun ReadingContext.initDefaultValuesForSettings(context: Context) {
|
||||
fun ReadingContext.initDefaultValuesForSettings() {
|
||||
configurator.safeAs<ModuleConfiguratorWithSettings>()?.initDefaultValuesFor(this@Module, context)
|
||||
template?.apply { initDefaultValuesFor(this@Module, context) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user