|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectPosition
org.aspectj.org.eclipse.jdt.internal.formatter.comment.CommentRegion
public class CommentRegion
Comment region in a source code document.
| Field Summary | |
|---|---|
protected static java.lang.String |
COMMENT_RANGE_DELIMITER
Default comment range delimiter |
protected boolean |
fClear
Should all blank lines be cleared during formatting? |
protected DefaultCodeFormatterOptions |
preferences
The formatting preferences |
protected Scribe |
scribe
the scribe used to create edits |
| Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.formatter.comment.IHtmlTagDelimiters |
|---|
HTML_CLOSE_PREFIX, HTML_TAG_POSTFIX, HTML_TAG_PREFIX |
| Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.formatter.comment.IBorderAttributes |
|---|
BORDER_LOWER, BORDER_UPPER |
| Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.formatter.comment.ICommentAttributes |
|---|
COMMENT_BLANKLINE, COMMENT_BREAK, COMMENT_CLOSE, COMMENT_CODE, COMMENT_FIRST_TOKEN, COMMENT_HTML, COMMENT_IMMUTABLE, COMMENT_NEWLINE, COMMENT_OPEN, COMMENT_PARAGRAPH, COMMENT_PARAMETER, COMMENT_ROOT, COMMENT_SEPARATOR, COMMENT_STARTS_WITH_RANGE_DELIMITER |
| Constructor Summary | |
|---|---|
CommentRegion(IDocument document,
Position position,
CodeFormatterVisitor formatter)
Creates a new comment region. |
|
| Method Summary | |
|---|---|
protected void |
append(CommentRange range)
Appends the comment range to this comment region. |
protected boolean |
canAppend(CommentLine line,
CommentRange previous,
CommentRange next,
int index,
int width)
Can the comment range be appended to the comment line? |
protected boolean |
canFormat(CommentRange previous,
CommentRange next)
Can the whitespace between the two comment ranges be formatted? |
protected CommentLine |
createLine()
Creates a new line for this region. |
TextEdit |
format(int indentationLevel,
boolean returnEdit)
Formats the comment region with the given indentation level. |
protected void |
formatRegion(java.lang.String indentation,
int width)
Formats this comment region. |
protected java.lang.String |
getDelimiter()
Returns the line delimiter used in this comment region. |
protected java.lang.String |
getDelimiter(CommentLine predecessor,
CommentLine successor,
CommentRange previous,
CommentRange next,
java.lang.String indentation)
Returns the line delimiter used in this comment line break. |
protected java.lang.String |
getDelimiter(CommentRange previous,
CommentRange next)
Returns the range delimiter for this comment range break. |
protected IDocument |
getDocument()
Returns the document of this comment region. |
protected java.util.LinkedList |
getRanges()
Returns the comment ranges in this comment region |
protected int |
getSize()
Returns the number of comment lines in this comment region. |
protected java.lang.String |
getText(int position,
int count)
Returns the text of this comment region in the indicated range. |
protected boolean |
hasBorder(int border)
Does the border border exist? |
protected boolean |
isAlphaNumeric(CommentRange range)
Does the comment range consist of letters and digits only? |
protected boolean |
isClearLines()
Should blank lines be cleared during formatting? |
protected boolean |
isNonAlphaNumeric(CommentRange range)
Does the comment range contain no letters and digits? |
protected boolean |
isSingleLine()
Is this comment region a single line region? |
protected void |
logEdit(java.lang.String change,
int position,
int count)
Logs a text edit operation occurred during the formatting process |
protected void |
markRegion()
Marks the comment ranges in this comment region. |
protected void |
setBorder(int border)
Set the border type border to true. |
protected java.lang.String |
stringToIndent(java.lang.String reference)
Computes the equivalent indentation for a string |
protected int |
stringToLength(java.lang.String reference)
Returns the length of the string in expanded characters. |
protected void |
tokenizeRegion()
Tokenizes the comment region. |
protected void |
wrapRegion(int width)
Wraps the comment ranges in this comment region into comment lines. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String COMMENT_RANGE_DELIMITER
protected boolean fClear
protected final DefaultCodeFormatterOptions preferences
protected Scribe scribe
| Constructor Detail |
|---|
public CommentRegion(IDocument document,
Position position,
CodeFormatterVisitor formatter)
document - the document which contains the comment regionposition - the position of this comment region in the documentformatter - the given code formatter| Method Detail |
|---|
protected final void append(CommentRange range)
range - comment range to append to this comment region
protected boolean canAppend(CommentLine line,
CommentRange previous,
CommentRange next,
int index,
int width)
line - comment line where to append the comment rangeprevious - comment range which is the predecessor of the current
comment rangenext - comment range to test whether it can be appended to the
comment lineindex - amount of space in the comment line used by already
inserted comment rangeswidth - the maximal width of text in this comment region
measured in average character widths
true iff the comment range can be added to the
line, false otherwise
protected boolean canFormat(CommentRange previous,
CommentRange next)
previous - previous comment range which was already formatted,
can be nullnext - next comment range to be formatted
true iff the next comment range can be
formatted, false otherwise.
public final TextEdit format(int indentationLevel,
boolean returnEdit)
indentationLevel - the indentation level
protected void formatRegion(java.lang.String indentation,
int width)
indentation - the indentation of this comment regionwidth - the maximal width of text in this comment region
measured in average character widthsprotected final java.lang.String getDelimiter()
protected java.lang.String getDelimiter(CommentLine predecessor,
CommentLine successor,
CommentRange previous,
CommentRange next,
java.lang.String indentation)
predecessor - the predecessor comment line after the line breaksuccessor - the successor comment line before the line breakprevious - the comment range after the line breaknext - the comment range before the line breakindentation - indentation of the formatted line break
protected java.lang.String getDelimiter(CommentRange previous,
CommentRange next)
previous - the previous comment range to the right of the range
delimiternext - the next comment range to the left of the range delimiter
protected final IDocument getDocument()
protected final java.util.LinkedList getRanges()
protected final int getSize()
protected final java.lang.String getText(int position,
int count)
position - the offset of the comment range to retrieve in
comment region coordinatescount - the length of the comment range to retrieve
protected final boolean hasBorder(int border)
border exist?
border - the type of the border, must be a border attribute of
CommentRegion
true iff this border exists,
false otherwiseprotected final boolean isAlphaNumeric(CommentRange range)
range - the comment range to text
true iff the comment range consists of letters
and digits only, false otherwiseprotected final boolean isNonAlphaNumeric(CommentRange range)
range - the comment range to text
true iff the comment range contains no letters
and digits, false otherwiseprotected final boolean isClearLines()
true iff blank lines should be cleared,
false otherwiseprotected final boolean isSingleLine()
true iff this region is single line,
false otherwise
protected final void logEdit(java.lang.String change,
int position,
int count)
change - the changed textposition - offset measured in comment region coordinates where
to apply the changed textcount - length of the range where to apply the changed textprotected void markRegion()
protected final void setBorder(int border)
border to true.
border - the type of the border. Must be a border attribute of
CommentRegionprotected final java.lang.String stringToIndent(java.lang.String reference)
reference - the string to compute the indentation for
protected final int stringToLength(java.lang.String reference)
reference - the string to get the length for
protected void tokenizeRegion()
protected void wrapRegion(int width)
width - the maximal width of text in this comment region
measured in average character widthsprotected CommentLine createLine()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||