org.aspectj.org.eclipse.jdt.internal.formatter.comment
Class MultiCommentRegion

java.lang.Object
  extended by Position
      extended by org.aspectj.org.eclipse.jdt.internal.formatter.comment.CommentRegion
          extended by org.aspectj.org.eclipse.jdt.internal.formatter.comment.MultiCommentRegion
All Implemented Interfaces:
IBorderAttributes, ICommentAttributes, IHtmlTagDelimiters, IJavaDocTagConstants
Direct Known Subclasses:
JavaDocRegion

public class MultiCommentRegion
extends CommentRegion
implements IJavaDocTagConstants

Multi-comment region in a source code document.

Since:
3.0

Field Summary
 
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.formatter.comment.CommentRegion
COMMENT_RANGE_DELIMITER, fClear, preferences, scribe
 
Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.formatter.comment.IJavaDocTagConstants
COMMENT_ROOT_TAGS, COMMENT_TAG_PREFIX, JAVADOC_BREAK_TAGS, JAVADOC_CODE_TAGS, JAVADOC_IMMUTABLE_TAGS, JAVADOC_NEWLINE_TAGS, JAVADOC_PARAM_TAGS, JAVADOC_SEPARATOR_TAGS, JAVADOC_SINGLE_BREAK_TAG, JAVADOC_TAG_PREFIX, LINK_TAG_POSTFIX, LINK_TAG_PREFIX, LINK_TAG_PREFIX_STRING
 
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
MultiCommentRegion(IDocument document, Position position, CodeFormatterVisitor formatter)
          Creates a new multi-comment region.
 
Method Summary
protected  boolean canAppend(CommentLine line, CommentRange previous, CommentRange next, int index, int count)
          Can the comment range be appended to the comment line?
protected  CommentLine createLine()
          Creates a new line for this 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  boolean isIndentDescriptions()
          Should root tag parameter descriptions be indented after the tag?
protected  boolean isIndentRoots()
          Should root tag parameter descriptions be indented?
protected  void markHtmlRanges()
          Marks the comment ranges confined by HTML ranges.
protected  void markHtmlTag(CommentRange range, char[] token)
          Marks the comment range with its HTML tag attributes.
protected  void markJavadocTag(CommentRange range, char[] token)
          Marks the comment range with its javadoc tag attributes.
protected  void markRegion()
          Marks the comment ranges in this comment region.
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.formatter.comment.CommentRegion
append, canFormat, format, formatRegion, getDelimiter, getDocument, getRanges, getSize, getText, hasBorder, isAlphaNumeric, isClearLines, isNonAlphaNumeric, isSingleLine, logEdit, setBorder, stringToIndent, stringToLength, tokenizeRegion, wrapRegion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiCommentRegion

public MultiCommentRegion(IDocument document,
                          Position position,
                          CodeFormatterVisitor formatter)
Creates a new multi-comment region.

Parameters:
document - the document which contains the comment region
position - the position of this comment region in the document
formatter - the given formatter
Method Detail

canAppend

protected boolean canAppend(CommentLine line,
                            CommentRange previous,
                            CommentRange next,
                            int index,
                            int count)
Description copied from class: CommentRegion
Can the comment range be appended to the comment line?

Overrides:
canAppend in class CommentRegion
Parameters:
line - comment line where to append the comment range
previous - comment range which is the predecessor of the current comment range
next - comment range to test whether it can be appended to the comment line
index - amount of space in the comment line used by already inserted comment ranges
count - the maximal width of text in this comment region measured in average character widths
Returns:
true iff the comment range can be added to the line, false otherwise

getDelimiter

protected java.lang.String getDelimiter(CommentLine predecessor,
                                        CommentLine successor,
                                        CommentRange previous,
                                        CommentRange next,
                                        java.lang.String indentation)
Description copied from class: CommentRegion
Returns the line delimiter used in this comment line break.

Overrides:
getDelimiter in class CommentRegion
Parameters:
predecessor - the predecessor comment line after the line break
successor - the successor comment line before the line break
previous - the comment range after the line break
next - the comment range before the line break
indentation - indentation of the formatted line break
Returns:
the line delimiter for this comment line break

getDelimiter

protected java.lang.String getDelimiter(CommentRange previous,
                                        CommentRange next)
Description copied from class: CommentRegion
Returns the range delimiter for this comment range break.

Overrides:
getDelimiter in class CommentRegion
Parameters:
previous - the previous comment range to the right of the range delimiter
next - the next comment range to the left of the range delimiter
Returns:
the delimiter for this comment range break

isIndentDescriptions

protected final boolean isIndentDescriptions()
Should root tag parameter descriptions be indented after the tag?

Returns:
true iff the descriptions should be indented after, false otherwise.

isIndentRoots

protected final boolean isIndentRoots()
Should root tag parameter descriptions be indented?

Returns:
true iff the root tags should be indented, false otherwise.

markHtmlRanges

protected void markHtmlRanges()
Marks the comment ranges confined by HTML ranges.


markHtmlTag

protected void markHtmlTag(CommentRange range,
                           char[] token)
Marks the comment range with its HTML tag attributes.

Parameters:
range - the comment range to mark
token - token associated with the comment range

markJavadocTag

protected void markJavadocTag(CommentRange range,
                              char[] token)
Marks the comment range with its javadoc tag attributes.

Parameters:
range - the comment range to mark
token - token associated with the comment range

markRegion

protected void markRegion()
Description copied from class: CommentRegion
Marks the comment ranges in this comment region.

Overrides:
markRegion in class CommentRegion

createLine

protected CommentLine createLine()
Description copied from class: CommentRegion
Creates a new line for this region.

Overrides:
createLine in class CommentRegion
Returns:
a new line for this region