001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.cnd.debugger.gdb.event;
043:
044: import java.util.EventObject;
045:
046: import org.netbeans.modules.cnd.debugger.gdb.GdbDebugger;
047: import org.netbeans.modules.cnd.debugger.gdb.Variable;
048: import org.netbeans.modules.cnd.debugger.gdb.breakpoints.GdbBreakpoint;
049:
050: /**
051: * GdbBreakpoint event notification.
052: */
053: public final class GdbBreakpointEvent extends EventObject {
054:
055: /** Condition result constant. */
056: public static final int CONDITION_NONE = 0;
057:
058: /** Condition result constant. */
059: public static final int CONDITION_TRUE = 1;
060:
061: /** Condition result constant. */
062: public static final int CONDITION_FALSE = 2;
063:
064: /** Condition result constant. */
065: public static final int CONDITION_FAILED = 3;
066:
067: private int conditionResult = CONDITION_FAILED;
068: private Throwable conditionException = null;
069: private GdbDebugger debugger;
070: //private CndThread thread;
071: //private ReferenceType referenceType;
072: private Variable variable;
073: private boolean resume = false;
074:
075: /**
076: * Creates a new instance of GdbBreakpointEvent. This method should be
077: * called from debuggergdb module only. Do not create a new instances
078: * of this class!
079: *
080: * @param sourceBreakpoint a breakpoint
081: * @param debugger a debugger this
082: * @param conditionResult a result of condition
083: * @param variable a context variable
084: */
085: public GdbBreakpointEvent(GdbBreakpoint sourceBreakpoint,
086: GdbDebugger debugger, int conditionResult, Variable variable) {
087: super (sourceBreakpoint);
088: this .conditionResult = conditionResult;
089: this .debugger = debugger;
090: this .variable = variable;
091: }
092:
093: /**
094: * Creates a new instance of GdbBreakpointEvent.
095: *
096: * @param sourceBreakpoint a breakpoint
097: * @param conditionException result of condition
098: * @param debugger a debugger this
099: * @param variable a context variable
100: */
101: public GdbBreakpointEvent(GdbBreakpoint sourceBreakpoint,
102: GdbDebugger debugger, Throwable conditionException,
103: Variable variable) {
104: super (sourceBreakpoint);
105: this .conditionResult = CONDITION_FAILED;
106: this .conditionException = conditionException;
107: this .debugger = debugger;
108: this .variable = variable;
109: }
110:
111: /**
112: * Returns result of condition evaluation.
113: *
114: * @return result of condition evaluation
115: */
116: public int getConditionResult() {
117: return conditionResult;
118: }
119:
120: /**
121: * Returns result of condition evaluation.
122: *
123: * @return result of condition evaluation
124: */
125: public Throwable getConditionException() {
126: return conditionException;
127: }
128:
129: /**
130: * Returns GdbDebugger instance this breakpoint has been reached in.
131: *
132: * @return GdbDebugger instance this breakpoint has been reached in
133: */
134: public GdbDebugger getDebugger() {
135: return debugger;
136: }
137:
138: /**
139: * Call this method to resume debugger after all events have been notified.
140: * You should not call GdbDebugger.resume() during breakpoint event
141: * evaluation!
142: */
143: public void resume() {
144: resume = true;
145: }
146:
147: /**
148: * Returns resume value.
149: */
150: public boolean getResume() {
151: return resume;
152: }
153: }
|