Paul Kinnucan writes:
> Hi Christian,
>
> The basic trick to integrating a bsh script with the
> JDEE is to have the script write a Lisp form to
> standard out and then invoke the script via the JDEE's
> jde-eval function. The jde-eval function sends
> an arbitrary beanshell expresion via standard I/O
> to the beanshell and then evaluates the response,
> assuming that it is a Lisp form. For example, in
> your case, you would have to modify your script to
> print its result instead of returning the result
> as a string. Then, you could write the following
> Lisp:
>
> (defun make-bean-info (class)
> (interactive)
> (let ((info-src
> (jde-eval
> (concat "makeBeanInfo(\" class "\");"))))
> (message info-src)))
>
Actually the name of the function is jde-jeval-r.
> This function generates the bean info source and
> displays it in the minibuffer. Obviously, it be
> better to create it in a new source buffer, which
> is easily done but I just wanted to illustrate
> the basic idea. There are lots of examples in the
> JDE lisp code base, e.g., in jde-wiz.el and
> jde-gen.el, of how to create source buffers via
> Lisp.
>
> As a result of your email, I'm now thinking of renaming and
> restructuring the beanshell script directory (presently
> java/bsh_commands as follows
>
> java
> bsh_scripts
> bsh
> commands
> jde_scripts
>
> The commands subdirectory would contain scripts
> intended to be run as commands from the bsh
> command line. The jde_scripts directory would
> contain scripts used to implement functionality
> invoked via jde-eval. The directories would
> facilitate command-line and jde-eval versions of the
> same script.
Another idea would be to add options to the jde-jeval
function or new commands to
* evaluate a bsh expression (e.g., a script invocation)
and insert the result in a new Java source buffer
* evaluate a bsh expression and insert the result at
point in the current buffer
This would make it easey for users who are not proficient
in Lisp to use BeanShell scripts (i.e., Java) to
generate Java source code inside Emacs.
- Paul
>
> Hope this helps.
>
> - Paul
>
> Christian Mercat writes:
> > > > http://www.entrelacs.net/home/Java/beanInfoMaker.html
> > > > http://www.entrelacs.net/home/Java/beanInfoMaker.bsh
> > > >
> > > > I have no idea how to make it work from within JDE,
> > >
> > > Put the beanInfoMaker.bsh script in the
> > > jde/java/bsh-commands/bsh/commands/ directory. Start the BeanShell
> > > (M-x bsh) and enter the beanInfoMaker command at the BeanShell command
> > > line in the BeanShell, e.g.,
> > >
> > > % beanInfoMaker("mybeans.MyBean");
> > >
> > > The ability to easily write and run Java scripts from within
> > > Emacs is one of the more little known and appreciated features of the
> > > JDEE.
> >
> > I use this feature absolutely _everyday_ and I love it very dearly, it's
> > so mighty and powerful! Thanks again for giving it to us (and thanks to
> > Pat Niemeyer, a great benefactor for us, I always light up a candle for
> > him). The point I wanted to make is:
> >
> > I don't know how to make a wizard out of this script, that is get the
> > buffer name MyClass.java, create a new buffer name MyClassBeanInfo.java
> > and yank the result of the script into it. Without having to type
> > anything in the bsh, like a proper wizard should do. That's what I meant.
> >
> > Another thing about the BeanShell, I said that jedit revolves around it,
> > basically everything you do is a message sent to the buffer object
> > through the bsh. Their community has created a wealth of scripts (in
> > bsh, that is in loosely typed java) which emulate (really) most of the
> > behaviours I love in JDE. We might have a look how to interface their
> > work into JDE through the bsh to add functionalities without lisp. I
> > mean I don't know how to send e-lisp commands to emacs from the bsh. If
> > I could, then I would be able to make really powerful things without
> > lisp, in plain java. But then I may as well switch to jedit altogether
> > ;-) I won't, just teasing!
> >
> > Christian Mercat
> >
> >
> >