1 11 12 package org.eclipse.jdt.internal.ui.text.comment; 13 14 import java.util.Map ; 15 16 import org.eclipse.jface.text.IDocument; 17 import org.eclipse.jface.text.TypedPosition; 18 19 import org.eclipse.jdt.internal.ui.text.IJavaPartitions; 20 21 30 public class CommentObjectFactory { 31 32 40 public static CommentLine createLine(final CommentRegion region) { 41 42 final String type= region.getType(); 43 44 if (type.equals(IJavaPartitions.JAVA_DOC)) 45 return new JavaDocLine(region); 46 else if (type.equals(IJavaPartitions.JAVA_MULTI_LINE_COMMENT)) 47 return new MultiCommentLine(region); 48 else if (type.equals(IJavaPartitions.JAVA_SINGLE_LINE_COMMENT)) 49 return new SingleCommentLine(region); 50 51 return null; 52 } 53 54 70 public static CommentRegion createRegion(final IDocument document, final TypedPosition range, final String delimiter, final Map preferences, final ITextMeasurement textMeasurement) { 71 72 final String type= range.getType(); 73 74 if (type.equals(IJavaPartitions.JAVA_DOC)) 75 return new JavaDocRegion(document, range, delimiter, preferences, textMeasurement); 76 else if (type.equals(IJavaPartitions.JAVA_MULTI_LINE_COMMENT)) 77 return new MultiCommentRegion(document, range, delimiter, preferences, textMeasurement); 78 79 return new CommentRegion(document, range, delimiter, preferences, textMeasurement); 80 } 81 82 87 private CommentObjectFactory() { 88 } 90 } 91 | Popular Tags |