< Day Day Up > |
Recipe 5.13 Assigning Values to Variables While Debugging5.13.1 ProblemYou want to change the values of variables while debugging to run tests on those new values. 5.13.2 SolutionJust double-click a field or variable name in the Variables view, and enter a new value in the dialog that opens. 5.13.3 DiscussionThe Variables view displays the currently available variables and their values, as you can see at upper right in Figure 5-23. Figure 5-23. Debugging with the Variables viewTo change a variable's value, just double-click it, and enter a new value. For example, to change the value in loopIndex from 3 to 2, double-click loopIndex in the Variables view, enter 2 in the dialog that opens (shown in Figure 5-24), and click OK. Figure 5-24. Changing a variable on the flyNote, however, that monkeying with data in a running program can break your code. 5.13.3.1 Eclipse 3.0In Eclipse 3.0, some Java types, such as collections and maps, can be displayed in a more compact and meaningful form using variable filters. These filters are controlled with a toggle button in the Variables view. 5.13.4 See AlsoRecipe 5.12 on evaluating expressions. |
< Day Day Up > |