Move two continuation indent wrapping options to wrapping page

This commit is contained in:
Dmitry Jemerov
2017-11-30 16:22:28 +01:00
parent dc4e673fb1
commit 3038f87105
2 changed files with 8 additions and 14 deletions
@@ -24,49 +24,35 @@ import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings
import javax.swing.JCheckBox
class KotlinIndentOptionsEditor : SmartIndentOptionsEditor() {
private val useContinuationIndentInParameterList = JCheckBox("Use continuation indent in parameter lists")
private val useContinuationIndentForExpressionBodies = JCheckBox("Use continuation indent for expression bodies")
private val useContinuationIndentForChainedCalls = JCheckBox("Use continuation indent for chained calls")
override fun addComponents() {
super.addComponents()
add(useContinuationIndentInParameterList)
add(useContinuationIndentForExpressionBodies)
add(useContinuationIndentForChainedCalls)
}
override fun isModified(settings: CodeStyleSettings, options: CommonCodeStyleSettings.IndentOptions): Boolean {
var isModified = super.isModified(settings, options)
val kotlinSettings = settings.kotlinCustomSettings
isModified = isModified || IndentOptionsEditor.isFieldModified(useContinuationIndentInParameterList,
kotlinSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS)
isModified = isModified || IndentOptionsEditor.isFieldModified(useContinuationIndentForExpressionBodies,
kotlinSettings.CONTINUATION_INDENT_FOR_EXPRESSION_BODIES)
isModified = isModified || IndentOptionsEditor.isFieldModified(useContinuationIndentForChainedCalls,
kotlinSettings.CONTINUATION_INDENT_FOR_CHAINED_CALLS)
return isModified
}
override fun apply(settings: CodeStyleSettings, options: CommonCodeStyleSettings.IndentOptions) {
super.apply(settings, options)
val kotlinSettings = settings.getCustomSettings(KotlinCodeStyleSettings::class.java)
kotlinSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS = useContinuationIndentInParameterList.isSelected
kotlinSettings.CONTINUATION_INDENT_FOR_EXPRESSION_BODIES = useContinuationIndentForExpressionBodies.isSelected
kotlinSettings.CONTINUATION_INDENT_FOR_CHAINED_CALLS = useContinuationIndentForChainedCalls.isSelected
}
override fun reset(settings: CodeStyleSettings, options: CommonCodeStyleSettings.IndentOptions) {
super.reset(settings, options)
val kotlinSettings = settings.getCustomSettings(KotlinCodeStyleSettings::class.java)
useContinuationIndentInParameterList.isSelected = kotlinSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS
useContinuationIndentForExpressionBodies.isSelected = kotlinSettings.CONTINUATION_INDENT_FOR_EXPRESSION_BODIES
useContinuationIndentForChainedCalls.isSelected = kotlinSettings.CONTINUATION_INDENT_FOR_CHAINED_CALLS
}
override fun setEnabled(enabled: Boolean) {
super.setEnabled(enabled)
useContinuationIndentInParameterList.isEnabled = enabled
useContinuationIndentForExpressionBodies.isEnabled = enabled
useContinuationIndentForChainedCalls.isEnabled = enabled
}
}
@@ -269,6 +269,14 @@ class KotlinLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvide
"Put left brace on new line",
CodeStyleSettingsCustomizable.WRAPPING_BRACES)
showCustomOption(
KotlinCodeStyleSettings::CONTINUATION_INDENT_IN_PARAMETER_LISTS,
"Use continuation indent",
CodeStyleSettingsCustomizable.WRAPPING_METHOD_PARAMETERS)
showCustomOption(
KotlinCodeStyleSettings::CONTINUATION_INDENT_FOR_CHAINED_CALLS,
"Use continuation indent",
CodeStyleSettingsCustomizable.WRAPPING_CALL_CHAIN)
showCustomOption(
KotlinCodeStyleSettings::CONTINUATION_INDENT_IN_SUPERTYPE_LISTS,
"Use continuation indent",