1 4 package org.ashkelon; 5 6 import org.ashkelon.util.Logger; 7 import org.ashkelon.util.StringUtils; 8 import com.sun.javadoc.SeeTag; 9 import com.sun.javadoc.Tag; 10 11 14 public class AshkelonTagResolver implements InlineTagResolver 15 { 16 public AshkelonTagResolver() {} 17 18 23 public String resolveDescription(DocInfo sourcedoc, Tag[] tags) 24 { 25 Logger log = Logger.getInstance(); 26 27 StringBuffer text = new StringBuffer (""); 28 for (int i=0; i<tags.length; i++) 29 { 30 log.debug("tag 'kind': "+tags[i].kind()); 31 32 if ("@return".equals(tags[i].kind()) && (tags[i].inlineTags() != null && tags[i].inlineTags().length > 0)) 34 { 35 return resolveDescription(sourcedoc, tags[i].inlineTags()); 36 } 37 38 if ("@see".equals(tags[i].kind())) { 40 Reference ref = new Reference(sourcedoc, (SeeTag) tags[i]); 41 String cmd = ""; 42 if (ref.getRefDocType() == DocInfo.PACKAGE_TYPE) 43 { 44 cmd = "pkg"; 45 } 46 else if (ref.getRefDocType() == DocInfo.CLASS_TYPE) 47 { 48 cmd = "cls"; 49 } 50 else if (ref.getRefDocType() == DocInfo.MEMBER_TYPE || ref.getRefDocType() == DocInfo.EXECMEMBER_TYPE) 51 { 52 cmd = "member"; 53 String name = ref.getRefDocName(); 54 int idx = name.indexOf("("); 55 if (idx > 0) 56 name = name.substring(0, idx); 57 ref.setRefDocName(name); 58 } 59 String var = cmd + "_name"; 60 String value = ref.getRefDocName(); 61 String label = ref.getLabel(); 62 if (StringUtils.isBlank(label)) 63 { 64 label = ref.getRefDocName(); 65 } 66 67 text.append("<a HREF=\"").append(cmd).append(".main.do?"); 69 text.append(var).append("=").append(value).append("\">"); 70 text.append(label).append("</a>"); 71 72 } 74 else { 76 text.append(tags[i].text()); 78 } 79 text.append(" "); 80 } 81 return text.toString().trim(); 82 } 83 } 84 | Popular Tags |