I've modified jde-help-symbol to check for a prefix argument, if
present it now prompts for a symbol name rather than grabbing
thing-at-point.  This provides easy access to documentation even if
the name isn't in a buffer.  Hope you like it:

(defun jde-help-symbol (arg)
  "Displays help for the symbol at point or, with a prefix argument from the 
minibuffer. The symbol may reference an object, a class, or a method or field.
If the symbol references a class, this function displays the javadoc for the
class. If the symbol references an object, this method displays the javadoc for
the class of the object. If the symbol references a field or a method, this 
function displays the javadoc for the class of the object of which the field or
method is a member. Eventually this function will be enhanced to position
the javadoc at the point where the method or field is documented."
  (interactive "P")
  (condition-case err
      (let* ((unqualified-name (if arg
                                   (read-from-minibuffer "Help for symbol: ")
                                 (thing-at-point 'symbol)))
             (class-names 
              (bsh-eval-r 
               (concat "jde.util.JdeUtilities.getQualifiedName(\"" unqualified-name
                       "\");"))))
        (if (not class-names)
            (let ((parse-result (jde-help-parse-symbol-at-point)))
              (if parse-result        
                  (setq unqualified-name  (car parse-result)))
              (setq class-names 
                    ;;expand the names into full names, or a list of names
                    (bsh-eval-r 
                     (concat "jde.util.JdeUtilities.getQualifiedName(\"" 
unqualified-name "\");")))))
   
        ;;Check return value of QualifiedName
        (if class-names
            (let ((doc-files (mapcar 'jde-help-get-doc class-names)))
              (if doc-files
                  (progn
                    ;;Remove any annoying nils from the returned values
                    (setq doc-files (delq nil doc-files))
                    (if (eq 1 (length doc-files))
                        ;;then show it
                        (jde-help-show-document (car doc-files))
                      ;;else let the user choose
                      ;;If the list is only one long
                      (jde-help-choose-document doc-files)))
                (error "Cannot find documentation for %s" unqualified-name)))
          (error "Cannot find %s" unqualified-name)))
    (error
     (message "%s" (error-message-string err)))))



-- 
Robert

Reply via email to