Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » displaying Java objects in debugger (as in Smalltalk)
displaying Java objects in debugger (as in Smalltalk) [message #262216] Wed, 30 July 2008 00:30 Go to next message
Eclipse UserFriend
Originally posted by: rpboland.gmail.com

In smalltalk when in the debugger if you display a variable it prints the
object using the printOn: method which is roughly analogous to the
toString()
method of Java.

So when I wanted a variable of a type (say X) to display nicely in the
eclipse Java debugger I wrote a toString() method for X expecting that the
toString() method would then be used to display my variable of type X.

Alas X's toString() method was ignored by the debugger.

Is there a way to get the debugger to display objects nicely?

If not, is there a reason for not providing such a facility?
I can live with having to write some method, say debugDisplay(), for X.
Classes not having a debugDisplay() method would of course behave as now.

Sincerely,

Ralph Boland

rpboland@gmail.com
Re: displaying Java objects in debugger (as in Smalltalk) [message #262224 is a reply to message #262216] Wed, 30 July 2008 02:06 Go to previous messageGo to next message
Paul A. Rubin is currently offline Paul A. RubinFriend
Messages: 188
Registered: July 2009
Senior Member
Ralph Boland wrote:
> In smalltalk when in the debugger if you display a variable it prints the
> object using the printOn: method which is roughly analogous to the
> toString()
> method of Java.
>
> So when I wanted a variable of a type (say X) to display nicely in the
> eclipse Java debugger I wrote a toString() method for X expecting that
> the toString() method would then be used to display my variable of type X.
>
> Alas X's toString() method was ignored by the debugger.
>
> Is there a way to get the debugger to display objects nicely?
>

I assume you want to do this at a breakpoint? If so, go to the Display
view. For me it usually shows up automatically in the Debug perspective
(as a tab alongside the Console view), but if not you can open it via
Windows -> Show View -> Display. Type the name of the variable in the
window, highlight it, and click the icon that looks like a J on a sheet
of note paper (tooltip: Display Result of Evaluating Selected Text), or
click Run -> Display, or use the equivalent key combo (Control - Shift -
D by default). That should do the trick. If not, try adding the
..toString() method to the variable name, highlight the whole thing, and
repeat.

/Paul
Re: displaying Java objects in debugger (as in Smalltalk) [message #262247 is a reply to message #262224] Wed, 30 July 2008 04:45 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
There are cool videos about what is possible with the debugger on
http://eclipsetutorial.sourceforge.net/debugger.html

Felix
Previous Topic:Missing Constraint:Import-Package
Next Topic:linux update requires access to /build?
Goto Forum:
  


Current Time: Tue Nov 25 21:07:29 GMT 2014

Powered by FUDForum. Page generated in 0.02309 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software