Per-language code style settings, initial refactoring

This commit is contained in:
Rustam.Vishnyakov
2010-08-30 13:17:30 +04:00
parent 78581a303f
commit b3932df274
@@ -280,512 +280,6 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
return LINE_SEPARATOR != null ? LINE_SEPARATOR : ourSystemLineSeparator;
}
<<<<<<< HEAD
=======
/**
* Keep "if (..) ...;" (also while, for)
* Does not control "if (..) { .. }"
*/
public boolean KEEP_CONTROL_STATEMENT_IN_ONE_LINE = true;
//----------------- BRACES & INDENTS --------------------
/**
* <PRE>
* 1.
* if (..) {
* body;
* }
* 2.
* if (..)
* {
* body;
* }
* 3.
* if (..)
* {
* body;
* }
* 4.
* if (..)
* {
* body;
* }
* 5.
* if (long-condition-1 &&
* long-condition-2)
* {
* body;
* }
* if (short-condition) {
* body;
* }
* </PRE>
*/
public static final int END_OF_LINE = 1;
public static final int NEXT_LINE = 2;
public static final int NEXT_LINE_SHIFTED = 3;
public static final int NEXT_LINE_SHIFTED2 = 4;
public static final int NEXT_LINE_IF_WRAPPED = 5;
public int BRACE_STYLE = 1;
public int CLASS_BRACE_STYLE = 1;
public int METHOD_BRACE_STYLE = 1;
/**
* Defines if 'flying geese' style should be used for curly braces formatting, e.g. if we want to format code like
* <p/>
* <pre>
* class Test {
* {
* System.out.println();
* }
* }
* </pre>
* to
* <pre>
* class Test { {
* System.out.println();
* } }
* </pre>
*/
public boolean USE_FLYING_GEESE_BRACES = false;
/**
* Defines number of white spaces between curly braces in case of {@link #USE_FLYING_GEESE_BRACES 'flying geese'} style usage.
*/
public int FLYING_GEESE_BRACES_GAP = 1;
public boolean DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS = false;
/**
* <PRE>
* "}
* else"
* or
* "} else"
* </PRE>
*/
public boolean ELSE_ON_NEW_LINE = false;
/**
* <PRE>
* "}
* while"
* or
* "} while"
* </PRE>
*/
public boolean WHILE_ON_NEW_LINE = false;
/**
* <PRE>
* "}
* catch"
* or
* "} catch"
* </PRE>
*/
public boolean CATCH_ON_NEW_LINE = false;
/**
* <PRE>
* "}
* finally"
* or
* "} finally"
* </PRE>
*/
public boolean FINALLY_ON_NEW_LINE = false;
public boolean INDENT_CASE_FROM_SWITCH = true;
public boolean SPECIAL_ELSE_IF_TREATMENT = true;
/**
* Indicates if long sequence of chained method calls should be aligned.
* <p/>
* E.g. if statement like <code>'foo.bar().bar().bar();'</code> should be reformatted to the one below if,
* say, last <code>'bar()'</code> call exceeds right margin. The code looks as follows after reformatting
* if this property is <code>true</code>:
* <p/>
* <pre>
* foo.bar().bar()
* .bar();
* </pre>
*/
public boolean ALIGN_MULTILINE_CHAINED_METHODS = false;
public boolean ALIGN_MULTILINE_PARAMETERS = true;
public boolean ALIGN_MULTILINE_PARAMETERS_IN_CALLS = false;
public boolean ALIGN_MULTILINE_FOR = true;
public boolean INDENT_WHEN_CASES = true;
public boolean ALIGN_MULTILINE_BINARY_OPERATION = false;
public boolean ALIGN_MULTILINE_ASSIGNMENT = false;
public boolean ALIGN_MULTILINE_TERNARY_OPERATION = false;
public boolean ALIGN_MULTILINE_THROWS_LIST = false;
public boolean ALIGN_MULTILINE_EXTENDS_LIST = false;
public boolean ALIGN_MULTILINE_METHOD_BRACKETS = false;
public boolean ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = false;
public boolean ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = false;
//----------------- Group alignments ---------------
/**
* Specifies if subsequent fields declarations and initialisations should be aligned in columns like below:
* int start = 1;
* int end = 10;
*/
public boolean ALIGN_GROUP_FIELD_DECLARATIONS = false;
//----------------- BLANK LINES --------------------
/**
* Keep up to this amount of blank lines between declarations
*/
public int KEEP_BLANK_LINES_IN_DECLARATIONS = 2;
/**
* Keep up to this amount of blank lines in code
*/
public int KEEP_BLANK_LINES_IN_CODE = 2;
public int KEEP_BLANK_LINES_BEFORE_RBRACE = 2;
public int BLANK_LINES_BEFORE_PACKAGE = 0;
public int BLANK_LINES_AFTER_PACKAGE = 1;
public int BLANK_LINES_BEFORE_IMPORTS = 1;
public int BLANK_LINES_AFTER_IMPORTS = 1;
public int BLANK_LINES_AROUND_CLASS = 1;
public int BLANK_LINES_AROUND_FIELD = 0;
public int BLANK_LINES_AROUND_METHOD = 1;
public int BLANK_LINES_BEFORE_METHOD_BODY = 0;
public int BLANK_LINES_AROUND_FIELD_IN_INTERFACE = 0;
public int BLANK_LINES_AROUND_METHOD_IN_INTERFACE = 1;
public int BLANK_LINES_AFTER_CLASS_HEADER = 0;
public int BLANK_LINES_AFTER_ANONYMOUS_CLASS_HEADER = 0;
//public int BLANK_LINES_BETWEEN_CASE_BLOCKS;
//----------------- SPACES --------------------
/**
* Controls =, +=, -=, etc
*/
public boolean SPACE_AROUND_ASSIGNMENT_OPERATORS = true;
/**
* Controls &&, ||
*/
public boolean SPACE_AROUND_LOGICAL_OPERATORS = true;
/**
* Controls ==, !=
*/
public boolean SPACE_AROUND_EQUALITY_OPERATORS = true;
/**
* Controls <, >, <=, >=
*/
public boolean SPACE_AROUND_RELATIONAL_OPERATORS = true;
/**
* Controls &, |, ^
*/
public boolean SPACE_AROUND_BITWISE_OPERATORS = true;
/**
* Controls +, -
*/
public boolean SPACE_AROUND_ADDITIVE_OPERATORS = true;
/**
* Controls *, /, %
*/
public boolean SPACE_AROUND_MULTIPLICATIVE_OPERATORS = true;
/**
* Controls <<. >>, >>>
*/
public boolean SPACE_AROUND_SHIFT_OPERATORS = true;
public boolean SPACE_AROUND_UNARY_OPERATOR = false;
public boolean SPACE_AFTER_COMMA = true;
public boolean SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = true;
public boolean SPACE_BEFORE_COMMA = false;
public boolean SPACE_AFTER_SEMICOLON = true; // in for-statement
public boolean SPACE_BEFORE_SEMICOLON = false; // in for-statement
/**
* "( expr )"
* or
* "(expr)"
*/
public boolean SPACE_WITHIN_PARENTHESES = false;
/**
* "f( expr )"
* or
* "f(expr)"
*/
public boolean SPACE_WITHIN_METHOD_CALL_PARENTHESES = false;
/**
* "void f( int param )"
* or
* "void f(int param)"
*/
public boolean SPACE_WITHIN_METHOD_PARENTHESES = false;
/**
* "if( expr )"
* or
* "if(expr)"
*/
public boolean SPACE_WITHIN_IF_PARENTHESES = false;
/**
* "while( expr )"
* or
* "while(expr)"
*/
public boolean SPACE_WITHIN_WHILE_PARENTHESES = false;
/**
* "for( int i = 0; i < 10; i++ )"
* or
* "for(int i = 0; i < 10; i++)"
*/
public boolean SPACE_WITHIN_FOR_PARENTHESES = false;
/**
* "catch( Exception e )"
* or
* "catch(Exception e)"
*/
public boolean SPACE_WITHIN_CATCH_PARENTHESES = false;
/**
* "switch( expr )"
* or
* "switch(expr)"
*/
public boolean SPACE_WITHIN_SWITCH_PARENTHESES = false;
/**
* "synchronized( expr )"
* or
* "synchronized(expr)"
*/
public boolean SPACE_WITHIN_SYNCHRONIZED_PARENTHESES = false;
/**
* "( Type )expr"
* or
* "(Type)expr"
*/
public boolean SPACE_WITHIN_CAST_PARENTHESES = false;
/**
* "[ expr ]"
* or
* "[expr]"
*/
public boolean SPACE_WITHIN_BRACKETS = false;
/**
* "int X[] { 1, 3, 5 }"
* or
* "int X[] {1, 3, 5}"
*/
public boolean SPACE_WITHIN_ARRAY_INITIALIZER_BRACES = false;
public boolean SPACE_AFTER_TYPE_CAST = true;
/**
* "f (x)"
* or
* "f(x)"
*/
public boolean SPACE_BEFORE_METHOD_CALL_PARENTHESES = false;
/**
* "void f (int param)"
* or
* "void f(int param)"
*/
public boolean SPACE_BEFORE_METHOD_PARENTHESES = false;
/**
* "if (...)"
* or
* "if(...)"
*/
public boolean SPACE_BEFORE_IF_PARENTHESES = true;
/**
* "while (...)"
* or
* "while(...)"
*/
public boolean SPACE_BEFORE_WHILE_PARENTHESES = true;
/**
* "for (...)"
* or
* "for(...)"
*/
public boolean SPACE_BEFORE_FOR_PARENTHESES = true;
/**
* "catch (...)"
* or
* "catch(...)"
*/
public boolean SPACE_BEFORE_CATCH_PARENTHESES = true;
/**
* "switch (...)"
* or
* "switch(...)"
*/
public boolean SPACE_BEFORE_SWITCH_PARENTHESES = true;
/**
* "synchronized (...)"
* or
* "synchronized(...)"
*/
public boolean SPACE_BEFORE_SYNCHRONIZED_PARENTHESES = true;
/**
* "class A {"
* or
* "class A{"
*/
public boolean SPACE_BEFORE_CLASS_LBRACE = true;
/**
* "void f() {"
* or
* "void f(){"
*/
public boolean SPACE_BEFORE_METHOD_LBRACE = true;
/**
* "if (...) {"
* or
* "if (...){"
*/
public boolean SPACE_BEFORE_IF_LBRACE = true;
/**
* "else {"
* or
* "else{"
*/
public boolean SPACE_BEFORE_ELSE_LBRACE = true;
/**
* "while (...) {"
* or
* "while (...){"
*/
public boolean SPACE_BEFORE_WHILE_LBRACE = true;
/**
* "for (...) {"
* or
* "for (...){"
*/
public boolean SPACE_BEFORE_FOR_LBRACE = true;
/**
* "do {"
* or
* "do{"
*/
public boolean SPACE_BEFORE_DO_LBRACE = true;
/**
* "switch (...) {"
* or
* "switch (...){"
*/
public boolean SPACE_BEFORE_SWITCH_LBRACE = true;
/**
* "try {"
* or
* "try{"
*/
public boolean SPACE_BEFORE_TRY_LBRACE = true;
/**
* "catch (...) {"
* or
* "catch (...){"
*/
public boolean SPACE_BEFORE_CATCH_LBRACE = true;
/**
* "finally {"
* or
* "finally{"
*/
public boolean SPACE_BEFORE_FINALLY_LBRACE = true;
/**
* "synchronized (...) {"
* or
* "synchronized (...){"
*/
public boolean SPACE_BEFORE_SYNCHRONIZED_LBRACE = true;
/**
* "new int[] {"
* or
* "new int[]{"
*/
public boolean SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE = false;
/**
* "} else", "if()foo(); else"
* or
* "}else","if()foo();else"
*/
public boolean SPACE_BEFORE_ELSE_KEYWORD = true;
/**
* "} while", "do foo(); while"
* or
* "}while","do foo();while"
*/
public boolean SPACE_BEFORE_WHILE_KEYWORD = true;
/**
* "} catch"
* or
* "}catch"
*/
public boolean SPACE_BEFORE_CATCH_KEYWORD = true;
/**
* "} finally"
* or
* "}finally"
*/
public boolean SPACE_BEFORE_FINALLY_KEYWORD = true;
public boolean SPACE_BEFORE_QUEST = true;
public boolean SPACE_AFTER_QUEST = true;
public boolean SPACE_BEFORE_COLON = true;
public boolean SPACE_AFTER_COLON = true;
public boolean SPACE_BEFORE_TYPE_PARAMETER_LIST = false;
>>>>>>> 7d11c392903cca7d77d5fd7947cf2449fe834e18
//----------------- NAMING CONVENTIONS --------------------