org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite
Class ASTRewriteFormatter
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter
public final class ASTRewriteFormatter
- extends java.lang.Object
|
Method Summary |
java.lang.String |
changeIndent(java.lang.String code,
int codeIndentLevel,
java.lang.String newIndent)
|
int |
computeIndentUnits(java.lang.String line)
|
java.lang.String |
createIndentString(int indentationUnits)
|
static java.lang.String |
evaluateFormatterEdit(java.lang.String string,
TextEdit edit,
Position[] positions)
Evaluates the edit on the given string. |
TextEdit |
formatString(int kind,
java.lang.String string,
int offset,
int length,
int indentationLevel)
|
RewriteEventStore |
getEventStore()
|
java.lang.String |
getFormattedResult(ASTNode node,
int initialIndentationLevel,
java.util.Collection resultingMarkers)
Returns the string accumulated in the visit formatted using the default formatter. |
java.lang.String |
getIndentString(java.lang.String currentLine)
|
int |
getIndentWidth()
|
java.lang.String |
getLineDelimiter()
|
NodeInfoStore |
getPlaceholders()
|
int |
getTabWidth()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NONE
public static final ASTRewriteFormatter.Prefix NONE
SPACE
public static final ASTRewriteFormatter.Prefix SPACE
ASSERT_COMMENT
public static final ASTRewriteFormatter.Prefix ASSERT_COMMENT
VAR_INITIALIZER
public final ASTRewriteFormatter.Prefix VAR_INITIALIZER
METHOD_BODY
public final ASTRewriteFormatter.Prefix METHOD_BODY
FINALLY_BLOCK
public final ASTRewriteFormatter.Prefix FINALLY_BLOCK
CATCH_BLOCK
public final ASTRewriteFormatter.Prefix CATCH_BLOCK
ANNOT_MEMBER_DEFAULT
public final ASTRewriteFormatter.Prefix ANNOT_MEMBER_DEFAULT
ENUM_BODY_START
public final ASTRewriteFormatter.Prefix ENUM_BODY_START
ENUM_BODY_END
public final ASTRewriteFormatter.Prefix ENUM_BODY_END
WILDCARD_EXTENDS
public final ASTRewriteFormatter.Prefix WILDCARD_EXTENDS
WILDCARD_SUPER
public final ASTRewriteFormatter.Prefix WILDCARD_SUPER
FIRST_ENUM_CONST
public final ASTRewriteFormatter.Prefix FIRST_ENUM_CONST
ANNOTATION_SEPARATION
public final ASTRewriteFormatter.Prefix ANNOTATION_SEPARATION
PARAM_ANNOTATION_SEPARATION
public final ASTRewriteFormatter.Prefix PARAM_ANNOTATION_SEPARATION
VARARGS
public final ASTRewriteFormatter.Prefix VARARGS
TRY_RESOURCES
public final ASTRewriteFormatter.Prefix TRY_RESOURCES
TRY_RESOURCES_PAREN
public final ASTRewriteFormatter.Prefix TRY_RESOURCES_PAREN
IF_BLOCK_WITH_ELSE
public final ASTRewriteFormatter.BlockContext IF_BLOCK_WITH_ELSE
IF_BLOCK_NO_ELSE
public final ASTRewriteFormatter.BlockContext IF_BLOCK_NO_ELSE
ELSE_AFTER_STATEMENT
public final ASTRewriteFormatter.BlockContext ELSE_AFTER_STATEMENT
ELSE_AFTER_BLOCK
public final ASTRewriteFormatter.BlockContext ELSE_AFTER_BLOCK
FOR_BLOCK
public final ASTRewriteFormatter.BlockContext FOR_BLOCK
WHILE_BLOCK
public final ASTRewriteFormatter.BlockContext WHILE_BLOCK
DO_BLOCK
public final ASTRewriteFormatter.BlockContext DO_BLOCK
ASTRewriteFormatter
public ASTRewriteFormatter(NodeInfoStore placeholders,
RewriteEventStore eventStore,
java.util.Map options,
java.lang.String lineDelimiter)
getPlaceholders
public NodeInfoStore getPlaceholders()
getEventStore
public RewriteEventStore getEventStore()
getTabWidth
public int getTabWidth()
getIndentWidth
public int getIndentWidth()
getLineDelimiter
public java.lang.String getLineDelimiter()
getFormattedResult
public java.lang.String getFormattedResult(ASTNode node,
int initialIndentationLevel,
java.util.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
public java.lang.String createIndentString(int indentationUnits)
getIndentString
public java.lang.String getIndentString(java.lang.String currentLine)
changeIndent
public java.lang.String changeIndent(java.lang.String code,
int codeIndentLevel,
java.lang.String newIndent)
computeIndentUnits
public int computeIndentUnits(java.lang.String line)
evaluateFormatterEdit
public static java.lang.String evaluateFormatterEdit(java.lang.String string,
TextEdit edit,
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 or null.
- Returns:
- The formatted string
- Throws:
java.lang.IllegalArgumentException - If the positions are not inside the string, a
IllegalArgumentException is thrown.
formatString
public TextEdit formatString(int kind,
java.lang.String string,
int offset,
int length,
int indentationLevel)