langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java
changeset 41452 ddaef4bba083
parent 39364 bd6d4a7936b4
child 43261 d377e97291d8
equal deleted inserted replaced
41451:a847c7aa25a7 41452:ddaef4bba083
   106 
   106 
   107     public void setEnumValuesTree(Configuration config, Element e) {
   107     public void setEnumValuesTree(Configuration config, Element e) {
   108         Utils utils = config.utils;
   108         Utils utils = config.utils;
   109         String klassName = utils.getSimpleName(utils.getEnclosingTypeElement(e));
   109         String klassName = utils.getSimpleName(utils.getEnclosingTypeElement(e));
   110 
   110 
   111         List<DocTree> fs = new ArrayList<>();
   111         List<DocTree> fullBody = new ArrayList<>();
   112         fs.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.firstsentence")));
   112         fullBody.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.fullbody", klassName)));
   113 
       
   114         List<DocTree> body = new ArrayList<>();
       
   115         body.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.body", klassName)));
       
   116 
   113 
   117         List<DocTree> descriptions = new ArrayList<>();
   114         List<DocTree> descriptions = new ArrayList<>();
   118         descriptions.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.return")));
   115         descriptions.add(treeFactory.newTextTree(config.getText("doclet.enum_values_doc.return")));
   119 
   116 
   120         List<DocTree> tags = new ArrayList<>();
   117         List<DocTree> tags = new ArrayList<>();
   121         tags.add(treeFactory.newReturnTree(descriptions));
   118         tags.add(treeFactory.newReturnTree(descriptions));
   122         DocCommentTree docTree = treeFactory.newDocCommentTree(fs, body, tags);
   119         DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, tags);
   123         dcTreesMap.put(e, new DocCommentDuo(null, docTree));
   120         dcTreesMap.put(e, new DocCommentDuo(null, docTree));
   124     }
   121     }
   125 
   122 
   126     public void setEnumValueOfTree(Configuration config, Element e) {
   123     public void setEnumValueOfTree(Configuration config, Element e) {
   127         List<DocTree> fs = new ArrayList<>();
   124 
   128         fs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.firstsentence")));
   125         List<DocTree> fullBody = new ArrayList<>();
   129 
   126         fullBody.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.fullbody")));
   130         List<DocTree> body = new ArrayList<>();
       
   131         body.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.body")));
       
   132 
   127 
   133         List<DocTree> tags = new ArrayList<>();
   128         List<DocTree> tags = new ArrayList<>();
   134 
   129 
   135         List<DocTree> paramDescs = new ArrayList<>();
   130         List<DocTree> paramDescs = new ArrayList<>();
   136         paramDescs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.param_name")));
   131         paramDescs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.param_name")));
   154         throwsDescs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.throws_npe")));
   149         throwsDescs.add(treeFactory.newTextTree(config.getText("doclet.enum_valueof_doc.throws_npe")));
   155 
   150 
   156         ref = treeFactory.newReferenceTree("java.lang.NullPointerException");
   151         ref = treeFactory.newReferenceTree("java.lang.NullPointerException");
   157         tags.add(treeFactory.newThrowsTree(ref, throwsDescs));
   152         tags.add(treeFactory.newThrowsTree(ref, throwsDescs));
   158 
   153 
   159         DocCommentTree docTree = treeFactory.newDocCommentTree(fs, body, tags);
   154         DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, tags);
   160 
   155 
   161         dcTreesMap.put(e, new DocCommentDuo(null, docTree));
   156         dcTreesMap.put(e, new DocCommentDuo(null, docTree));
   162     }
   157     }
   163 
   158 
   164     /*
   159     /*
   188         }
   183         }
   189         DocTreePath treePath = trees.getDocTreePath(fo);
   184         DocTreePath treePath = trees.getDocTreePath(fo);
   190         return new DocCommentDuo(treePath.getTreePath(), dcTree);
   185         return new DocCommentDuo(treePath.getTreePath(), dcTree);
   191     }
   186     }
   192 
   187 
   193     public void setDocCommentTree(Element element, List<DocTree> firstSentence,
   188     public void setDocCommentTree(Element element, List<DocTree> fullBody,
   194             List<DocTree> bodyTags, List<DocTree> blockTags, Utils utils) {
   189             List<DocTree> blockTags, Utils utils) {
   195         DocCommentTree docTree = treeFactory.newDocCommentTree(firstSentence,
   190         DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, blockTags);
   196                                                       bodyTags,
       
   197                                                       blockTags);
       
   198         dcTreesMap.put(element, new DocCommentDuo(null, docTree));
   191         dcTreesMap.put(element, new DocCommentDuo(null, docTree));
   199         // There maybe an entry with the original comments usually null,
   192         // There maybe an entry with the original comments usually null,
   200         // therefore remove that entry if it exists, and allow a new one
   193         // therefore remove that entry if it exists, and allow a new one
   201         // to be reestablished.
   194         // to be reestablished.
   202         utils.removeCommentHelper(element);
   195         utils.removeCommentHelper(element);