annotate agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/CodeViewerPanel.java @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents c18cbe5936b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.ui.classbrowser;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.awt.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import java.awt.event.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 import javax.swing.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 import javax.swing.event.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 import javax.swing.text.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
32 import sun.jvm.hotspot.ui.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 import sun.jvm.hotspot.code.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 import sun.jvm.hotspot.debugger.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 import sun.jvm.hotspot.oops.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 import sun.jvm.hotspot.runtime.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 public class CodeViewerPanel extends JPanel {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 protected SAEditorPane contentEditor;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 protected HistoryComboBox address;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 protected HTMLGenerator htmlGen;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 protected JScrollPane scrollPane;
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 public CodeViewerPanel() {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 htmlGen = new HTMLGenerator();
a61af66fc99e Initial load
duke
parents:
diff changeset
46 contentEditor = new SAEditorPane();
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 HyperlinkListener hyperListener = new HyperlinkListener() {
a61af66fc99e Initial load
duke
parents:
diff changeset
49 public void hyperlinkUpdate(HyperlinkEvent e) {
a61af66fc99e Initial load
duke
parents:
diff changeset
50 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 String description = e.getDescription();
a61af66fc99e Initial load
duke
parents:
diff changeset
52 int equalToIndex = description.indexOf('=');
a61af66fc99e Initial load
duke
parents:
diff changeset
53 if (equalToIndex != -1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 String item = description.substring(0, equalToIndex);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 if (item.equals("pc") || item.equals("klass") || item.equals("method")) {
a61af66fc99e Initial load
duke
parents:
diff changeset
56 address.setText(description.substring(equalToIndex + 1));
a61af66fc99e Initial load
duke
parents:
diff changeset
57 }
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59 contentEditor.setText(htmlGen.genHTMLForHyperlink(description));
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61 }
a61af66fc99e Initial load
duke
parents:
diff changeset
62 };
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 setLayout(new BorderLayout());
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 JPanel topPanel = new JPanel();
a61af66fc99e Initial load
duke
parents:
diff changeset
68 topPanel.setLayout(new BorderLayout());
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1552
diff changeset
69 topPanel.add(new JLabel("Enter PC or Method*/Klass* Address: "), BorderLayout.WEST);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
70 address = new HistoryComboBox();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 topPanel.add(address, BorderLayout.CENTER);
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 JPanel bottomPanel = new JPanel();
a61af66fc99e Initial load
duke
parents:
diff changeset
74 bottomPanel.setLayout(new GridLayout(1, 1));
a61af66fc99e Initial load
duke
parents:
diff changeset
75 contentEditor = new SAEditorPane();
a61af66fc99e Initial load
duke
parents:
diff changeset
76 contentEditor.addHyperlinkListener(hyperListener);
a61af66fc99e Initial load
duke
parents:
diff changeset
77 scrollPane = new JScrollPane(contentEditor);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 bottomPanel.add(scrollPane);
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 add(topPanel, BorderLayout.NORTH);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 add(bottomPanel, BorderLayout.CENTER);
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 address.addActionListener(new ActionListener() {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 public void actionPerformed(ActionEvent e) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 viewAddress();
a61af66fc99e Initial load
duke
parents:
diff changeset
86 }
a61af66fc99e Initial load
duke
parents:
diff changeset
87 });
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 private void viewAddress() {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 if (address.getText() != null && !address.getText().equals("")) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 contentEditor.setText(htmlGen.genHTMLForAddress(address.getText()));
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 public void viewAddress(Address addr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
98 address.setText(addr.toString());
a61af66fc99e Initial load
duke
parents:
diff changeset
99 viewAddress();
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }