1 19 package org.netbeans.modules.javacore.jmiimpl.javamodel; 20 21 import java.util.ArrayList ; 22 import java.util.List ; 23 import org.netbeans.jmi.javamodel.Element; 24 import org.netbeans.jmi.javamodel.JavaDoc; 25 import org.netbeans.jmi.javamodel.JavaModelPackage; 26 import org.netbeans.lib.java.parser.Token; 27 import org.netbeans.mdr.storagemodel.StorableObject; 28 import org.netbeans.modules.javacore.parser.ASTProvider; 29 import org.netbeans.modules.javacore.parser.MDRParser; 30 import org.openide.text.PositionBounds; 31 32 37 public abstract class JavaDocImpl extends MetadataElement implements JavaDoc { 38 39 protected String text = null; 40 protected List tags = null; 41 42 private boolean isNew = false; 43 protected boolean childrenInited = false; 44 45 46 protected JavaDocImpl(StorableObject s) { 47 super(s); 48 } 49 50 protected final boolean isInitialized() { 51 return isNew; 52 } 53 54 55 protected void setNew() { 56 setChanged(); 57 isNew = true; 58 childrenInited = true; 59 } 60 61 protected final boolean isNew() { 62 return isNew; 63 } 64 65 public List getChildren() { 66 return new ArrayList (getTags()); 67 } 68 69 public PositionBounds getPosition(boolean inclDoc) { 70 testResourceChange(); 71 FeatureImpl feature=(FeatureImpl)refImmediateComposite(); 72 ASTProvider p=feature.getParser(); 73 Token javadocToken=p.getComment(feature.getASTree()); 74 75 return p.createBounds(javadocToken.getStartOffset(), javadocToken.getEndOffset()); 76 } 77 78 82 public String getText() { 83 return text; 84 } 85 86 91 public void setText(String newValue) { 92 objectChanged(CHANGED_JAVADOC); 93 this.text = newValue; 94 } 95 96 100 public List getTags() { 101 return tags; 102 } 103 104 void setData(String text, List tags) { 105 this.text = text; 106 this.tags = createChildrenList("tags", tags, CHANGED_JAVADOC); } 108 109 protected java.lang.Object getInternalForm() { 110 return text; 111 } 112 113 122 protected final void rollback() { 123 } 125 126 public MDRParser getParser() { 127 return null; 128 } 129 130 public Element duplicate(JavaModelPackage targetExtent) { 131 return targetExtent.getJavaDoc().createJavaDoc(getText(), duplicateList(getTags(), targetExtent)); 132 } 133 } 134 | Popular Tags |