在Eclipse中进行调试,适用于懒人

时间:2014-09-25 15:02:51

标签: eclipse debugging eclipse-plugin

当我在Eclipse中定义Breakpoint时,我可以通过将鼠标悬停在它上面来检查变量的值。此外,我可以切换到Debug透视图并执行更高级的任务,例如编写自定义表达式和更改变量值。 我想知道是否有可能在我将鼠标悬停在变量上时打开的窗口中执行某些任务?例如,编写自定义表达式以便将Java Calendars对象的值动态转换为人类可读的格式等。

enter image description here

谢谢!

1 个答案:

答案 0 :(得分:1)

您可以在Window-> Preferences-> Java-> Debug-> Detail Formatters中定义一个覆盖类型的默认public class Location { final public static int INITIAL = 0; final public static int PRISON = 1; final public static int DEATH = 2; final public static int SQUARE = 3; private String name; private int type; private int section; private int damage; private Square square ; // this constructor construct a Location from a name and a type. public Location(String name, int type) { this.name = name; this.type = type; } // this constructor constructs a Location of type SQUARE from a name, section, and damage. public Location(String name, int section, int damage) { this.name = name; this.section = section; this.damage = damage; this.square = new Square(name,section,damage); } // Get the square associated with this Location. public Square getSquare() { return square; } } 实现的自定义格式化程序:

enter image description here