On Fri, 6 Dec 2002, [EMAIL PROTECTED] wrote:
>
>> From: news [mailto:[EMAIL PROTECTED]]On Behalf Of Galen
>> Boyer Sent: Friday, December 06, 2002 8:45 AM To:
>> [EMAIL PROTECTED] Subject: Re: BanInfo wizard anyone?
[...]
>> The translation layer could handle things like the java method
>> signature returning, say, a hashmap. The layer could have a
>> hashmap to alist converter.
>
> I've actually got a working prototype of a generic
> interface/translation layer that does just that. For now, I'm
> calling it JUCI (JDEE Universal Communication Interface). It
> allows elisp to call java and java to call back to elisp in a
> standard manner. It's still very alpha. One (minor, IMHO)
> drawback is that it requires JDK 1.3 or greater, because I'm
> making use of the java.lang.reflect.Proxy mechanism.
>
> My plan in the near term is to use it to try to integrate
> Transmogrify, which requires that the editor implement a 'Hook'
> interface for getting info like the current position of the
> cursor, list of files in the project, etc.
>
> Calling java from elisp is straightforward; you create a java
> interface containing the methods you wish to call from elisp
> and an implementation of that interface that has a default
> constructor:
>
> public interface MyHelper {
> Object doSomething(Object arg);
> }
>
> public class MyHelperImpl implements MyHelper {
> public MyHelperImpl() {}
>
> public Object doSomething(Object arg) {
> // ...
> }
> }
>
> On the elisp side, all you would need to do is declare a defun
> like this:
>
> (defun my-helper-do-something (arg)
> (jde-juci-invoke-java "MyHelperImpl" "doSomething"))
>
>
> For java code that calls elisp, you declare just an interface.
> On the elisp side, you implement that interface by creating a
> defun with a name following certain conventions and a matching
> arglist:
>
> public interface MyPrompt {
> String getUserInput();
> }
>
> (defun my-prompt-get-user-input ()
> (read-from-minibuffer "Input: "))
>
>
> // java code that invokes elisp
>
> Prompt prompt = (Prompt)
> jde.juci.ConnectionFactory.getConnection(MyPrompt.class);
> String result = promt.getUserInput();
>
> This will cause emacs to enter the minibuffer, capture the
> user-entered string, and return it to the java code.
>
> My hope is that the JDEE community will find this approach
> useful and that I can find enough time to clean up the code,
> document it and make it robust. I'd appreciate any feedback.
I see. You aren't referencing the beanshell here. Are you
opening up a direct connection to a JVM?
--
Galen Boyer