Hi!
I was getting tired of having the javadoc lookup and source-code lookup
behave diferently, so I decided to code a better source lookup method :)
You are free to (mis)use it as you please :)
(defun jde-open-source-for-symbol ()
"Displays source for a symbol. The symbol may reference an object, a
class,
or a method or field. If the symbol references a class, this function
displays the
source code for the class. If the symbol references an object, this method
displays the source code for the class of the object. If the symbol
references a field or
a method, this function displays the source code for the class of the object
of which
the field or method is a member. Eventually this function will be enhanced
to position
the source code at the point where the method or field is located."
(interactive)
(condition-case err
(let* (
(unqualified-name (thing-at-point 'symbol))
(class-name (jde-complete-get-qualified-name unqualified-name))
)
(if (not class-name)
(let ((parse-result (jde-help-parse-symbol-at-point)))
(if parse-result
(progn
(setq unqualified-name (car parse-result))
(setq class-name (jde-complete-get-qualified-name
unqualified-name))))))
(if class-name
(jde-open-class-source unqualified-name)
(message "Error: cannot find class '%s' on the current classpath."
unqualified-name)))
(error
(message "%s" (error-message-string err)))))