Recently I've watched a short presentation of JBuilder.  One of the
features demonstrated was a completion facility allowing dynamic
completion of field and method names.

So far I haven't investigated what exactly JBuilder can do, but having
decided that Emacs needs something similar, I implemented a completion
package based on JDE and BeanShell.

It's available as a tarball containing the Elisp and Java sources:
<URL:http://www.inf.fu-berlin.de/~lichtebl/jde-completion-0.1.tar.gz>

Please send comments and suggestions to me.  The package has not been
tested extensively; I'd appreciate both bug reports and feature
requests.  If you think jde-completion is suited for inclusion into JDE
or the ``Contributed Software'' section, feel free to add it to the
distribution.

-->8--------
C-c SPC runs the command jde:complete
   which is an interactive Lisp function in `jde-completion'.
(jde:complete)

Complete Java field or method name before point using the minibuffer.

Looks at the point to find an expression like `Class.name' and looks up
all public methods and fields `Class' has.  If there is only one such
completion starting with `name', it is inserted into the buffer.  If there
are several possible completions, the user is asked to complete `name' in
the minibuffer using `completing-read'.

If `Class' is really a qualified class name like `my.pkg.Class', this
qualified name is looked up.  Otherwise the `import' declarations and the
`package' declaration in the current buffer are examined and all
possible class names are tried until one matches.

Instead of a Class name, you can also use a variable name as in
  String str = ...;
  ...
  str.[X] <=== Point is here
C-c SPC will then try to find `str''s declaration and look up
its class.  The declaration is searched for in the method and at the
beginning of the class the point is in, so that both local variables
and instance variables will be found.  (Fields declared between methods
will not be found currently.)

As `jde:complete' uses Java (via the BeanShell) to look up method and
field names, the classes providing these have to be compiled prior to
its invocation.  The class that is currently edited need not be compiled,
however.  (But completing anything related to the current class is not
supported anyway and certainly won't work unless it was compiled.  Using
`this' is not supported.)

Using `super' is supported and works by looking at the `extends' clause
to find the superclass.
-->8--------

Reply via email to