KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > debugger > test > actions > TestDebuggerActionsProvider


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.actions;
21
22 import org.netbeans.spi.debugger.ActionsProvider;
23 import org.netbeans.spi.debugger.ActionsProviderListener;
24 import org.netbeans.spi.debugger.ContextProvider;
25 import org.netbeans.api.debugger.ActionsManager;
26 import org.netbeans.api.debugger.test.TestDebugger;
27 import org.netbeans.api.debugger.test.TestDICookie;
28
29 import java.util.*;
30
31 /**
32  * Provides all debugging actions and records when they are performed.
33  *
34  * @author Maros Sandor
35  */

36 public class TestDebuggerActionsProvider extends ActionsProvider {
37
38     private TestDebugger debuggerImpl;
39     private ContextProvider lookupProvider;
40     private Set supportedActions;
41
42     public TestDebuggerActionsProvider(ContextProvider lookupProvider) {
43         debuggerImpl = (TestDebugger) lookupProvider.lookupFirst(null, TestDebugger.class);
44         this.lookupProvider = lookupProvider;
45         supportedActions = new HashSet();
46         supportedActions.add(ActionsManager.ACTION_CONTINUE);
47         supportedActions.add(ActionsManager.ACTION_FIX);
48         supportedActions.add(ActionsManager.ACTION_MAKE_CALLEE_CURRENT);
49         supportedActions.add(ActionsManager.ACTION_MAKE_CALLER_CURRENT);
50         supportedActions.add(ActionsManager.ACTION_PAUSE);
51         supportedActions.add(ActionsManager.ACTION_POP_TOPMOST_CALL);
52         supportedActions.add(ActionsManager.ACTION_RESTART);
53         supportedActions.add(ActionsManager.ACTION_RUN_INTO_METHOD);
54         supportedActions.add(ActionsManager.ACTION_RUN_TO_CURSOR);
55         supportedActions.add(ActionsManager.ACTION_STEP_INTO);
56         supportedActions.add(ActionsManager.ACTION_STEP_OUT);
57         supportedActions.add(ActionsManager.ACTION_STEP_OVER);
58         supportedActions.add(ActionsManager.ACTION_TOGGLE_BREAKPOINT);
59     }
60
61     public Set getActions () {
62         return supportedActions;
63     }
64
65     public void doAction (Object JavaDoc action) {
66         if (debuggerImpl == null) return;
67         final TestDICookie cookie = (TestDICookie) lookupProvider.lookupFirst(null, TestDICookie.class);
68         cookie.addInfo(action);
69     }
70
71     public boolean isEnabled (Object JavaDoc action) {
72         return true;
73     }
74
75     public void addActionsProviderListener (ActionsProviderListener l) {}
76     public void removeActionsProviderListener (ActionsProviderListener l) {}
77 }
78
Popular Tags