Lines 422-428
Link Here
|
422 |
|
422 |
|
423 |
if ((builder.realFragmentsSize() > 1 || fragmentsSize > 4) && numberOfParens == 0) { |
423 |
if ((builder.realFragmentsSize() > 1 || fragmentsSize > 4) && numberOfParens == 0) { |
424 |
this.scribe.printComment(); |
424 |
this.scribe.printComment(); |
425 |
Alignment binaryExpressionAlignment = this.scribe.createAlignment("binaryExpressionAlignment", this.preferences.alignment_for_binary_expression, Alignment.R_OUTERMOST, fragmentsSize, this.scribe.scanner.currentPosition); //$NON-NLS-1$ |
425 |
Alignment binaryExpressionAlignment = this.scribe.createAlignment( |
|
|
426 |
Alignment.BINARY_EXPRESSION, |
427 |
this.preferences.alignment_for_binary_expression, |
428 |
Alignment.R_OUTERMOST, |
429 |
fragmentsSize, |
430 |
this.scribe.scanner.currentPosition); |
426 |
this.scribe.enterAlignment(binaryExpressionAlignment); |
431 |
this.scribe.enterAlignment(binaryExpressionAlignment); |
427 |
boolean ok = false; |
432 |
boolean ok = false; |
428 |
ASTNode[] fragments = builder.fragments(); |
433 |
ASTNode[] fragments = builder.fragments(); |
Lines 590-596
Link Here
|
590 |
if (this.preferences.insert_space_after_assignment_operator) { |
595 |
if (this.preferences.insert_space_after_assignment_operator) { |
591 |
this.scribe.space(); |
596 |
this.scribe.space(); |
592 |
} |
597 |
} |
593 |
Alignment assignmentAlignment = this.scribe.createAlignment("fieldDeclarationAssignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_INNERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$ |
598 |
Alignment assignmentAlignment = this.scribe.createAlignment( |
|
|
599 |
Alignment.FIELD_DECLARATION_ASSIGNMENT, |
600 |
this.preferences.alignment_for_assignment, |
601 |
Alignment.R_INNERMOST, |
602 |
1, |
603 |
this.scribe.scanner.currentPosition); |
594 |
this.scribe.enterAlignment(assignmentAlignment); |
604 |
this.scribe.enterAlignment(assignmentAlignment); |
595 |
boolean ok = false; |
605 |
boolean ok = false; |
596 |
do { |
606 |
do { |
Lines 672-678
Link Here
|
672 |
final int multipleFieldDeclarationsLength = multiFieldDeclaration.declarations.length; |
682 |
final int multipleFieldDeclarationsLength = multiFieldDeclaration.declarations.length; |
673 |
|
683 |
|
674 |
Alignment multiFieldDeclarationsAlignment =this.scribe.createAlignment( |
684 |
Alignment multiFieldDeclarationsAlignment =this.scribe.createAlignment( |
675 |
"multiple_field",//$NON-NLS-1$ |
685 |
Alignment.MULTIPLE_FIELD, |
676 |
this.preferences.alignment_for_multiple_fields, |
686 |
this.preferences.alignment_for_multiple_fields, |
677 |
multipleFieldDeclarationsLength - 1, |
687 |
multipleFieldDeclarationsLength - 1, |
678 |
this.scribe.scanner.currentPosition); |
688 |
this.scribe.scanner.currentPosition); |
Lines 956-962
Link Here
|
956 |
final TypeReference superclass = typeDeclaration.superclass; |
966 |
final TypeReference superclass = typeDeclaration.superclass; |
957 |
if (superclass != null) { |
967 |
if (superclass != null) { |
958 |
Alignment superclassAlignment =this.scribe.createAlignment( |
968 |
Alignment superclassAlignment =this.scribe.createAlignment( |
959 |
"superclass", //$NON-NLS-1$ |
969 |
Alignment.SUPER_CLASS, |
960 |
this.preferences.alignment_for_superclass_in_type_declaration, |
970 |
this.preferences.alignment_for_superclass_in_type_declaration, |
961 |
2, |
971 |
2, |
962 |
this.scribe.scanner.currentPosition); |
972 |
this.scribe.scanner.currentPosition); |
Lines 994-1000
Link Here
|
994 |
} |
1004 |
} |
995 |
int superInterfaceLength = superInterfaces.length; |
1005 |
int superInterfaceLength = superInterfaces.length; |
996 |
Alignment interfaceAlignment =this.scribe.createAlignment( |
1006 |
Alignment interfaceAlignment =this.scribe.createAlignment( |
997 |
"superInterfaces",//$NON-NLS-1$ |
1007 |
Alignment.SUPER_INTERFACES, |
998 |
alignment_for_superinterfaces, |
1008 |
alignment_for_superinterfaces, |
999 |
superInterfaceLength+1, // implements token is first fragment |
1009 |
superInterfaceLength+1, // implements token is first fragment |
1000 |
this.scribe.scanner.currentPosition); |
1010 |
this.scribe.scanner.currentPosition); |
Lines 1087-1093
Link Here
|
1087 |
hasConstants = enumConstantsLength != 0; |
1097 |
hasConstants = enumConstantsLength != 0; |
1088 |
if (enumConstantsLength > 1) { |
1098 |
if (enumConstantsLength > 1) { |
1089 |
Alignment enumConstantsAlignment = this.scribe.createAlignment( |
1099 |
Alignment enumConstantsAlignment = this.scribe.createAlignment( |
1090 |
"enumConstants",//$NON-NLS-1$ |
1100 |
Alignment.ENUM_CONSTANTS, |
1091 |
this.preferences.alignment_for_enum_constants, |
1101 |
this.preferences.alignment_for_enum_constants, |
1092 |
enumConstantsLength, |
1102 |
enumConstantsLength, |
1093 |
this.scribe.scanner.currentPosition, |
1103 |
this.scribe.scanner.currentPosition, |
Lines 1318-1324
Link Here
|
1318 |
} |
1328 |
} |
1319 |
int argumentLength = arguments.length; |
1329 |
int argumentLength = arguments.length; |
1320 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1330 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1321 |
"messageArguments", //$NON-NLS-1$ |
1331 |
Alignment.MESSAGE_ARGUMENTS, |
1322 |
this.preferences.alignment_for_arguments_in_method_invocation, |
1332 |
this.preferences.alignment_for_arguments_in_method_invocation, |
1323 |
Alignment.R_OUTERMOST, |
1333 |
Alignment.R_OUTERMOST, |
1324 |
argumentLength, |
1334 |
argumentLength, |
Lines 1353-1369
Link Here
|
1353 |
} |
1363 |
} |
1354 |
startingPositionInCascade = 2; |
1364 |
startingPositionInCascade = 2; |
1355 |
} |
1365 |
} |
|
|
1366 |
int tieBreakRule = size-startingPositionInCascade > 2 ? Alignment.R_OUTERMOST : Alignment.R_INNERMOST; |
1356 |
Alignment cascadingMessageSendAlignment = |
1367 |
Alignment cascadingMessageSendAlignment = |
1357 |
this.scribe.createAlignment( |
1368 |
this.scribe.createAlignment( |
1358 |
"cascadingMessageSendAlignment", //$NON-NLS-1$ |
1369 |
Alignment.CASCADING_MESSAGE_SEND, |
1359 |
this.preferences.alignment_for_selector_in_method_invocation, |
1370 |
this.preferences.alignment_for_selector_in_method_invocation, |
1360 |
Alignment.R_INNERMOST, |
1371 |
tieBreakRule, |
1361 |
size, |
1372 |
size, |
1362 |
this.scribe.scanner.currentPosition); |
1373 |
this.scribe.scanner.currentPosition); |
1363 |
this.scribe.enterAlignment(cascadingMessageSendAlignment); |
1374 |
this.scribe.enterAlignment(cascadingMessageSendAlignment); |
1364 |
boolean ok = false; |
1375 |
boolean ok = false; |
1365 |
boolean setStartingColumn = startingPositionInCascade == 1; |
1376 |
boolean setStartingColumn = true; |
1366 |
switch (this.preferences.alignment_for_arguments_in_method_invocation) { |
1377 |
switch (this.preferences.alignment_for_arguments_in_method_invocation & Alignment.SPLIT_MASK) { |
1367 |
case Alignment.M_COMPACT_FIRST_BREAK_SPLIT: |
1378 |
case Alignment.M_COMPACT_FIRST_BREAK_SPLIT: |
1368 |
case Alignment.M_NEXT_SHIFTED_SPLIT: |
1379 |
case Alignment.M_NEXT_SHIFTED_SPLIT: |
1369 |
case Alignment.M_ONE_PER_LINE_SPLIT: |
1380 |
case Alignment.M_ONE_PER_LINE_SPLIT: |
Lines 1413-1427
Link Here
|
1413 |
this.scribe.space(); |
1424 |
this.scribe.space(); |
1414 |
} |
1425 |
} |
1415 |
int argumentLength = arguments.length; |
1426 |
int argumentLength = arguments.length; |
|
|
1427 |
int alignmentMode = this.preferences.alignment_for_arguments_in_method_invocation; |
1416 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1428 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1417 |
"messageArguments", //$NON-NLS-1$ |
1429 |
Alignment.MESSAGE_ARGUMENTS, |
1418 |
this.preferences.alignment_for_arguments_in_method_invocation, |
1430 |
alignmentMode, |
1419 |
Alignment.R_OUTERMOST, |
1431 |
Alignment.R_OUTERMOST, |
1420 |
argumentLength, |
1432 |
argumentLength, |
1421 |
this.scribe.scanner.currentPosition); |
1433 |
this.scribe.scanner.currentPosition); |
1422 |
this.scribe.enterAlignment(argumentsAlignment); |
1434 |
this.scribe.enterAlignment(argumentsAlignment); |
1423 |
boolean okForArguments = false; |
1435 |
boolean okForArguments = false; |
1424 |
do { |
1436 |
do { |
|
|
1437 |
switch (alignmentMode & Alignment.SPLIT_MASK) { |
1438 |
case Alignment.M_COMPACT_SPLIT: |
1439 |
case Alignment.M_NEXT_PER_LINE_SPLIT: |
1440 |
argumentsAlignment.startingColumn = this.scribe.column; |
1441 |
break; |
1442 |
} |
1425 |
try { |
1443 |
try { |
1426 |
for (int j = 0; j < argumentLength; j++) { |
1444 |
for (int j = 0; j < argumentLength; j++) { |
1427 |
if (j > 0) { |
1445 |
if (j > 0) { |
Lines 1429-1438
Link Here
|
1429 |
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT); |
1447 |
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT); |
1430 |
} |
1448 |
} |
1431 |
this.scribe.alignFragment(argumentsAlignment, j); |
1449 |
this.scribe.alignFragment(argumentsAlignment, j); |
1432 |
if (j > 0 && this.preferences.insert_space_after_comma_in_method_invocation_arguments) { |
1450 |
if (j == 0) { |
|
|
1451 |
int fragmentIndentation = argumentsAlignment.fragmentIndentations[j]; |
1452 |
if ((argumentsAlignment.mode & Alignment.M_INDENT_ON_COLUMN) != 0 && fragmentIndentation > 0) { |
1453 |
this.scribe.indentationLevel = fragmentIndentation; |
1454 |
} |
1455 |
} else if (this.preferences.insert_space_after_comma_in_method_invocation_arguments) { |
1433 |
this.scribe.space(); |
1456 |
this.scribe.space(); |
1434 |
} |
1457 |
} |
1435 |
arguments[j].traverse(this, scope); |
1458 |
arguments[j].traverse(this, scope); |
|
|
1459 |
argumentsAlignment.startingColumn = -1; |
1436 |
} |
1460 |
} |
1437 |
okForArguments = true; |
1461 |
okForArguments = true; |
1438 |
} catch (AlignmentException e) { |
1462 |
} catch (AlignmentException e) { |
Lines 1468-1474
Link Here
|
1468 |
final int FIELD = 1, METHOD = 2, TYPE = 3; |
1492 |
final int FIELD = 1, METHOD = 2, TYPE = 3; |
1469 |
this.scribe.lastNumberOfNewLines = 1; |
1493 |
this.scribe.lastNumberOfNewLines = 1; |
1470 |
ASTNode[] mergedNodes = computeMergedMemberDeclarations(nodes); |
1494 |
ASTNode[] mergedNodes = computeMergedMemberDeclarations(nodes); |
1471 |
Alignment memberAlignment = this.scribe.createMemberAlignment("typeMembers", this.preferences.align_type_members_on_columns ? Alignment.M_MULTICOLUMN : Alignment.M_NO_ALIGNMENT, 4, this.scribe.scanner.currentPosition); //$NON-NLS-1$ |
1495 |
Alignment memberAlignment = this.scribe.createMemberAlignment( |
|
|
1496 |
Alignment.TYPE_MEMBERS, |
1497 |
this.preferences.align_type_members_on_columns ? Alignment.M_MULTICOLUMN : Alignment.M_NO_ALIGNMENT, |
1498 |
4, |
1499 |
this.scribe.scanner.currentPosition); |
1472 |
this.scribe.enterMemberAlignment(memberAlignment); |
1500 |
this.scribe.enterMemberAlignment(memberAlignment); |
1473 |
boolean isChunkStart = false; |
1501 |
boolean isChunkStart = false; |
1474 |
boolean ok = false; |
1502 |
boolean ok = false; |
Lines 1612-1618
Link Here
|
1612 |
if (this.preferences.insert_space_after_assignment_operator) { |
1640 |
if (this.preferences.insert_space_after_assignment_operator) { |
1613 |
this.scribe.space(); |
1641 |
this.scribe.space(); |
1614 |
} |
1642 |
} |
1615 |
Alignment assignmentAlignment = this.scribe.createAlignment("localDeclarationAssignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_OUTERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$ |
1643 |
Alignment assignmentAlignment = this.scribe.createAlignment( |
|
|
1644 |
Alignment.LOCAL_DECLARATION_ASSIGNMENT, |
1645 |
this.preferences.alignment_for_assignment, |
1646 |
Alignment.R_OUTERMOST, |
1647 |
1, |
1648 |
this.scribe.scanner.currentPosition); |
1616 |
this.scribe.enterAlignment(assignmentAlignment); |
1649 |
this.scribe.enterAlignment(assignmentAlignment); |
1617 |
boolean ok = false; |
1650 |
boolean ok = false; |
1618 |
do { |
1651 |
do { |
Lines 1642-1650
Link Here
|
1642 |
Alignment messageAlignment) { |
1675 |
Alignment messageAlignment) { |
1643 |
|
1676 |
|
1644 |
if (messageAlignment != null) { |
1677 |
if (messageAlignment != null) { |
1645 |
this.scribe.alignFragment(messageAlignment, 0); |
1678 |
if (messageAlignment.canAlign()) { |
|
|
1679 |
this.scribe.alignFragment(messageAlignment, 0); |
1680 |
} |
1646 |
this.scribe.printNextToken(TerminalTokens.TokenNameDOT); |
1681 |
this.scribe.printNextToken(TerminalTokens.TokenNameDOT); |
1647 |
messageAlignment.startingColumn = -1; |
|
|
1648 |
} |
1682 |
} |
1649 |
TypeReference[] typeArguments = messageSend.typeArguments; |
1683 |
TypeReference[] typeArguments = messageSend.typeArguments; |
1650 |
if (typeArguments != null) { |
1684 |
if (typeArguments != null) { |
Lines 1678-1691
Link Here
|
1678 |
} |
1712 |
} |
1679 |
int argumentsLength = arguments.length; |
1713 |
int argumentsLength = arguments.length; |
1680 |
if (argumentsLength > 1) { |
1714 |
if (argumentsLength > 1) { |
|
|
1715 |
int alignmentMode = this.preferences.alignment_for_arguments_in_method_invocation; |
1681 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1716 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1682 |
"messageArguments", //$NON-NLS-1$ |
1717 |
Alignment.MESSAGE_ARGUMENTS, |
1683 |
this.preferences.alignment_for_arguments_in_method_invocation, |
1718 |
alignmentMode, |
1684 |
argumentsLength, |
1719 |
argumentsLength, |
1685 |
this.scribe.scanner.currentPosition); |
1720 |
this.scribe.scanner.currentPosition); |
1686 |
this.scribe.enterAlignment(argumentsAlignment); |
1721 |
this.scribe.enterAlignment(argumentsAlignment); |
1687 |
boolean ok = false; |
1722 |
boolean ok = false; |
1688 |
do { |
1723 |
do { |
|
|
1724 |
switch (alignmentMode & Alignment.SPLIT_MASK) { |
1725 |
case Alignment.M_COMPACT_SPLIT: |
1726 |
case Alignment.M_NEXT_PER_LINE_SPLIT: |
1727 |
argumentsAlignment.startingColumn = this.scribe.column; |
1728 |
break; |
1729 |
} |
1689 |
try { |
1730 |
try { |
1690 |
for (int i = 0; i < argumentsLength; i++) { |
1731 |
for (int i = 0; i < argumentsLength; i++) { |
1691 |
if (i > 0) { |
1732 |
if (i > 0) { |
Lines 1696-1702
Link Here
|
1696 |
if (i > 0 && this.preferences.insert_space_after_comma_in_method_invocation_arguments) { |
1737 |
if (i > 0 && this.preferences.insert_space_after_comma_in_method_invocation_arguments) { |
1697 |
this.scribe.space(); |
1738 |
this.scribe.space(); |
1698 |
} |
1739 |
} |
|
|
1740 |
int fragmentIndentation = 0; |
1741 |
if (i == 0) { |
1742 |
int wrappedIndex = argumentsAlignment.wrappedIndex(); |
1743 |
if (wrappedIndex >= 0) { |
1744 |
fragmentIndentation = argumentsAlignment.fragmentIndentations[wrappedIndex]; |
1745 |
if ((argumentsAlignment.mode & Alignment.M_INDENT_ON_COLUMN) != 0 && fragmentIndentation > 0) { |
1746 |
this.scribe.indentationLevel = fragmentIndentation; |
1747 |
} |
1748 |
} |
1749 |
} |
1699 |
arguments[i].traverse(this, scope); |
1750 |
arguments[i].traverse(this, scope); |
|
|
1751 |
argumentsAlignment.startingColumn = -1; |
1700 |
} |
1752 |
} |
1701 |
ok = true; |
1753 |
ok = true; |
1702 |
} catch (AlignmentException e) { |
1754 |
} catch (AlignmentException e) { |
Lines 1705-1720
Link Here
|
1705 |
} while (!ok); |
1757 |
} while (!ok); |
1706 |
this.scribe.exitAlignment(argumentsAlignment, true); |
1758 |
this.scribe.exitAlignment(argumentsAlignment, true); |
1707 |
} else { |
1759 |
} else { |
1708 |
for (int i = 0; i < argumentsLength; i++) { |
1760 |
arguments[0].traverse(this, scope); |
1709 |
if (i > 0) { |
|
|
1710 |
this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_method_invocation_arguments); |
1711 |
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT); |
1712 |
} |
1713 |
if (i > 0 && this.preferences.insert_space_after_comma_in_method_invocation_arguments) { |
1714 |
this.scribe.space(); |
1715 |
} |
1716 |
arguments[i].traverse(this, scope); |
1717 |
} |
1718 |
} |
1761 |
} |
1719 |
this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_method_invocation); |
1762 |
this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_method_invocation); |
1720 |
} else { |
1763 |
} else { |
Lines 1741-1753
Link Here
|
1741 |
} |
1784 |
} |
1742 |
int argumentLength = arguments.length; |
1785 |
int argumentLength = arguments.length; |
1743 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1786 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1744 |
"methodArguments",//$NON-NLS-1$ |
1787 |
Alignment.METHOD_ARGUMENTS, |
1745 |
methodDeclarationParametersAlignment, |
1788 |
methodDeclarationParametersAlignment, |
1746 |
argumentLength, |
1789 |
argumentLength, |
1747 |
this.scribe.scanner.currentPosition); |
1790 |
this.scribe.scanner.currentPosition); |
1748 |
this.scribe.enterAlignment(argumentsAlignment); |
1791 |
this.scribe.enterAlignment(argumentsAlignment); |
1749 |
boolean ok = false; |
1792 |
boolean ok = false; |
1750 |
do { |
1793 |
do { |
|
|
1794 |
switch (methodDeclarationParametersAlignment & Alignment.SPLIT_MASK) { |
1795 |
case Alignment.M_COMPACT_SPLIT: |
1796 |
case Alignment.M_NEXT_PER_LINE_SPLIT: |
1797 |
argumentsAlignment.startingColumn = this.scribe.column; |
1798 |
break; |
1799 |
} |
1751 |
try { |
1800 |
try { |
1752 |
for (int i = 0; i < argumentLength; i++) { |
1801 |
for (int i = 0; i < argumentLength; i++) { |
1753 |
if (i > 0) { |
1802 |
if (i > 0) { |
Lines 1755-1764
Link Here
|
1755 |
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT); |
1804 |
this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT); |
1756 |
} |
1805 |
} |
1757 |
this.scribe.alignFragment(argumentsAlignment, i); |
1806 |
this.scribe.alignFragment(argumentsAlignment, i); |
1758 |
if (i > 0 && spaceAfterComma) { |
1807 |
if (i == 0) { |
|
|
1808 |
int fragmentIndentation = argumentsAlignment.fragmentIndentations[0]; |
1809 |
if ((argumentsAlignment.mode & Alignment.M_INDENT_ON_COLUMN) != 0 && fragmentIndentation > 0) { |
1810 |
this.scribe.indentationLevel = fragmentIndentation; |
1811 |
} |
1812 |
} else if (spaceAfterComma) { |
1759 |
this.scribe.space(); |
1813 |
this.scribe.space(); |
1760 |
} |
1814 |
} |
1761 |
arguments[i].traverse(this, methodDeclaration.scope); |
1815 |
arguments[i].traverse(this, methodDeclaration.scope); |
|
|
1816 |
argumentsAlignment.startingColumn = -1; |
1762 |
} |
1817 |
} |
1763 |
ok = true; |
1818 |
ok = true; |
1764 |
} catch (AlignmentException e) { |
1819 |
} catch (AlignmentException e) { |
Lines 1792-1798
Link Here
|
1792 |
if (arguments != null) { |
1847 |
if (arguments != null) { |
1793 |
int argumentLength = arguments.length; |
1848 |
int argumentLength = arguments.length; |
1794 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1849 |
Alignment argumentsAlignment = this.scribe.createAlignment( |
1795 |
"enumConstantArguments",//$NON-NLS-1$ |
1850 |
Alignment.ENUM_CONSTANTS_ARGUMENTS, |
1796 |
methodDeclarationParametersAlignment, |
1851 |
methodDeclarationParametersAlignment, |
1797 |
argumentLength, |
1852 |
argumentLength, |
1798 |
this.scribe.scanner.currentPosition); |
1853 |
this.scribe.scanner.currentPosition); |
Lines 1930-1936
Link Here
|
1930 |
if (thrownExceptions != null) { |
1985 |
if (thrownExceptions != null) { |
1931 |
int thrownExceptionsLength = thrownExceptions.length; |
1986 |
int thrownExceptionsLength = thrownExceptions.length; |
1932 |
Alignment throwsAlignment = this.scribe.createAlignment( |
1987 |
Alignment throwsAlignment = this.scribe.createAlignment( |
1933 |
"throws",//$NON-NLS-1$ |
1988 |
Alignment.THROWS, |
1934 |
alignmentForThrowsClause, |
1989 |
alignmentForThrowsClause, |
1935 |
thrownExceptionsLength, // throws is the first token |
1990 |
thrownExceptionsLength, // throws is the first token |
1936 |
this.scribe.scanner.currentPosition); |
1991 |
this.scribe.scanner.currentPosition); |
Lines 1968-1974
Link Here
|
1968 |
* Merged traversal of member (types, fields, methods) |
2023 |
* Merged traversal of member (types, fields, methods) |
1969 |
*/ |
2024 |
*/ |
1970 |
private void formatTypeMembers(TypeDeclaration typeDeclaration) { |
2025 |
private void formatTypeMembers(TypeDeclaration typeDeclaration) { |
1971 |
Alignment memberAlignment = this.scribe.createMemberAlignment("typeMembers", this.preferences.align_type_members_on_columns ? Alignment.M_MULTICOLUMN : Alignment.M_NO_ALIGNMENT, 3, this.scribe.scanner.currentPosition); //$NON-NLS-1$ |
2026 |
Alignment memberAlignment = this.scribe.createMemberAlignment( |
|
|
2027 |
Alignment.TYPE_MEMBERS, |
2028 |
this.preferences.align_type_members_on_columns ? Alignment.M_MULTICOLUMN : Alignment.M_NO_ALIGNMENT, |
2029 |
3, |
2030 |
this.scribe.scanner.currentPosition); |
1972 |
this.scribe.enterMemberAlignment(memberAlignment); |
2031 |
this.scribe.enterMemberAlignment(memberAlignment); |
1973 |
ASTNode[] members = computeMergedMemberDeclarations(typeDeclaration); |
2032 |
ASTNode[] members = computeMergedMemberDeclarations(typeDeclaration); |
1974 |
boolean isChunkStart = false; |
2033 |
boolean isChunkStart = false; |
Lines 2329-2335
Link Here
|
2329 |
} |
2388 |
} |
2330 |
int argumentLength = arguments.length; |
2389 |
int argumentLength = arguments.length; |
2331 |
Alignment argumentsAlignment =this.scribe.createAlignment( |
2390 |
Alignment argumentsAlignment =this.scribe.createAlignment( |
2332 |
"allocation",//$NON-NLS-1$ |
2391 |
Alignment.ALLOCATION, |
2333 |
this.preferences.alignment_for_arguments_in_allocation_expression, |
2392 |
this.preferences.alignment_for_arguments_in_allocation_expression, |
2334 |
argumentLength, |
2393 |
argumentLength, |
2335 |
this.scribe.scanner.currentPosition); |
2394 |
this.scribe.scanner.currentPosition); |
Lines 2530-2536
Link Here
|
2530 |
this.scribe.printNewLine(); |
2589 |
this.scribe.printNewLine(); |
2531 |
} |
2590 |
} |
2532 |
Alignment arrayInitializerAlignment =this.scribe.createAlignment( |
2591 |
Alignment arrayInitializerAlignment =this.scribe.createAlignment( |
2533 |
"array_initializer",//$NON-NLS-1$ |
2592 |
Alignment.ARRAY_INITIALIZER, |
2534 |
this.preferences.alignment_for_expressions_in_array_initializer, |
2593 |
this.preferences.alignment_for_expressions_in_array_initializer, |
2535 |
Alignment.R_OUTERMOST, |
2594 |
Alignment.R_OUTERMOST, |
2536 |
expressionsLength, |
2595 |
expressionsLength, |
Lines 2803-2809
Link Here
|
2803 |
this.scribe.space(); |
2862 |
this.scribe.space(); |
2804 |
} |
2863 |
} |
2805 |
|
2864 |
|
2806 |
Alignment assignmentAlignment = this.scribe.createAlignment("assignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_OUTERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$ |
2865 |
Alignment assignmentAlignment = this.scribe.createAlignment( |
|
|
2866 |
Alignment.ASSIGNMENT, |
2867 |
this.preferences.alignment_for_assignment, |
2868 |
Alignment.R_OUTERMOST, |
2869 |
1, |
2870 |
this.scribe.scanner.currentPosition); |
2807 |
this.scribe.enterAlignment(assignmentAlignment); |
2871 |
this.scribe.enterAlignment(assignmentAlignment); |
2808 |
boolean ok = false; |
2872 |
boolean ok = false; |
2809 |
do { |
2873 |
do { |
Lines 3128-3134
Link Here
|
3128 |
if (this.preferences.insert_space_after_assignment_operator) { |
3192 |
if (this.preferences.insert_space_after_assignment_operator) { |
3129 |
this.scribe.space(); |
3193 |
this.scribe.space(); |
3130 |
} |
3194 |
} |
3131 |
Alignment assignmentAlignment = this.scribe.createAlignment("compoundAssignmentAlignment", this.preferences.alignment_for_assignment, Alignment.R_OUTERMOST, 1, this.scribe.scanner.currentPosition); //$NON-NLS-1$ |
3195 |
Alignment assignmentAlignment = this.scribe.createAlignment( |
|
|
3196 |
Alignment.COMPOUND_ASSIGNMENT, |
3197 |
this.preferences.alignment_for_assignment, |
3198 |
Alignment.R_OUTERMOST, |
3199 |
1, |
3200 |
this.scribe.scanner.currentPosition); |
3132 |
this.scribe.enterAlignment(assignmentAlignment); |
3201 |
this.scribe.enterAlignment(assignmentAlignment); |
3133 |
boolean ok = false; |
3202 |
boolean ok = false; |
3134 |
do { |
3203 |
do { |
Lines 3162-3168
Link Here
|
3162 |
conditionalExpression.condition.traverse(this, scope); |
3231 |
conditionalExpression.condition.traverse(this, scope); |
3163 |
|
3232 |
|
3164 |
Alignment conditionalExpressionAlignment =this.scribe.createAlignment( |
3233 |
Alignment conditionalExpressionAlignment =this.scribe.createAlignment( |
3165 |
"conditionalExpression", //$NON-NLS-1$ |
3234 |
Alignment.CONDITIONAL_EXPRESSION, |
3166 |
this.preferences.alignment_for_conditional_expression, |
3235 |
this.preferences.alignment_for_conditional_expression, |
3167 |
2, |
3236 |
2, |
3168 |
this.scribe.scanner.currentPosition); |
3237 |
this.scribe.scanner.currentPosition); |
Lines 3567-3573
Link Here
|
3567 |
} |
3636 |
} |
3568 |
int argumentLength = arguments.length; |
3637 |
int argumentLength = arguments.length; |
3569 |
Alignment argumentsAlignment =this.scribe.createAlignment( |
3638 |
Alignment argumentsAlignment =this.scribe.createAlignment( |
3570 |
"explicit_constructor_call",//$NON-NLS-1$ |
3639 |
Alignment.EXPLICIT_CONSTRUCTOR_CALL, |
3571 |
this.preferences.alignment_for_arguments_in_explicit_constructor_call, |
3640 |
this.preferences.alignment_for_arguments_in_explicit_constructor_call, |
3572 |
argumentLength, |
3641 |
argumentLength, |
3573 |
this.scribe.scanner.currentPosition); |
3642 |
this.scribe.scanner.currentPosition); |
Lines 3826-3832
Link Here
|
3826 |
} |
3895 |
} |
3827 |
} else if (elseStatement == null && this.preferences.keep_simple_if_on_one_line) { |
3896 |
} else if (elseStatement == null && this.preferences.keep_simple_if_on_one_line) { |
3828 |
Alignment compactIfAlignment = this.scribe.createAlignment( |
3897 |
Alignment compactIfAlignment = this.scribe.createAlignment( |
3829 |
"compactIf", //$NON-NLS-1$ |
3898 |
Alignment.COMPACT_IF, |
3830 |
this.preferences.alignment_for_compact_if, |
3899 |
this.preferences.alignment_for_compact_if, |
3831 |
Alignment.R_OUTERMOST, |
3900 |
Alignment.R_OUTERMOST, |
3832 |
1, |
3901 |
1, |
Lines 4064-4077
Link Here
|
4064 |
messageSend.receiver.traverse(this, scope); |
4133 |
messageSend.receiver.traverse(this, scope); |
4065 |
int alignmentMode = this.preferences.alignment_for_selector_in_method_invocation; |
4134 |
int alignmentMode = this.preferences.alignment_for_selector_in_method_invocation; |
4066 |
messageAlignment = this.scribe.createAlignment( |
4135 |
messageAlignment = this.scribe.createAlignment( |
4067 |
"messageAlignment", //$NON-NLS-1$ |
4136 |
Alignment.MESSAGE_SEND, |
4068 |
alignmentMode, |
4137 |
alignmentMode, |
4069 |
1, |
4138 |
1, |
4070 |
this.scribe.scanner.currentPosition); |
4139 |
this.scribe.scanner.currentPosition); |
4071 |
this.scribe.enterAlignment(messageAlignment); |
4140 |
this.scribe.enterAlignment(messageAlignment); |
4072 |
boolean ok = false; |
4141 |
boolean ok = false; |
4073 |
do { |
4142 |
do { |
4074 |
switch (alignmentMode) { |
4143 |
switch (alignmentMode & Alignment.SPLIT_MASK) { |
4075 |
case Alignment.M_COMPACT_SPLIT: |
4144 |
case Alignment.M_COMPACT_SPLIT: |
4076 |
case Alignment.M_NEXT_PER_LINE_SPLIT: |
4145 |
case Alignment.M_NEXT_PER_LINE_SPLIT: |
4077 |
messageAlignment.startingColumn = this.scribe.column; |
4146 |
messageAlignment.startingColumn = this.scribe.column; |
Lines 4134-4140
Link Here
|
4134 |
|
4203 |
|
4135 |
// Create alignment |
4204 |
// Create alignment |
4136 |
Alignment methodDeclAlignment = this.scribe.createAlignment( |
4205 |
Alignment methodDeclAlignment = this.scribe.createAlignment( |
4137 |
"methodDeclaration",//$NON-NLS-1$ |
4206 |
Alignment.METHOD_DECLARATION, |
4138 |
this.preferences.alignment_for_method_declaration, |
4207 |
this.preferences.alignment_for_method_declaration, |
4139 |
Alignment.R_INNERMOST, |
4208 |
Alignment.R_INNERMOST, |
4140 |
3, |
4209 |
3, |
Lines 4289-4295
Link Here
|
4289 |
if (memberValuePairs != null) { |
4358 |
if (memberValuePairs != null) { |
4290 |
int length = memberValuePairs.length; |
4359 |
int length = memberValuePairs.length; |
4291 |
Alignment annotationAlignment = this.scribe.createAlignment( |
4360 |
Alignment annotationAlignment = this.scribe.createAlignment( |
4292 |
"annotationMemberValuePairs",//$NON-NLS-1$ |
4361 |
Alignment.ANNOTATION_MEMBERS_VALUE_PAIRS, |
4293 |
this.preferences.alignment_for_arguments_in_annotation, |
4362 |
this.preferences.alignment_for_arguments_in_annotation, |
4294 |
length, |
4363 |
length, |
4295 |
this.scribe.scanner.currentPosition); |
4364 |
this.scribe.scanner.currentPosition); |
Lines 4637-4643
Link Here
|
4637 |
} |
4706 |
} |
4638 |
int argumentLength = arguments.length; |
4707 |
int argumentLength = arguments.length; |
4639 |
Alignment argumentsAlignment =this.scribe.createAlignment( |
4708 |
Alignment argumentsAlignment =this.scribe.createAlignment( |
4640 |
"allocation",//$NON-NLS-1$ |
4709 |
Alignment.ALLOCATION, |
4641 |
this.preferences.alignment_for_arguments_in_qualified_allocation_expression, |
4710 |
this.preferences.alignment_for_arguments_in_qualified_allocation_expression, |
4642 |
argumentLength, |
4711 |
argumentLength, |
4643 |
this.scribe.scanner.currentPosition); |
4712 |
this.scribe.scanner.currentPosition); |
Lines 4896-4902
Link Here
|
4896 |
this.scribe.printComment(); |
4965 |
this.scribe.printComment(); |
4897 |
ASTNode[] fragments = stringLiteral.literals; |
4966 |
ASTNode[] fragments = stringLiteral.literals; |
4898 |
int fragmentsSize = stringLiteral.counter; |
4967 |
int fragmentsSize = stringLiteral.counter; |
4899 |
Alignment binaryExpressionAlignment = this.scribe.createAlignment("binaryExpressionAlignment", this.preferences.alignment_for_binary_expression, Alignment.R_OUTERMOST, fragmentsSize, this.scribe.scanner.currentPosition); //$NON-NLS-1$ |
4968 |
Alignment binaryExpressionAlignment = this.scribe.createAlignment( |
|
|
4969 |
Alignment.BINARY_EXPRESSION, |
4970 |
this.preferences.alignment_for_binary_expression, |
4971 |
Alignment.R_OUTERMOST, |
4972 |
fragmentsSize, |
4973 |
this.scribe.scanner.currentPosition); |
4900 |
this.scribe.enterAlignment(binaryExpressionAlignment); |
4974 |
this.scribe.enterAlignment(binaryExpressionAlignment); |
4901 |
boolean ok = false; |
4975 |
boolean ok = false; |
4902 |
do { |
4976 |
do { |