src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java

changeset 1413
bdcef2ef52d2
parent 1383
b980e8e6aabf
child 1606
ccbe7ffdd867
     1.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Thu Nov 15 19:54:20 2012 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Thu Nov 15 23:07:24 2012 -0800
     1.3 @@ -30,6 +30,9 @@
     1.4  import java.net.*;
     1.5  import java.util.*;
     1.6  
     1.7 +import javax.tools.DocumentationTool;
     1.8 +import javax.tools.JavaFileManager;
     1.9 +
    1.10  import com.sun.javadoc.*;
    1.11  import com.sun.tools.doclets.internal.toolkit.util.*;
    1.12  
    1.13 @@ -48,16 +51,16 @@
    1.14  public class TagletManager {
    1.15  
    1.16      /**
    1.17 -     * The default seperator for the simple tag option.
    1.18 +     * The default separator for the simple tag option.
    1.19       */
    1.20 -    public static final char SIMPLE_TAGLET_OPT_SEPERATOR = ':';
    1.21 +    public static final char SIMPLE_TAGLET_OPT_SEPARATOR = ':';
    1.22  
    1.23      /**
    1.24 -     * The alternate seperator for simple tag options.  Use this
    1.25 -     * with you want the default seperator to be in the name of the
    1.26 +     * The alternate separator for simple tag options.  Use this
    1.27 +     * when you want the default separator to be in the name of the
    1.28       * custom tag.
    1.29       */
    1.30 -    public static final String ALT_SIMPLE_TAGLET_OPT_SEPERATOR = "-";
    1.31 +    public static final String ALT_SIMPLE_TAGLET_OPT_SEPARATOR = "-";
    1.32  
    1.33      /**
    1.34       * The map of custom tags.
    1.35 @@ -200,18 +203,24 @@
    1.36       * @param classname  the name of the class representing the custom tag.
    1.37       * @param tagletPath  the path to the class representing the custom tag.
    1.38       */
    1.39 -    public void addCustomTag(String classname, String tagletPath) {
    1.40 +    public void addCustomTag(String classname, JavaFileManager fileManager, String tagletPath) {
    1.41          try {
    1.42              Class<?> customTagClass = null;
    1.43              // construct class loader
    1.44              String cpString = null;   // make sure env.class.path defaults to dot
    1.45  
    1.46 -            // do prepends to get correct ordering
    1.47 -            cpString = appendPath(System.getProperty("env.class.path"), cpString);
    1.48 -            cpString = appendPath(System.getProperty("java.class.path"), cpString);
    1.49 -            cpString = appendPath(tagletPath, cpString);
    1.50 -            URLClassLoader appClassLoader = new URLClassLoader(pathToURLs(cpString));
    1.51 -            customTagClass = appClassLoader.loadClass(classname);
    1.52 +            ClassLoader tagClassLoader;
    1.53 +            if (fileManager != null && fileManager.hasLocation(DocumentationTool.Location.TAGLET_PATH)) {
    1.54 +                tagClassLoader = fileManager.getClassLoader(DocumentationTool.Location.TAGLET_PATH);
    1.55 +            } else {
    1.56 +                // do prepends to get correct ordering
    1.57 +                cpString = appendPath(System.getProperty("env.class.path"), cpString);
    1.58 +                cpString = appendPath(System.getProperty("java.class.path"), cpString);
    1.59 +                cpString = appendPath(tagletPath, cpString);
    1.60 +                tagClassLoader = new URLClassLoader(pathToURLs(cpString));
    1.61 +            }
    1.62 +
    1.63 +            customTagClass = tagClassLoader.loadClass(classname);
    1.64              Method meth = customTagClass.getMethod("register",
    1.65                                                     new Class<?>[] {java.util.Map.class});
    1.66              Object[] list = customTags.values().toArray();

mercurial