本文整理汇总了Java中com.intellij.psi.codeStyle.CommonCodeStyleSettings.WRAP_ALWAYS属性的典型用法代码示例。如果您正苦于以下问题:Java CommonCodeStyleSettings.WRAP_ALWAYS属性的具体用法?Java CommonCodeStyleSettings.WRAP_ALWAYS怎么用?Java CommonCodeStyleSettings.WRAP_ALWAYS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.psi.codeStyle.CommonCodeStyleSettings
的用法示例。
在下文中一共展示了CommonCodeStyleSettings.WRAP_ALWAYS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testArrayInitializer
public void testArrayInitializer() throws IncorrectOperationException {
// Inspired by IDEADEV-6787
getSettings().ARRAY_INITIALIZER_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
getSettings().ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE = true;
getSettings().ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE = true;
doTextTest(
"public @interface Ann\n" +
"{\n" +
"int[] x = { 1, 2 };\n" +
"\n" +
"Mode[] modes () default { @Mode(value = 1), @Mode(value = 2) };\n" +
"}",
"public @interface Ann {\n" +
" int[] x = {\n" +
" 1,\n" +
" 2\n" +
" };\n" +
"\n" +
" Mode[] modes() default {\n" +
" @Mode(value = 1),\n" +
" @Mode(value = 2)\n" +
" };\n" +
"}"
);
}
示例2: test_LParen_OnNextLine_IfWrapped
public void test_LParen_OnNextLine_IfWrapped() {
getSettings().CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
getSettings().CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = true;
doMethodTest("fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"cccccccccccccc\");",
"fuun(\n" +
" \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" +
" \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n" +
" \"cccccccccccccc\");");
getSettings().CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = false;
doMethodTest("fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"cccccccccccccc\");",
"fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" +
" \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n" +
" \"cccccccccccccc\");");
}
示例3: test_RParen_OnNextLine_IfWrapped
public void test_RParen_OnNextLine_IfWrapped() {
getSettings().CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
getSettings().CALL_PARAMETERS_RPAREN_ON_NEXT_LINE = true;
doMethodTest("fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"cccccccccccccc\");",
"fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" +
" \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n" +
" \"cccccccccccccc\"" +
"\n);");
getSettings().CALL_PARAMETERS_RPAREN_ON_NEXT_LINE = false;
doMethodTest("fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"cccccccccccccc\");",
"fuun(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n" +
" \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n" +
" \"cccccccccccccc\");");
}
示例4: getWrapType
@NotNull
public static WrapType getWrapType(int wrap) {
switch (wrap) {
case CommonCodeStyleSettings.WRAP_ALWAYS:
return WrapType.ALWAYS;
case CommonCodeStyleSettings.WRAP_AS_NEEDED:
return WrapType.NORMAL;
case CommonCodeStyleSettings.DO_NOT_WRAP:
return WrapType.NONE;
default:
return WrapType.CHOP_DOWN_IF_LONG;
}
}
示例5: testLabel1
public void testLabel1() throws Exception {
CommonCodeStyleSettings settings = getSettings();
settings.LABELED_STATEMENT_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
settings.getRootSettings().getIndentOptions(StdFileTypes.JAVA).LABEL_INDENT_ABSOLUTE = true;
settings.getRootSettings().getIndentOptions(StdFileTypes.JAVA).LABEL_INDENT_SIZE = 0;
doTest("Label.java", "Label_after1.java");
}
示例6: testSCR970
public void testSCR970() throws Exception {
final CommonCodeStyleSettings settings = getSettings();
settings.THROWS_KEYWORD_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
settings.THROWS_LIST_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
settings.METHOD_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
doTest();
}
示例7: testArrayInitializer
public void testArrayInitializer() throws IncorrectOperationException {
// Inspired by IDEADEV-16136
getSettings().ARRAY_INITIALIZER_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
getSettings().ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = true;
doTextTest(
"@SuppressWarnings({\"UseOfSystemOutOrSystemErr\", \"AssignmentToCollectionOrArrayFieldFromParameter\", \"ReturnOfCollectionOrArrayField\"})\n" +
"public class Some {\n" +
"}",
"@SuppressWarnings({\"UseOfSystemOutOrSystemErr\",\n" +
" \"AssignmentToCollectionOrArrayFieldFromParameter\",\n" +
" \"ReturnOfCollectionOrArrayField\"})\n" +
"public class Some {\n" +
"}");
}
示例8: testChainedMethodCallsAfterFieldsChain_WithAlignment
public void testChainedMethodCallsAfterFieldsChain_WithAlignment() throws Exception {
getSettings().ALIGN_MULTILINE_CHAINED_METHODS = true;
getSettings().METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
doMethodTest(
"a.current.current.current.getThis().getThis().getThis();",
"a.current.current.current.getThis()\n" +
" .getThis()\n" +
" .getThis();"
);
doMethodTest(
"a.current.current.current.getThis().getThis().getThis().current.getThis().getThis().getThis().getThis();",
"a.current.current.current.getThis()\n" +
" .getThis()\n" +
" .getThis().current.getThis()\n" +
" .getThis()\n" +
" .getThis()\n" +
" .getThis();"
);
String onlyMethodCalls = "getThis().getThis().getThis();";
String formatedMethodCalls = "getThis().getThis()\n" +
" .getThis();";
doMethodTest(onlyMethodCalls, formatedMethodCalls);
}
示例9: testChainedMethodCallsAfterFieldsChain_WithoutAlignment
public void testChainedMethodCallsAfterFieldsChain_WithoutAlignment() throws Exception {
getSettings().ALIGN_MULTILINE_CHAINED_METHODS = false;
getSettings().METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
doMethodTest(
"a.current.current.current.getThis().getThis().getThis();",
"a.current.current.current.getThis()\n" +
" .getThis()\n" +
" .getThis();"
);
}
示例10: testIDEA123074
public void testIDEA123074() {
getSettings().CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
String before = "final GeoZone geoZone1 = new GeoZone(APPROACHING, new Polygon(point(\"0.0\", \"0.0\"), point(\"10.0\", \"0.0\")," +
"point(\"10.0\", \"10.0\"), point(\"0.0\", \"10.0\")));";
String after = "final GeoZone geoZone1 = new GeoZone(APPROACHING,\n" +
" new Polygon(point(\"0.0\",\n" +
" \"0.0\"),\n" +
" point(\"10.0\",\n" +
" \"0.0\"),\n" +
" point(\"10.0\",\n" +
" \"10.0\"),\n" +
" point(\"0.0\",\n" +
" \"10.0\")));";
doMethodTest(before, after);
}
示例11: testMethodAnnotationFollowedBySingleLineComment
public void testMethodAnnotationFollowedBySingleLineComment() {
// Inspired by IDEA-22808
getSettings().METHOD_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
String text =
"@Test//my_comment\n" +
"public void foo() {\n" +
"}";
// Expecting the code to be left as-is
doClassTest(text, text);
}
示例12: test_ChainedCalls_FirstOnNewLine
public void test_ChainedCalls_FirstOnNewLine() {
getSettings().METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
getSettings().WRAP_FIRST_METHOD_IN_CALL_CHAIN = true;
doMethodTest(
"obj.call().call().call().call();",
"obj\n" +
" .call()\n" +
" .call()\n" +
" .call()\n" +
" .call();"
);
doMethodTest(
"call().call().call().call();",
"call()\n" +
" .call()\n" +
" .call()\n" +
" .call();"
);
doMethodTest(
"nestedCall(call().call().call().call());",
"nestedCall(call()\n" +
" .call()\n" +
" .call()\n" +
" .call());"
);
}
示例13: test_ChainedCalls_NoWrapOnSingleCall
public void test_ChainedCalls_NoWrapOnSingleCall() {
getSettings().METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
getSettings().WRAP_FIRST_METHOD_IN_CALL_CHAIN = true;
doMethodTest(
"obj.call( )",
"obj.call()"
);
}
示例14: getWrapType
public static WrapType getWrapType(int setting) {
switch (setting) {
case CommonCodeStyleSettings.WRAP_ALWAYS:
return WrapType.ALWAYS;
case CommonCodeStyleSettings.WRAP_AS_NEEDED:
return WrapType.NORMAL;
case CommonCodeStyleSettings.DO_NOT_WRAP:
return WrapType.NONE;
default:
return WrapType.CHOP_DOWN_IF_LONG;
}
}
示例15: visitMethod
@Override
public void visitMethod(GrMethod method) {
if (myType1 == GroovyTokenTypes.mRPAREN && myType2 == GroovyElementTypes.THROW_CLAUSE) {
if (mySettings.THROWS_KEYWORD_WRAP == CommonCodeStyleSettings.WRAP_ALWAYS) {
createLF(true);
}
else {
createSpaceInCode(true);
}
}
else if (isOpenBlock(myType2)) {
PsiElement methodName = method.getNameIdentifier();
int dependencyStart = methodName == null ? myParent.getTextRange().getStartOffset() : methodName.getTextRange().getStartOffset();
createSpaceBeforeLBrace(mySettings.SPACE_BEFORE_METHOD_LBRACE, mySettings.METHOD_BRACE_STYLE,
new TextRange(dependencyStart, myChild1.getTextRange().getEndOffset()),
mySettings.KEEP_SIMPLE_METHODS_IN_ONE_LINE);
}
else if (myType2 == GroovyElementTypes.TYPE_PARAMETER_LIST) {
createSpaceInCode(true);
}
else {
processParentheses(GroovyTokenTypes.mLPAREN,
GroovyTokenTypes.mRPAREN,
mySettings.SPACE_WITHIN_METHOD_PARENTHESES,
mySettings.SPACE_WITHIN_EMPTY_METHOD_PARENTHESES,
mySettings.METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE,
mySettings.METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE);
}
}