I snarfed some cool code from jde-complete to make jde-help-class a bit
better.

I basicly took the part of the code that determines what type a variable or
method belongs to, then invokes help on that class.

So if have some code like..

String s = "something";

yada = s.substri  I could hit (ctrl-f1 for me) here and get the help for
string.  It would be even cooler if it would go straight to the method
declaration, that looks pretty dificult tho.

Kinda helpful if you don't want to move the cursor back to the declaration.

Some questions:

- I just stole this code from jde-complete...  It might be helpful to add
another jde function "jde-type-for-thing-at-point" that would look up what
something is defined as.  This function could be used by jde-complete and
anything else that needed the functionality.
- Is anyone actively working on jde-complete?  I've found it extremely
useful, but it could be much better if someone would complete the two
features marked as "easy" in the jde-complete.el to-do list.

        -Geoff





(defun geoffs-smart-go-to-help-at-point ()
"Goes to the right help page based on the variable/method at point"
  (interactive)
      (let* ((pair (jde-complete-java-variable-at-point))
             vtype classinfo fulllist
             )
        (message (concat "looking for" (car pair)))
        (if (null pair)
            (setq pair (list (thing-at-point 'symbol) (thing-at-point
'symbol))))
        (if (not (null pair))
            (progn
              (setq vtype (jde-complete-declared-type-of (car pair)))
              (message (concat "vtype" vtype))
              (if (not (null vtype))
                  (condition-case err
                      (let* ((unqualified-name vtype)
                             (class-names 
                              ;;expand the names into full names, or a list
of names
                              (bsh-eval-r 
                               (concat
"jde.util.JdeUtilities.getQualifiedName(\"" unqualified-name "\");")))
                             (doc-files (mapcar 'jde-help-get-doc
class-names)))
                        ;;Check return value of QualifiedName
                        (if (eq nil class-names)
                            (error "Cannot find %s" unqualified-name))
                        ;;Remove any annoying nils from the returned values
                        (setq doc-files (delq nil doc-files))
                        (if (eq nil doc-files) 
                            (error "Cannot find documentation for %s"
unqualified-name))
                        ;;If the list is only one long
                        (if (eq 1 (length doc-files))
                            ;;then show it
                            (jde-help-show-document (car doc-files))
                          ;;else let the user choose
                          (jde-help-choose-document doc-files)))
                    (error (message "%s" (error-message-string err))))
                (call-interactively 'jde-help-class)))
                (call-interactively 'jde-help-class))))

Reply via email to