Showing the changes to java/pkg/com/sun/tools/example/debug/gui/JDBToolBar.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,101 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package com.sun.tools.example.debug.gui; | |
| 27 | + | |
| 28 | +import javax.swing.*; | |
| 29 | +import java.awt.event.*; | |
| 30 | + | |
| 31 | +import com.sun.tools.example.debug.bdi.*; | |
| 32 | + | |
| 33 | +class JDBToolBar extends JToolBar { | |
| 34 | + | |
| 35 | + Environment env; | |
| 36 | + | |
| 37 | + ExecutionManager runtime; | |
| 38 | + ClassManager classManager; | |
| 39 | + SourceManager sourceManager; | |
| 40 | + | |
| 41 | + CommandInterpreter interpreter; | |
| 42 | + | |
| 43 | + JDBToolBar(Environment env) { | |
| 44 | + | |
| 45 | + this.env = env; | |
| 46 | + this.runtime = env.getExecutionManager(); | |
| 47 | + this.classManager = env.getClassManager(); | |
| 48 | + this.sourceManager = env.getSourceManager(); | |
| 49 | + this.interpreter = new CommandInterpreter(env, true); | |
| 50 | + | |
| 51 | + //===== Configure toolbar here ===== | |
| 52 | + | |
| 53 | + addTool("Run application", "run", "run"); | |
| 54 | + addTool("Connect to application", "connect", "connect"); | |
| 55 | + addSeparator(); | |
| 56 | + | |
| 57 | + addTool("Step into next line", "step", "step"); | |
| 58 | + addTool("Step over next line", "next", "next"); | |
| 59 | +// addSeparator(); | |
| 60 | + | |
| 61 | +// addTool("Step into next instruction", "stepi", "stepi"); | |
| 62 | +// addTool("Step over next instruction", "nexti", "nexti"); | |
| 63 | +// addSeparator(); | |
| 64 | + | |
| 65 | + addTool("Step out of current method call", "step up", "step up"); | |
| 66 | + addSeparator(); | |
| 67 | + | |
| 68 | + addTool("Suspend execution", "interrupt", "interrupt"); | |
| 69 | + addTool("Continue execution", "cont", "cont"); | |
| 70 | + addSeparator(); | |
| 71 | + | |
| 72 | +// addTool("Display current stack", "where", "where"); | |
| 73 | +// addSeparator(); | |
| 74 | + | |
| 75 | + addTool("Move up one stack frame", "up", "up"); | |
| 76 | + addTool("Move down one stack frame", "down", "down"); | |
| 77 | +// addSeparator(); | |
| 78 | + | |
| 79 | +// addTool("Display command list", "help", "help"); | |
| 80 | +// addSeparator(); | |
| 81 | + | |
| 82 | +// addTool("Exit debugger", "exit", "exit"); | |
| 83 | + | |
| 84 | + //================================== | |
| 85 | + | |
| 86 | + } | |
| 87 | + | |
| 88 | + private void addTool(String toolTip, String labelText, String command) { | |
| 89 | + JButton button = new JButton(labelText); | |
| 90 | + button.setToolTipText(toolTip); | |
| 91 | + final String cmd = command; | |
| 92 | + button.addActionListener(new ActionListener() { | |
| 93 | + @Override | |
| 94 | + public void actionPerformed(ActionEvent e) { | |
| 95 | + interpreter.executeCommand(cmd); | |
| 96 | + } | |
| 97 | + }); | |
| 98 | + this.add(button); | |
| 99 | + } | |
| 100 | + | |
| 101 | +} | |