KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > debugger > test > TestDebuggerManagerListener


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.test;
21
22 import org.netbeans.api.debugger.*;
23
24 import java.util.*;
25 import java.beans.PropertyChangeEvent JavaDoc;
26
27 /**
28  * A test debugger manager listener implementation.
29  *
30  * @author Maros Sandor
31  */

32 public class TestDebuggerManagerListener implements DebuggerManagerListener {
33
34     public static class Event {
35
36         String JavaDoc name;
37         Object JavaDoc param;
38
39         public Event(String JavaDoc name, Object JavaDoc param) {
40             this.name = name;
41             this.param = param;
42         }
43
44         public boolean equals(Object JavaDoc o) {
45             if (this == o) return true;
46             if (!(o instanceof Event JavaDoc)) return false;
47
48             final Event JavaDoc event = (Event JavaDoc) o;
49
50             if (!name.equals(event.name)) return false;
51             if (param != null ? !param.equals(event.param) : event.param != null) return false;
52
53             return true;
54         }
55
56         public int hashCode() {
57             int result;
58             result = name.hashCode();
59             result = 29 * result + (param != null ? param.hashCode() : 0);
60             return result;
61         }
62
63         public String JavaDoc getName() {
64             return name;
65         }
66
67         public Object JavaDoc getParam() {
68             return param;
69         }
70     }
71
72     private List events = new ArrayList();
73
74     public List getEvents() {
75         List listCopy = new ArrayList(events);
76         events.clear();
77         return listCopy;
78     }
79
80     public void breakpointAdded(Breakpoint breakpoint) {
81         events.add(new Event JavaDoc("breakpointAdded", breakpoint));
82     }
83
84     public void breakpointRemoved(Breakpoint breakpoint) {
85         events.add(new Event JavaDoc("breakpointRemoved", breakpoint));
86     }
87
88     public void watchAdded(Watch watch) {
89         events.add(new Event JavaDoc("watchAdded", watch));
90     }
91
92     public void watchRemoved(Watch watch) {
93         events.add(new Event JavaDoc("watchRemoved", watch));
94     }
95
96     public void sessionAdded(Session session) {
97         events.add(new Event JavaDoc("sessionAdded", session));
98     }
99
100     public void sessionRemoved(Session session) {
101         events.add(new Event JavaDoc("sessionRemoved", session));
102     }
103
104     public void propertyChange(PropertyChangeEvent JavaDoc evt) {
105         events.add(new Event JavaDoc("propertyChange", evt));
106     }
107
108     public Breakpoint[] initBreakpoints() {
109         return new Breakpoint[0];
110     }
111
112     public void initWatches() {
113     }
114
115     // TODO: Include check of these call in the test suite
116
public void engineAdded(DebuggerEngine engine) {
117     }
118
119     // TODO: Include check of these call in the test suite
120
public void engineRemoved(DebuggerEngine engine) {
121     }
122 }
123
Popular Tags