1 19 package org.netbeans.modules.java.source.builder; 20 21 import org.netbeans.api.java.source.Comment; 22 import com.sun.tools.javac.parser.Scanner.CommentStyle; 23 24 27 public class CommentRun extends BufferRun { 28 29 final Comment.Style style; 31 36 public CommentRun(int start, int end, CommentStyle style) { 37 super(start, end, Kind.COMMENT); 38 switch (style) { 39 case BLOCK: this.style = Comment.Style.BLOCK; break; 40 case LINE: this.style = Comment.Style.LINE; break; 41 case JAVADOC: this.style = Comment.Style.JAVADOC; break; 42 default: 43 throw new AssertionError ("unknown CommentStyle: " + style); 44 } 45 } 46 47 50 public Comment.Style getStyle() { 51 return style; 52 } 53 54 public Comment toComment(String text, int indent) { 55 return Comment.create(style, start, end, indent, text); 56 } 57 58 61 public String toString() { 62 return "CR(" + start + "," + end + ") " + style; 63 } 64 } 65 | Popular Tags |