Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/ui/FindPanel.java @ 18109:b72ce1826bd0
Truffle: revert back to typed primitives, but make the primitive array an int[]
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 15 Oct 2014 19:25:43 +0200 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. |
0 | 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. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.ui; | |
26 | |
27 import java.io.*; | |
28 import java.awt.*; | |
29 import java.awt.event.*; | |
30 import javax.swing.*; | |
31 import javax.swing.text.*; | |
32 | |
33 import sun.jvm.hotspot.debugger.*; | |
34 import sun.jvm.hotspot.runtime.*; | |
35 import sun.jvm.hotspot.utilities.*; | |
36 | |
37 /** Uses {@link sun.jvm.hotspot.utilities.PointerFinder} to provide a | |
38 graphical user interface to the VM's debugging utility "find". */ | |
39 | |
40 public class FindPanel extends JPanel { | |
41 // UI widgets we need permanent handles to | |
42 private JTextField addressField; | |
43 private JTextArea textArea; | |
44 private JLabel statusLabel; | |
45 | |
46 public FindPanel() { | |
47 super(); | |
48 | |
49 setLayout(new BorderLayout()); | |
50 Box hbox = Box.createHorizontalBox(); | |
51 hbox.add(new JLabel("Address: ")); | |
52 addressField = new JTextField(20); | |
53 hbox.add(addressField); | |
54 statusLabel = new JLabel(); | |
55 hbox.add(statusLabel); | |
56 add(hbox, BorderLayout.NORTH); | |
57 | |
58 JScrollPane scroller = new JScrollPane(); | |
59 textArea = new JTextArea(); | |
60 textArea.setEditable(false); | |
61 textArea.setLineWrap(true); | |
62 textArea.setWrapStyleWord(true); | |
63 scroller.getViewport().add(textArea); | |
64 add(scroller, BorderLayout.CENTER); | |
65 | |
66 addressField.addActionListener(new ActionListener() { | |
67 public void actionPerformed(ActionEvent e) { | |
68 try { | |
69 Address a = VM.getVM().getDebugger().parseAddress(addressField.getText()); | |
70 PointerLocation loc = PointerFinder.find(a); | |
71 ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |
72 loc.printOn(new PrintStream(bos)); | |
73 clear(); | |
74 textArea.append(bos.toString()); | |
75 statusLabel.setText(""); | |
76 } | |
77 catch (NumberFormatException ex) { | |
78 statusLabel.setText("<parse error>"); | |
79 } | |
80 catch (AddressException ex) { | |
81 statusLabel.setText("<bad address>"); | |
82 } | |
83 catch (Exception ex) { | |
84 ex.printStackTrace(); | |
85 statusLabel.setText("<error during find>"); | |
86 } | |
87 } | |
88 }); | |
89 } | |
90 | |
91 private void clear() { | |
92 Document doc = textArea.getDocument(); | |
93 if (doc.getLength() > 0) { | |
94 try { | |
95 doc.remove(0, doc.getLength()); | |
96 } | |
97 catch (BadLocationException e) { | |
98 } | |
99 } | |
100 } | |
101 } |