Raul Acevedo writes:
 > How hard would it be to have a BeanShell instance per project?
 > 
 > For example, currently I work on FOUR JDE projects at once in a single
 > Emacs session, which corresponds to two main projects, each with two
 > branches (main development branch and stable branch).
 > 
 > Clearly this is a problem with the BeanShell, because it uses the
 > CLASSPATH of the project it was instantiated with.  E.g. if I was
 > looking at a file in the deFv branch when BeanShell was started, but am
 > now looking at a file in the stable branch and do C-c C-v C-y, JDE will
 > pull the class from the dev branch, not the stable branch.
 > 
 > It shouldn't be hard to have JDE be smart enough to create a separate
 > instance of BeanShell for each project (as an option of course), and to
 > use the appropriate BeanShell for whatever the current project is.  Or,
 > it could be smart enough to dynamically tell the BeanShell to use a
 > different CLASSPATH based on the current project.
 > 
 > Is this alreay possible, or is there another way to do this?
 > 

Hi Raul,

The JDEE uses the BeanShell for two purposes: two run Java code that
implements various JDEE features, e.g., completion and the Interface
Wizard, and to compile files. The features code depends on the
project classpath only to build a database of classes to use
for completion and to resolve unqualified classnames. The JDEE
currently creates a class database for each project when that
project is first opened and switches databases automatically
as you switch projects, e.g., from a buffer in project A to
a buffer in project B. Put another way, none of the JDEEs'
Java tools depend on the classpath used to start the Beanshell.
The JDEE passes the classpath for a project to the wizards
and the completion code which then build databases of those
classes by loading classes from your file system and 
uncompressing jar and zip files containing classes.

Thus, you do not need multiple Beanshells
for wizards and completion, e.g., thus if you open project B,
start the Beanshell, then open project A, you should be able
to complete fields and methods in project A without having
to restart the Beanshell even for classes that are defined
only on project A's classpath. Nor do you need multiple
instances of the Beanshell to compile classes with the
compile server, which uses the Beanshell to run the javac
compiler. In this case, when you compile a buffer, the JDEE
sends the classpath for that buffer to the compile server.
The JDEE automatically updates the completion database
when you compile a class.

The only case where you might need multiple instances is
if you want to work in the Beanshell itself, i.e., run
code that depends on classes in a particular project's
classpath.

- Paul

Reply via email to