On Tue, May 21, 2002 at 03:42:01PM -0700, Brad Urani wrote:
> I'm writing a little java IDE using beanshell. I've
> implemented a step through mode and breakpoints (by
> parsing the code and adding pauses before i run it
> through beanshell) and I want to do a watch window
> (which i can update during my pauses). Is there a way
> I can access the variables declared in a function so I
> can update my watch window? I know I can access global
I'd be interested in hearing more about your project.
It just so happens that I'm working on a major rewrite of the user manaul
right now and I've cleaned up some bits of the code related to reflective
style access (like looking up methods and variables programmatically, etc.)
in order to better document it.
I'm not sure exactly what you mean by variables in functions... But if you
mean getting at all of the variables used in each scope as method calls
proceed then yes. You should be able to fully traverse the call path using
the this.callstack reference. It returns an array of bsh.NameSpace objects
which you could use to traverse the entire call sequence.
You could then use the NameSpace getVariableNames() and getVariable()
methods along with getMethods() to do anything you want.
I'd suggest you take this over to the developer's list. I'll CC it there.