KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > debugger > jpda > breakpoints > ClassBreakpointImpl


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.modules.debugger.jpda.breakpoints;
21
22 import com.sun.jdi.event.ClassPrepareEvent;
23 import com.sun.jdi.event.Event;
24
25 import org.netbeans.api.debugger.Session;
26 import org.netbeans.api.debugger.jpda.ClassLoadUnloadBreakpoint;
27 import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl;
28
29 /**
30 * Implementation of breakpoint on method.
31 *
32 * @author Jan Jancura
33 */

34 public class ClassBreakpointImpl extends ClassBasedBreakpoint {
35
36     private ClassLoadUnloadBreakpoint breakpoint;
37
38
39     public ClassBreakpointImpl (
40         ClassLoadUnloadBreakpoint breakpoint,
41         JPDADebuggerImpl debugger,
42         Session session
43     ) {
44         super (breakpoint, debugger, session);
45         this.breakpoint = breakpoint;
46         set ();
47     }
48     
49     protected void setRequests () {
50         setClassRequests (
51             breakpoint.getClassFilters (),
52             breakpoint.getClassExclusionFilters (),
53             breakpoint.getBreakpointType ()
54         );
55     }
56
57     public boolean exec (Event event) {
58         if (event instanceof ClassPrepareEvent)
59             try {
60                 return perform (
61                     null,
62                     ((ClassPrepareEvent) event).thread (),
63                     ((ClassPrepareEvent) event).referenceType (),
64                     ((ClassPrepareEvent) event).referenceType ().classObject ()
65                 );
66             } catch (UnsupportedOperationException JavaDoc ex) {
67                 // PATCH for KVM. They does not support
68
// ReferenceType.classObject ()
69
return perform (
70                     null,
71                     ((ClassPrepareEvent) event).thread (),
72                     ((ClassPrepareEvent) event).referenceType (),
73                     null
74                 );
75             }
76         else
77             return perform (
78                 null,
79                 null,
80                 null,
81                 null
82             );
83     }
84 }
85
86
Popular Tags