Class JavadocUrlHandler

  • All Implemented Interfaces:
    org.fife.ui.autocomplete.ExternalURLHandler

    public class JavadocUrlHandler
    extends java.lang.Object
    implements org.fife.ui.autocomplete.ExternalURLHandler
    Handles hyperlinks that are clicked in Javadoc for code completions. It's assumed that the links found were created via Util.docCommentToHtml(String), so that things such as "@see" links are interpreted properly.
    Version:
    1.0
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String doBackups​(java.lang.String pkg, int backupCount)
      Returns the parent package backupCount levels up from the package specified.
      private static java.lang.String getAnchor​(java.lang.String url)
      Returns the anchor portion of a (relative) URL.
      private static java.lang.String[] getArgs​(java.lang.String methodSignature)
      Gets the arguments from a method signature.
      private java.lang.String getClass​(org.fife.ui.autocomplete.Completion c, java.lang.String desc)
      Returns the class for a completion (class completions return the class itself, member completions return the enclosing class).
      private JavaLanguageSupport getJavaLanguageSupport()
      Returns the Java language support.
      private java.lang.String getPackage​(org.fife.ui.autocomplete.Completion c, java.lang.String desc)
      Returns the package of the specified completion.
      private boolean isRelativeUrl​(java.lang.String text)
      Returns whether the text is a relative URL to other Javadoc.
      void urlClicked​(javax.swing.event.HyperlinkEvent e, org.fife.ui.autocomplete.Completion c, org.fife.ui.autocomplete.DescWindowCallback callback)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JavadocUrlHandler

        public JavadocUrlHandler()
    • Method Detail

      • doBackups

        private java.lang.String doBackups​(java.lang.String pkg,
                                           int backupCount)
        Returns the parent package backupCount levels up from the package specified.
        Parameters:
        pkg - A package.
        backupCount - The number of packages "up" to go.
        Returns:
        The parent package.
      • getJavaLanguageSupport

        private JavaLanguageSupport getJavaLanguageSupport()
        Returns the Java language support.
        Returns:
        The Java language support
      • getAnchor

        private static java.lang.String getAnchor​(java.lang.String url)
        Returns the anchor portion of a (relative) URL.
        Parameters:
        url - The URL.
        Returns:
        The anchor, or null if none.
      • getArgs

        private static java.lang.String[] getArgs​(java.lang.String methodSignature)
        Gets the arguments from a method signature.
        Parameters:
        methodSignature - The method signature.
        Returns:
        The arguments, or an empty array if none.
      • getClass

        private java.lang.String getClass​(org.fife.ui.autocomplete.Completion c,
                                          java.lang.String desc)
        Returns the class for a completion (class completions return the class itself, member completions return the enclosing class).
      • getPackage

        private java.lang.String getPackage​(org.fife.ui.autocomplete.Completion c,
                                            java.lang.String desc)
        Returns the package of the specified completion.
        Parameters:
        c - The completion.
        desc - The description text being parsed. Used for errors if we cannot determine the package.
        Returns:
        The package.
      • isRelativeUrl

        private boolean isRelativeUrl​(java.lang.String text)
        Returns whether the text is a relative URL to other Javadoc.
        Parameters:
        text - A link in Javadoc.
        Returns:
        Whether the link is a relative path to more Javadoc.
      • urlClicked

        public void urlClicked​(javax.swing.event.HyperlinkEvent e,
                               org.fife.ui.autocomplete.Completion c,
                               org.fife.ui.autocomplete.DescWindowCallback callback)
        Specified by:
        urlClicked in interface org.fife.ui.autocomplete.ExternalURLHandler