KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > debugger > jpda > event > JPDABreakpointEvent


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.api.debugger.jpda.event;
21
22 import com.sun.jdi.ReferenceType;
23 import java.util.EventObject JavaDoc;
24 import org.netbeans.api.debugger.jpda.*;
25
26 /**
27  * JPDABreakpoint event notification.
28  *
29  * @author Jan Jancura
30  */

31 public final class JPDABreakpointEvent extends EventObject JavaDoc {
32
33     /** Condition result constant. */
34     public static final int CONDITION_NONE = 0;
35     /** Condition result constant. */
36     public static final int CONDITION_TRUE = 1;
37     /** Condition result constant. */
38     public static final int CONDITION_FALSE = 2;
39     /** Condition result constant. */
40     public static final int CONDITION_FAILED = 3;
41     
42     
43     private int conditionResult = CONDITION_FAILED;
44     private Throwable JavaDoc conditionException = null;
45     private JPDADebugger debugger;
46     private JPDAThread thread;
47     private ReferenceType referenceType;
48     private Variable variable;
49     private boolean resume = false;
50     
51
52     /**
53      * Creates a new instance of JPDABreakpointEvent. This method should be
54      * called from debuggerjpda module only. Do not create a new instances
55      * of this class!
56      *
57      * @param sourceBreakpoint a breakpoint
58      * @param debugger a debugger this
59      * @param conditionResult a result of condition
60      * @param thread a context thread
61      * @param referenceType a context class
62      * @param variable a context variable
63      */

64     public JPDABreakpointEvent (
65         JPDABreakpoint sourceBreakpoint,
66         JPDADebugger debugger,
67         int conditionResult,
68         JPDAThread thread,
69         ReferenceType referenceType,
70         Variable variable
71     ) {
72         super (sourceBreakpoint);
73         this.conditionResult = conditionResult;
74         this.thread = thread;
75         this.debugger = debugger;
76         this.referenceType = referenceType;
77         this.variable = variable;
78     }
79     
80     /**
81      * Creates a new instance of JPDABreakpointEvent.
82      *
83      * @param sourceBreakpoint a breakpoint
84      * @param conditionException result of condition
85      * @param thread a context thread
86      * @param debugger a debugger this
87      * @param referenceType a context class
88      * @param variable a context variable
89      */

90     public JPDABreakpointEvent (
91         JPDABreakpoint sourceBreakpoint,
92         JPDADebugger debugger,
93         Throwable JavaDoc conditionException,
94         JPDAThread thread,
95         ReferenceType referenceType,
96         Variable variable
97     ) {
98         super (sourceBreakpoint);
99         this.conditionResult = CONDITION_FAILED;
100         this.conditionException = conditionException;
101         this.thread = thread;
102         this.debugger = debugger;
103         this.referenceType = referenceType;
104         this.variable = variable;
105     }
106     
107     /**
108      * Returns result of condition evaluation.
109      *
110      * @return result of condition evaluation
111      */

112     public int getConditionResult () {
113         return conditionResult;
114     }
115     
116     /**
117      * Returns result of condition evaluation.
118      *
119      * @return result of condition evaluation
120      */

121     public Throwable JavaDoc getConditionException () {
122         return conditionException;
123     }
124     
125     /**
126      * Returns context thread - thread stopped on breakpoint. This parameter
127      * is defined by class prepared breakpoint, exception breakpoint,
128      * field breakpoint, line breakpoint, method breakpoint and
129      * thread breakpoint.
130      *
131      * @return thread context
132      */

133     public JPDAThread getThread () {
134         return thread;
135     }
136     
137     /**
138      * Returns context class. It means loaded class for class load breakpoint
139      * and exception class for exception breakpoint.
140      *
141      * @return context class
142      */

143     public ReferenceType getReferenceType () {
144         return referenceType;
145     }
146     
147     /**
148      * Returns JPDADebugger instance this breakpoint has been reached in.
149      *
150      * @return JPDADebugger instance this breakpoint has been reached in
151      */

152     public JPDADebugger getDebugger () {
153         return debugger;
154     }
155     
156     /**
157      * Returns context variable. It contains new value for field modification
158      * breakpoint and instance of exception for exception breakpoint.
159      *
160      * @return context variable
161      */

162     public Variable getVariable () {
163         return variable;
164     }
165     
166     /**
167      * Call this method to resume debugger after all events will be notified.
168      * You should not call JPDADebugger.resume () during breakpoint event
169      * evaluation!
170      */

171     public void resume () {
172         resume = true;
173     }
174     
175     /**
176      * Returns resume value.
177      */

178     public boolean getResume () {
179         return resume;
180     }
181 }
182
Popular Tags