Class ASTRewriteFormatter
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classstatic classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ASTRewriteFormatter.Prefixstatic final ASTRewriteFormatter.Prefixstatic final ASTRewriteFormatter.Prefix -
Constructor Summary
ConstructorsConstructorDescriptionASTRewriteFormatter(NodeInfoStore placeholders, RewriteEventStore eventStore, Map options, String lineDelimiter) -
Method Summary
Modifier and TypeMethodDescriptionchangeIndent(String code, int codeIndentLevel, String newIndent) intcomputeIndentUnits(String line) createIndentString(int indentationUnits) static StringevaluateFormatterEdit(String string, org.eclipse.text.edits.TextEdit edit, org.eclipse.jface.text.Position[] positions) Evaluates the edit on the given string.org.eclipse.text.edits.TextEditformatString(int kind, String string, int offset, int length, int indentationLevel) getFormattedResult(ASTNode node, int initialIndentationLevel, Collection resultingMarkers) Returns the string accumulated in the visit formatted using the default formatter.getIndentString(String currentLine) intint
-
Field Details
-
NONE
-
SPACE
-
ASSERT_COMMENT
-
VAR_INITIALIZER
-
METHOD_BODY
-
FINALLY_BLOCK
-
CATCH_BLOCK
-
ANNOT_MEMBER_DEFAULT
-
ENUM_BODY_START
-
ENUM_BODY_END
-
WILDCARD_EXTENDS
-
WILDCARD_SUPER
-
FIRST_ENUM_CONST
-
ANNOTATION_SEPARATION
-
PARAM_ANNOTATION_SEPARATION
-
LOCAL_ANNOTATION_SEPARATION
-
TYPE_ANNOTATION_SEPARATION
-
VARARGS
-
TRY_RESOURCES
-
TRY_RESOURCES_PAREN
-
IF_BLOCK_WITH_ELSE
-
IF_BLOCK_NO_ELSE
-
ELSE_AFTER_STATEMENT
-
ELSE_AFTER_BLOCK
-
CASE_SEPARATION
-
FOR_BLOCK
-
WHILE_BLOCK
-
DO_BLOCK
-
-
Constructor Details
-
ASTRewriteFormatter
public ASTRewriteFormatter(NodeInfoStore placeholders, RewriteEventStore eventStore, Map options, String lineDelimiter)
-
-
Method Details
-
getPlaceholders
-
getEventStore
-
getTabWidth
public int getTabWidth() -
getIndentWidth
public int getIndentWidth() -
getLineDelimiter
-
getFormattedResult
public String getFormattedResult(ASTNode node, int initialIndentationLevel, Collection resultingMarkers) Returns the string accumulated in the visit formatted using the default formatter. Updates the existing node's positions.- Parameters:
node- The node to flatten.initialIndentationLevel- The initial indentation level.resultingMarkers- Resulting the updated NodeMarkers.- Returns:
- Returns the serialized and formatted code.
-
createIndentString
-
getIndentString
-
changeIndent
-
computeIndentUnits
-
evaluateFormatterEdit
public static String evaluateFormatterEdit(String string, org.eclipse.text.edits.TextEdit edit, org.eclipse.jface.text.Position[] positions) Evaluates the edit on the given string.- Parameters:
string- The string to formatedit- The edit resulted from the code formatterpositions- Positions to update ornull.- Returns:
- The formatted string
- Throws:
IllegalArgumentException- If the positions are not inside the string, a IllegalArgumentException is thrown.
-
formatString
public org.eclipse.text.edits.TextEdit formatString(int kind, String string, int offset, int length, int indentationLevel)
-