Here is what I have so far. Is there a better way ?
(defun java-get-buffer-full-class-name ()
"Get the buffers fully qualified class name."
(interactive)
(if (jde-parse-get-package-name)
(concat (jde-parse-get-package-name) "." (class-from-file-name
(buffer-file-name)))
(class-from-file-name (buffer-file-name))
)
)
(defun jde-db-search-classpath-dirs (file package)
"Return the directory containing the class FILE for a class in PACKAGE."
(catch 'found
(let ((len (length jde-global-classpath))
(n 0))
(while (< n len)
(let ((curr-dir
(jde-normalize-path (elt jde-global-classpath n))))
(cond
((jde-db-contains-file-p curr-dir file)
(throw 'found curr-dir))
((and (jde-db-contains-package-p curr-dir package)
(jde-db-contains-file-p
(expand-file-name (jde-db-pkg-to-path package) curr-dir) file))
(throw 'found
(expand-file-name
(jde-db-pkg-to-path package) curr-dir)))))
(setq n (1+ n))))))
(defun jde-find-class-class-file (class)
"*Find the class file for a specified class.
CLASS is the fully qualified name of the class. This
function searchs the class paths specified by
`jde-global-classpath' for the source file
corresponding to CLASS. If it finds the source file,
it returns the file's path. Otherwise, it returns nil.
Adapted from `jde-find-class-source-file'."
(string-match "^\\(\\(\\(\\w\\|[_]\\)*[.]\\)*\\)\\(\\(\\w\\|[_]\\)+$\\)"
class)
(let* ((package-name
(substring class (match-beginning 1) (match-end 1)))
(class-name
(substring class (match-beginning 4) (match-end 4)))
(file-name (concat class-name ".class"))
(source-dir (jde-db-search-classpath-dirs file-name package-name)))
(if source-dir
(expand-file-name file-name source-dir)
(message "JDE error: Could not find class for %s. See
`jde-global-classpath' for more information." class)
nil)))
(defun java-get-buffer-class-file-name ()
""
(interactive)
(message (jde-find-class-class-file (java-get-buffer-full-class-name)))
)
Sandip V. Chitale 150, Almaden Blvd
work: (408) 535 1791 ext: 791 San Jose, CA, USA
email: [EMAIL PROTECTED] 8th floor, Cube 831
web: http://L064-5440.blazesoft.com