KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > debugger > jpda > JPDAStep


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 package org.netbeans.api.debugger.jpda;
20
21 import java.beans.PropertyChangeListener JavaDoc;
22 import java.beans.PropertyChangeSupport JavaDoc;
23
24 import com.sun.jdi.request.StepRequest;
25
26 /**
27  * Represents one JPDA step.
28  *
29  * @author Roman Ondruska
30  */

31 public abstract class JPDAStep {
32     private int size;
33     private int depth;
34     private boolean hidden;
35     /** Associated JPDA debugger */
36     protected JPDADebugger debugger;
37     private PropertyChangeSupport JavaDoc pcs;
38
39     /** Step into any newly pushed frames */
40     public static final int STEP_INTO = StepRequest.STEP_INTO;
41     /** Step over any newly pushed frames */
42     public static final int STEP_OVER = StepRequest.STEP_OVER;
43     /** Step out of the current frame */
44     public static final int STEP_OUT = StepRequest.STEP_OUT;
45     /** Step to the next location on a different line */
46     public static final int STEP_LINE = StepRequest.STEP_LINE;
47     /** Step to the next available operation */
48     public static final int STEP_OPERATION = 10;
49     /** Step to the next available location */
50     public static final int STEP_MIN = StepRequest.STEP_MIN;
51     /** Property fired when the step is executed */
52     public static final String JavaDoc PROP_STATE_EXEC = "exec";
53     
54     /** Constructs a JPDAStep for given {@link org.netbeans.api.debugger.jpda.JPDADebugger},
55      * size {@link #STEP_LINE}, {@link #STEP_MIN}
56      * and depth {@link #STEP_OUT}, {@link #STEP_INTO}.
57      *
58      * @param debugger an associated JPDADebuger
59      * @param size step size
60      * @param depth step depth
61      */

62     public JPDAStep(JPDADebugger debugger, int size, int depth) {
63         this.size = size;
64         this.depth = depth;
65         this.debugger = debugger;
66         this.hidden = false;
67         pcs = new PropertyChangeSupport JavaDoc(this);
68     }
69    
70     /** Sets the hidden property. */
71     public void setHidden(boolean hidden) {
72         this.hidden = hidden;
73     }
74     
75     /**
76      * Returns hidden property of the step.
77      *
78      * @return hidden property
79      */

80     public boolean getHidden() {
81         return hidden;
82     }
83     
84     /** Sets size of the step.
85      * @param size step size
86      */

87     public void setSize(int size) {
88         this.size = size;
89     }
90     
91     /**
92      * Returns size of the step.
93      *
94      * @return step size
95      */

96     public int getSize() {
97         return size;
98     }
99     
100     /** Sets depth of the step.
101      * @param depth step depth
102      */

103     public void setDepth(int depth) {
104         this.depth = depth;
105     }
106     
107     /**
108      * Returns depth of the step.
109      *
110      * @return step depth
111      */

112     public int getDepth() {
113         return depth;
114     }
115     
116     /** Adds the step request to the associated
117      * {@link org.netbeans.api.debugger.jpda.JPDADebugger}.
118      * Method is not synchronized.
119      *
120      * @param tr associated thread
121      */

122     public abstract void addStep(JPDAThread tr);
123     
124     /**
125     * Adds property change listener.
126     *
127     * @param l new listener.
128     */

129     public void addPropertyChangeListener (PropertyChangeListener JavaDoc l) {
130         pcs.addPropertyChangeListener (l);
131     }
132
133     /**
134     * Removes property change listener.
135     *
136     * @param l removed listener.
137     */

138     public void removePropertyChangeListener (PropertyChangeListener JavaDoc l) {
139         pcs.removePropertyChangeListener (l);
140     }
141
142     /**
143     * Adds property change listener.
144     *
145     * @param l new listener.
146     */

147     public void addPropertyChangeListener (String JavaDoc propertyName, PropertyChangeListener JavaDoc l) {
148         pcs.addPropertyChangeListener (propertyName, l);
149     }
150
151     /**
152     * Removes property change listener.
153     *
154     * @param l removed listener.
155     */

156     public void removePropertyChangeListener (String JavaDoc propertyName, PropertyChangeListener JavaDoc l) {
157         pcs.removePropertyChangeListener (propertyName, l);
158     }
159     
160     /**
161     * Fires property change.
162     */

163     protected void firePropertyChange (String JavaDoc name, Object JavaDoc o, Object JavaDoc n) {
164         pcs.firePropertyChange (name, o, n);
165     }
166     
167 }
168
Popular Tags