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

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
              extended by org.aspectj.org.eclipse.jdt.internal.formatter.comment.JavaDocRegion
All Implemented Interfaces:
IBorderAttributes, ICommentAttributes, IHtmlTagDelimiters, IJavaDocTagConstants

public class JavaDocRegion
extends MultiCommentRegion
implements IJavaDocTagConstants

Javadoc 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
JavaDocRegion(IDocument document, Position position, CodeFormatterVisitor formatter)
          Creates a new Javadoc 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  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.
protected  void formatRegion(java.lang.String indentation, int width)
          Formats this comment region.
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 markTagRanges(char[][] tags, int attribute, boolean html)
          Marks the comment region with the HTML range tag.
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.formatter.comment.MultiCommentRegion
getDelimiter, getDelimiter, isIndentDescriptions, isIndentRoots, markRegion
 
Methods inherited from class org.aspectj.org.eclipse.jdt.internal.formatter.comment.CommentRegion
append, format, 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

JavaDocRegion

public JavaDocRegion(IDocument document,
                     Position position,
                     CodeFormatterVisitor formatter)
Creates a new Javadoc 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

canFormat

protected boolean canFormat(CommentRange previous,
                            CommentRange next)
Description copied from class: CommentRegion
Can the whitespace between the two comment ranges be formatted?

Overrides:
canFormat in class CommentRegion
Parameters:
previous - previous comment range which was already formatted, can be null
next - next comment range to be formatted
Returns:
true iff the next comment range can be formatted, false otherwise.

formatRegion

protected final void formatRegion(java.lang.String indentation,
                                  int width)
Description copied from class: CommentRegion
Formats this comment region.

Overrides:
formatRegion in class CommentRegion
Parameters:
indentation - the indentation of this comment region
width - the maximal width of text in this comment region measured in average character widths

markHtmlRanges

protected final void markHtmlRanges()
Description copied from class: MultiCommentRegion
Marks the comment ranges confined by HTML ranges.

Overrides:
markHtmlRanges in class MultiCommentRegion

markHtmlTag

protected final void markHtmlTag(CommentRange range,
                                 char[] token)
Description copied from class: MultiCommentRegion
Marks the comment range with its HTML tag attributes.

Overrides:
markHtmlTag in class MultiCommentRegion
Parameters:
range - the comment range to mark
token - token associated with the comment range

markJavadocTag

protected final void markJavadocTag(CommentRange range,
                                    char[] token)
Description copied from class: MultiCommentRegion
Marks the comment range with its javadoc tag attributes.

Overrides:
markJavadocTag in class MultiCommentRegion
Parameters:
range - the comment range to mark
token - token associated with the comment range

markTagRanges

protected final void markTagRanges(char[][] tags,
                                   int attribute,
                                   boolean html)
Marks the comment region with the HTML range tag.

Parameters:
tags - the HTML tag which confines the HTML range
attribute - the attribute to set if the comment range is in the HTML range
html - true iff the HTML tags in this HTML range should be marked too, false otherwise

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 MultiCommentRegion
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

createLine

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

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