KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > tools > example > debug > gui > JDBToolBar


1 /*
2  * @(#)JDBToolBar.java 1.12 05/11/17
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 /*
8  * Copyright (c) 1997-1999 by Sun Microsystems, Inc. All Rights Reserved.
9  *
10  * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
11  * modify and redistribute this software in source and binary code form,
12  * provided that i) this copyright notice and license appear on all copies of
13  * the software; and ii) Licensee does not utilize the software in a manner
14  * which is disparaging to Sun.
15  *
16  * This software is provided "AS IS," without a warranty of any kind. ALL
17  * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
18  * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
19  * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
20  * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
21  * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
22  * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
23  * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
24  * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
25  * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGES.
27  *
28  * This software is not designed or intended for use in on-line control of
29  * aircraft, air traffic, aircraft navigation or aircraft communications; or in
30  * the design, construction, operation or maintenance of any nuclear
31  * facility. Licensee represents and warrants that it will not use or
32  * redistribute the Software for such purposes.
33  */

34
35 package com.sun.tools.example.debug.gui;
36
37 import javax.swing.*;
38 import java.awt.*;
39 import java.awt.event.*;
40
41 import com.sun.jdi.*;
42 import com.sun.tools.example.debug.bdi.*;
43
44 class JDBToolBar extends JToolBar {
45
46     Environment env;
47
48     ExecutionManager runtime;
49     ClassManager classManager;
50     SourceManager sourceManager;
51
52     CommandInterpreter interpreter;
53
54     JDBToolBar(Environment env) {
55
56     this.env = env;
57     this.runtime = env.getExecutionManager();
58     this.classManager = env.getClassManager();
59     this.sourceManager = env.getSourceManager();
60     this.interpreter = new CommandInterpreter(env, true);
61
62     //===== Configure toolbar here =====
63

64     addTool("Run application", "run", "run");
65     addTool("Connect to application", "connect", "connect");
66     addSeparator();
67
68     addTool("Step into next line", "step", "step");
69     addTool("Step over next line", "next", "next");
70 // addSeparator();
71

72 // addTool("Step into next instruction", "stepi", "stepi");
73
// addTool("Step over next instruction", "nexti", "nexti");
74
// addSeparator();
75

76     addTool("Step out of current method call", "step up", "step up");
77     addSeparator();
78
79     addTool("Suspend execution", "interrupt", "interrupt");
80     addTool("Continue execution", "cont", "cont");
81     addSeparator();
82
83 // addTool("Display current stack", "where", "where");
84
// addSeparator();
85

86     addTool("Move up one stack frame", "up", "up");
87     addTool("Move down one stack frame", "down", "down");
88 // addSeparator();
89

90 // addTool("Display command list", "help", "help");
91
// addSeparator();
92

93 // addTool("Exit debugger", "exit", "exit");
94

95     //==================================
96

97     }
98     
99     private void addTool(String JavaDoc toolTip, String JavaDoc labelText, String JavaDoc command) {
100     JButton button = new JButton(labelText);
101     button.setToolTipText(toolTip);
102     final String JavaDoc cmd = command;
103     button.addActionListener(new ActionListener() {
104         public void actionPerformed(ActionEvent e) {
105         interpreter.executeCommand(cmd);
106         }
107     });
108     this.add(button);
109     }
110
111 }
112
Popular Tags