Minor. Reformat KotlinFacetEditorGeneralTab
This commit is contained in:
@@ -39,13 +39,13 @@ import javax.swing.border.EmptyBorder
|
|||||||
import kotlin.reflect.full.findAnnotation
|
import kotlin.reflect.full.findAnnotation
|
||||||
|
|
||||||
class KotlinFacetEditorGeneralTab(
|
class KotlinFacetEditorGeneralTab(
|
||||||
private val configuration: KotlinFacetConfiguration,
|
private val configuration: KotlinFacetConfiguration,
|
||||||
private val editorContext: FacetEditorContext,
|
private val editorContext: FacetEditorContext,
|
||||||
private val validatorsManager: FacetValidatorsManager
|
private val validatorsManager: FacetValidatorsManager
|
||||||
) : FacetEditorTab() {
|
) : FacetEditorTab() {
|
||||||
class EditorComponent(
|
class EditorComponent(
|
||||||
private val project: Project,
|
private val project: Project,
|
||||||
private val configuration: KotlinFacetConfiguration?
|
private val configuration: KotlinFacetConfiguration?
|
||||||
) : JPanel(BorderLayout()) {
|
) : JPanel(BorderLayout()) {
|
||||||
private val isMultiEditor: Boolean
|
private val isMultiEditor: Boolean
|
||||||
get() = configuration == null
|
get() = configuration == null
|
||||||
@@ -74,9 +74,9 @@ class KotlinFacetEditorGeneralTab(
|
|||||||
} else {
|
} else {
|
||||||
editableCommonArguments = configuration!!.settings.compilerArguments!!
|
editableCommonArguments = configuration!!.settings.compilerArguments!!
|
||||||
editableJvmArguments = editableCommonArguments as? K2JVMCompilerArguments
|
editableJvmArguments = editableCommonArguments as? K2JVMCompilerArguments
|
||||||
?: Kotlin2JvmCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as K2JVMCompilerArguments
|
?: Kotlin2JvmCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as K2JVMCompilerArguments
|
||||||
editableJsArguments = editableCommonArguments as? K2JSCompilerArguments
|
editableJsArguments = editableCommonArguments as? K2JSCompilerArguments
|
||||||
?: Kotlin2JsCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as K2JSCompilerArguments
|
?: Kotlin2JsCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as K2JSCompilerArguments
|
||||||
editableCompilerSettings = configuration.settings.compilerSettings!!
|
editableCompilerSettings = configuration.settings.compilerSettings!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ class KotlinFacetEditorGeneralTab(
|
|||||||
.flatMap { it.componentPlatforms }
|
.flatMap { it.componentPlatforms }
|
||||||
.distinct()
|
.distinct()
|
||||||
.sortedBy { it.platformName }
|
.sortedBy { it.platformName }
|
||||||
.associate { Pair(it, ThreeStateCheckBox(it.platformName).apply {isThirdStateEnabled = isMultiEditor} ) }
|
.associate { Pair(it, ThreeStateCheckBox(it.platformName).apply { isThirdStateEnabled = isMultiEditor }) }
|
||||||
projectSettingsLink = HoverHyperlinkLabel("Edit project settings").apply {
|
projectSettingsLink = HoverHyperlinkLabel("Edit project settings").apply {
|
||||||
addHyperlinkListener {
|
addHyperlinkListener {
|
||||||
ShowSettingsUtilImpl.showSettingsDialog(project, compilerConfigurable.id, "")
|
ShowSettingsUtilImpl.showSettingsDialog(project, compilerConfigurable.id, "")
|
||||||
@@ -116,19 +116,19 @@ class KotlinFacetEditorGeneralTab(
|
|||||||
this.isEnabled = false
|
this.isEnabled = false
|
||||||
}
|
}
|
||||||
val contentPanel = FormBuilder
|
val contentPanel = FormBuilder
|
||||||
.createFormBuilder()
|
.createFormBuilder()
|
||||||
.addComponent(JPanel(BorderLayout()).apply {
|
.addComponent(JPanel(BorderLayout()).apply {
|
||||||
add(useProjectSettingsCheckBox, BorderLayout.WEST)
|
add(useProjectSettingsCheckBox, BorderLayout.WEST)
|
||||||
add(projectSettingsLink, BorderLayout.EAST)
|
add(projectSettingsLink, BorderLayout.EAST)
|
||||||
}).addLabeledComponent("Selected target platforms:", targetPlatformsPanel)
|
}).addLabeledComponent("Selected target platforms:", targetPlatformsPanel)
|
||||||
.addLabeledComponent("HMPP enabled:", hmppCheckbox)
|
.addLabeledComponent("HMPP enabled:", hmppCheckbox)
|
||||||
.addComponent(compilerConfigurable.createComponent()!!.apply {
|
.addComponent(compilerConfigurable.createComponent()!!.apply {
|
||||||
border = null
|
border = null
|
||||||
})
|
})
|
||||||
.panel
|
.panel
|
||||||
.apply {
|
.apply {
|
||||||
border = EmptyBorder(10, 10, 10, 10)
|
border = EmptyBorder(10, 10, 10, 10)
|
||||||
}
|
}
|
||||||
add(contentPanel, BorderLayout.NORTH)
|
add(contentPanel, BorderLayout.NORTH)
|
||||||
|
|
||||||
useProjectSettingsCheckBox.addActionListener {
|
useProjectSettingsCheckBox.addActionListener {
|
||||||
@@ -147,12 +147,14 @@ class KotlinFacetEditorGeneralTab(
|
|||||||
compilerConfigurable.setTargetPlatform(getChosenPlatform()?.idePlatformKind)
|
compilerConfigurable.setTargetPlatform(getChosenPlatform()?.idePlatformKind)
|
||||||
compilerConfigurable.setEnabled(!useProjectSettings)
|
compilerConfigurable.setEnabled(!useProjectSettings)
|
||||||
if (useProjectSettings) {
|
if (useProjectSettings) {
|
||||||
compilerConfigurable.commonCompilerArguments = KotlinCommonCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as CommonCompilerArguments?
|
compilerConfigurable.commonCompilerArguments =
|
||||||
compilerConfigurable.k2jvmCompilerArguments = Kotlin2JvmCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as K2JVMCompilerArguments?
|
KotlinCommonCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as CommonCompilerArguments?
|
||||||
compilerConfigurable.k2jsCompilerArguments = Kotlin2JsCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as K2JSCompilerArguments?
|
compilerConfigurable.k2jvmCompilerArguments =
|
||||||
|
Kotlin2JvmCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as K2JVMCompilerArguments?
|
||||||
|
compilerConfigurable.k2jsCompilerArguments =
|
||||||
|
Kotlin2JsCompilerArgumentsHolder.getInstance(project).settings.unfrozen() as K2JSCompilerArguments?
|
||||||
compilerConfigurable.compilerSettings = KotlinCompilerSettings.getInstance(project).settings.unfrozen() as CompilerSettings?
|
compilerConfigurable.compilerSettings = KotlinCompilerSettings.getInstance(project).settings.unfrozen() as CompilerSettings?
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
compilerConfigurable.commonCompilerArguments = editableCommonArguments
|
compilerConfigurable.commonCompilerArguments = editableCommonArguments
|
||||||
compilerConfigurable.k2jvmCompilerArguments = editableJvmArguments
|
compilerConfigurable.k2jvmCompilerArguments = editableJvmArguments
|
||||||
compilerConfigurable.k2jsCompilerArguments = editableJsArguments
|
compilerConfigurable.k2jsCompilerArguments = editableJsArguments
|
||||||
@@ -172,10 +174,10 @@ class KotlinFacetEditorGeneralTab(
|
|||||||
val platform = editor.getChosenPlatform() ?: return ValidationResult("At least one target platform should be selected")
|
val platform = editor.getChosenPlatform() ?: return ValidationResult("At least one target platform should be selected")
|
||||||
val primaryArguments = platform.createArguments {
|
val primaryArguments = platform.createArguments {
|
||||||
editor.compilerConfigurable.applyTo(
|
editor.compilerConfigurable.applyTo(
|
||||||
this,
|
this,
|
||||||
this as? K2JVMCompilerArguments ?: K2JVMCompilerArguments(),
|
this as? K2JVMCompilerArguments ?: K2JVMCompilerArguments(),
|
||||||
this as? K2JSCompilerArguments ?: K2JSCompilerArguments(),
|
this as? K2JSCompilerArguments ?: K2JSCompilerArguments(),
|
||||||
CompilerSettings()
|
CompilerSettings()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val argumentClass = primaryArguments.javaClass
|
val argumentClass = primaryArguments.javaClass
|
||||||
@@ -358,4 +360,5 @@ class KotlinFacetEditorGeneralTab(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val <T> ComboBox<T>.selectedItemTyped: T? get() = selectedItem as T?
|
val <T> ComboBox<T>.selectedItemTyped: T?
|
||||||
|
get() = selectedItem as T?
|
||||||
|
|||||||
Reference in New Issue
Block a user