mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Export wrap on typing property as boolean
This commit is contained in:
@@ -258,7 +258,8 @@
|
||||
"while_on_new_line": "false",
|
||||
"wrap_comments": "false",
|
||||
"wrap_first_method_in_call_chain": "false",
|
||||
"wrap_long_lines": "false"
|
||||
"wrap_long_lines": "false",
|
||||
"wrap_on_typing": "true"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -241,7 +241,8 @@
|
||||
"while_on_new_line": "false",
|
||||
"wrap_comments": "false",
|
||||
"wrap_first_method_in_call_chain": "false",
|
||||
"wrap_long_lines": "false"
|
||||
"wrap_long_lines": "false",
|
||||
"wrap_on_typing": "true"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -82,6 +82,7 @@ public class JavaCodeStyleSettingsTest extends CodeStyleTestCase {
|
||||
final CommonCodeStyleSettings commonJavaSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
|
||||
commonJavaSettings.METHOD_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
|
||||
commonJavaSettings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM;
|
||||
commonJavaSettings.WRAP_ON_TYPING = CommonCodeStyleSettings.WrapOnTyping.WRAP.intValue;
|
||||
final JavaCodeStyleSettings javaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);
|
||||
javaSettings.FIELD_NAME_PREFIX = "m_";
|
||||
javaSettings.STATIC_FIELD_NAME_SUFFIX = "_s";
|
||||
|
||||
+3
@@ -65,6 +65,9 @@ class PropertyAccessorFactory {
|
||||
}
|
||||
return new BooleanAccessor(codeStyleObject, myField);
|
||||
case INT:
|
||||
if ("WRAP_ON_TYPING".equals(myField.getName())) {
|
||||
return new WrapOnTypingAccessor(codeStyleObject, myField);
|
||||
}
|
||||
return new IntegerAccessor(codeStyleObject, myField);
|
||||
case STRING:
|
||||
CommaSeparatedValues annotation = myField.getAnnotation(CommaSeparatedValues.class);
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.application.options.codeStyle.properties;
|
||||
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class WrapOnTypingAccessor extends IntegerAccessor {
|
||||
WrapOnTypingAccessor(@NotNull Object object, @NotNull Field field) {
|
||||
super(object, field);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String toExternal(@NotNull Integer value) {
|
||||
return value == CommonCodeStyleSettings.WrapOnTyping.WRAP.intValue ? "true" : "false";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer fromExternal(@NotNull String str) {
|
||||
return "true".equalsIgnoreCase(str) ?
|
||||
CommonCodeStyleSettings.WrapOnTyping.WRAP.intValue :
|
||||
CommonCodeStyleSettings.WrapOnTyping.NO_WRAP.intValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user