提交 5320dfad 编写于 作者: E egahlin

7017818: NLS: JConsoleResources.java cannot be handled by translation team

Reviewed-by: mchung, mfang
上级 836597bf
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
<fileset dir="${classes.dir}"> <fileset dir="${classes.dir}">
<include name="sun/tools/jconsole/**/*.class"/> <include name="sun/tools/jconsole/**/*.class"/>
<include name="com/sun/tools/jconsole/**/*.class"/> <include name="com/sun/tools/jconsole/**/*.class"/>
<include name="sun/tools/jconsole/resources/*.properties"/>
<include name="sun/tools/jconsole/resources/*.gif"/> <include name="sun/tools/jconsole/resources/*.gif"/>
<include name="sun/tools/jconsole/resources/*.png"/> <include name="sun/tools/jconsole/resources/*.png"/>
</fileset> </fileset>
......
...@@ -30,17 +30,22 @@ ...@@ -30,17 +30,22 @@
MANIFEST = sun/tools/jconsole/manifest MANIFEST = sun/tools/jconsole/manifest
PNG_FILES = \ PNG_FILES = \
sun/tools/jconsole/resources/brandlogo.png \ sun/tools/jconsole/resources/brandlogo.png \
sun/tools/jconsole/resources/collapse-winlf.png \ sun/tools/jconsole/resources/collapse-winlf.png \
sun/tools/jconsole/resources/connected16.png \ sun/tools/jconsole/resources/connected16.png \
sun/tools/jconsole/resources/connected24.png \ sun/tools/jconsole/resources/connected24.png \
sun/tools/jconsole/resources/disconnected16.png \ sun/tools/jconsole/resources/disconnected16.png \
sun/tools/jconsole/resources/disconnected24.png \ sun/tools/jconsole/resources/disconnected24.png \
sun/tools/jconsole/resources/expand-winlf.png \ sun/tools/jconsole/resources/expand-winlf.png \
sun/tools/jconsole/resources/masthead-left.png \ sun/tools/jconsole/resources/masthead-left.png \
sun/tools/jconsole/resources/masthead-right.png sun/tools/jconsole/resources/masthead-right.png
GIF_FILES = \ GIF_FILES = \
sun/tools/jconsole/resources/mbean.gif \ sun/tools/jconsole/resources/mbean.gif \
sun/tools/jconsole/resources/mbeanserverdelegate.gif \ sun/tools/jconsole/resources/mbeanserverdelegate.gif \
sun/tools/jconsole/resources/xobject.gif sun/tools/jconsole/resources/xobject.gif
PROP_FILES = \
sun/tools/jconsole/resources/messages.properties \
sun/tools/jconsole/resources/messages_ja.properties \
sun/tools/jconsole/resources/messages_zh_CN.properties
...@@ -53,21 +53,21 @@ AUTO_FILES_JAVA_DIRS = sun/tools/jconsole \ ...@@ -53,21 +53,21 @@ AUTO_FILES_JAVA_DIRS = sun/tools/jconsole \
FILES_png = $(PNG_FILES:%.png=$(CLASSBINDIR)/%.png) FILES_png = $(PNG_FILES:%.png=$(CLASSBINDIR)/%.png)
FILES_gif = $(GIF_FILES:%.gif=$(CLASSBINDIR)/%.gif) FILES_gif = $(GIF_FILES:%.gif=$(CLASSBINDIR)/%.gif)
FILES_prop = $(PROP_FILES:%.properties=$(CLASSBINDIR)/%.properties)
build: $(GENSRCDIR)/sun/tools/jconsole/Version.java build: $(GENSRCDIR)/sun/tools/jconsole/Version.java
# #
# Resources # Resources
# #
LOCALE_SET_DEFINITION = jdk LOCALE_SET_DEFINITION = jdk
RESOURCE_BUNDLES_JAVA = $(PKGDIR)/resources/JConsoleResources.java RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/messages.properties
# #
# Rules. # Rules.
# #
include $(BUILDDIR)/common/Classes.gmk include $(BUILDDIR)/common/Classes.gmk
build: $(FILES_png) $(FILES_gif) $(TEMPDIR)/manifest $(JARFILE) build: $(FILES_png) $(FILES_gif) $(FILES_prop) $(TEMPDIR)/manifest $(JARFILE)
$(GENSRCDIR)/sun/tools/jconsole/Version.java: \ $(GENSRCDIR)/sun/tools/jconsole/Version.java: \
$(SHARE_SRC)/classes/sun/tools/jconsole/Version.java.template $(SHARE_SRC)/classes/sun/tools/jconsole/Version.java.template
...@@ -85,7 +85,7 @@ $(TEMPDIR)/manifest: $(SHARE_SRC)/classes/$(PKGDIR)/manifest ...@@ -85,7 +85,7 @@ $(TEMPDIR)/manifest: $(SHARE_SRC)/classes/$(PKGDIR)/manifest
# Extra rule to build jconsole.jar # Extra rule to build jconsole.jar
# #
$(JARFILE): $(LIBDIR) $(FILES_class) $(FILES_png) $(FILES_gif) $(TEMPDIR)/manifest $(JARFILE): $(LIBDIR) $(FILES_class) $(FILES_png) $(FILES_gif) $(FILES_prop) $(TEMPDIR)/manifest
$(BOOT_JAR_CMD) -cfm $(JARFILE) $(TEMPDIR)/manifest \ $(BOOT_JAR_CMD) -cfm $(JARFILE) $(TEMPDIR)/manifest \
-C $(CLASSBINDIR) sun/tools/jconsole \ -C $(CLASSBINDIR) sun/tools/jconsole \
-C $(CLASSBINDIR) com/sun/tools/jconsole \ -C $(CLASSBINDIR) com/sun/tools/jconsole \
......
...@@ -30,13 +30,12 @@ import java.awt.event.*; ...@@ -30,13 +30,12 @@ import java.awt.event.*;
import java.beans.PropertyVetoException; import java.beans.PropertyVetoException;
import java.net.URI; import java.net.URI;
import javax.accessibility.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.*; import javax.swing.event.*;
import static java.awt.BorderLayout.*; import static java.awt.BorderLayout.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
...@@ -47,7 +46,7 @@ public class AboutDialog extends InternalDialog { ...@@ -47,7 +46,7 @@ public class AboutDialog extends InternalDialog {
private static final Color borderColor = Color.black; private static final Color borderColor = Color.black;
private Icon mastheadIcon = private Icon mastheadIcon =
new MastheadIcon(getText("Help.AboutDialog.masthead.title")); new MastheadIcon(Messages.HELP_ABOUT_DIALOG_MASTHEAD_TITLE);
private static AboutDialog aboutDialog; private static AboutDialog aboutDialog;
...@@ -55,10 +54,9 @@ public class AboutDialog extends InternalDialog { ...@@ -55,10 +54,9 @@ public class AboutDialog extends InternalDialog {
private Action closeAction; private Action closeAction;
public AboutDialog(JConsole jConsole) { public AboutDialog(JConsole jConsole) {
super(jConsole, Resources.getText("Help.AboutDialog.title"), false); super(jConsole, Messages.HELP_ABOUT_DIALOG_TITLE, false);
setAccessibleDescription(this, setAccessibleDescription(this, Messages.HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION);
getText("Help.AboutDialog.accessibleDescription"));
setDefaultCloseOperation(HIDE_ON_CLOSE); setDefaultCloseOperation(HIDE_ON_CLOSE);
setResizable(false); setResizable(false);
JComponent cp = (JComponent)getContentPane(); JComponent cp = (JComponent)getContentPane();
...@@ -67,7 +65,7 @@ public class AboutDialog extends InternalDialog { ...@@ -67,7 +65,7 @@ public class AboutDialog extends InternalDialog {
JLabel mastheadLabel = new JLabel(mastheadIcon); JLabel mastheadLabel = new JLabel(mastheadIcon);
setAccessibleName(mastheadLabel, setAccessibleName(mastheadLabel,
getText("Help.AboutDialog.masthead.accessibleName")); Messages.HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME);
JPanel mainPanel = new TPanel(0, 0); JPanel mainPanel = new TPanel(0, 0);
mainPanel.add(mastheadLabel, NORTH); mainPanel.add(mastheadLabel, NORTH);
...@@ -75,7 +73,7 @@ public class AboutDialog extends InternalDialog { ...@@ -75,7 +73,7 @@ public class AboutDialog extends InternalDialog {
String jConsoleVersion = Version.getVersion(); String jConsoleVersion = Version.getVersion();
String vmName = System.getProperty("java.vm.name"); String vmName = System.getProperty("java.vm.name");
String vmVersion = System.getProperty("java.vm.version"); String vmVersion = System.getProperty("java.vm.version");
String urlStr = getText("Help.AboutDialog.userGuideLink.url"); String urlStr = Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL;
if (isBrowseSupported()) { if (isBrowseSupported()) {
urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>"; urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>";
} }
...@@ -86,9 +84,9 @@ public class AboutDialog extends InternalDialog { ...@@ -86,9 +84,9 @@ public class AboutDialog extends InternalDialog {
String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF); String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF);
JEditorPane helpLink = new JEditorPane("text/html", JEditorPane helpLink = new JEditorPane("text/html",
"<html><font color=#"+ colorStr + ">" + "<html><font color=#"+ colorStr + ">" +
getText("Help.AboutDialog.jConsoleVersion", jConsoleVersion) + Resources.format(Messages.HELP_ABOUT_DIALOG_JCONSOLE_VERSION, jConsoleVersion) +
"<p>" + getText("Help.AboutDialog.javaVersion", (vmName +", "+ vmVersion)) + "<p>" + Resources.format(Messages.HELP_ABOUT_DIALOG_JAVA_VERSION, (vmName +", "+ vmVersion)) +
"<p>" + getText("Help.AboutDialog.userGuideLink", urlStr) + "<p>" + Resources.format(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK, urlStr) +
"</html>"); "</html>");
helpLink.setOpaque(false); helpLink.setOpaque(false);
helpLink.setEditable(false); helpLink.setEditable(false);
...@@ -155,7 +153,7 @@ public class AboutDialog extends InternalDialog { ...@@ -155,7 +153,7 @@ public class AboutDialog extends InternalDialog {
} }
static void browseUserGuide(JConsole jConsole) { static void browseUserGuide(JConsole jConsole) {
getAboutDialog(jConsole).browse(getText("Help.AboutDialog.userGuideLink.url")); getAboutDialog(jConsole).browse(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL);
} }
static boolean isBrowseSupported() { static boolean isBrowseSupported() {
...@@ -176,7 +174,7 @@ public class AboutDialog extends InternalDialog { ...@@ -176,7 +174,7 @@ public class AboutDialog extends InternalDialog {
} }
private void createActions() { private void createActions() {
closeAction = new AbstractAction(getText("Close")) { closeAction = new AbstractAction(Messages.CLOSE) {
public void actionPerformed(ActionEvent ev) { public void actionPerformed(ActionEvent ev) {
setVisible(false); setVisible(false);
statusBar.setText(""); statusBar.setText("");
......
...@@ -33,11 +33,10 @@ import javax.swing.border.*; ...@@ -33,11 +33,10 @@ import javax.swing.border.*;
import javax.swing.plaf.*; import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicGraphicsUtils; import javax.swing.plaf.basic.BasicGraphicsUtils;
import static javax.swing.SwingConstants.*; import static javax.swing.SwingConstants.*;
import static sun.tools.jconsole.JConsole.*; import static sun.tools.jconsole.JConsole.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BorderedComponent extends JPanel implements ActionListener { public class BorderedComponent extends JPanel implements ActionListener {
...@@ -47,8 +46,6 @@ public class BorderedComponent extends JPanel implements ActionListener { ...@@ -47,8 +46,6 @@ public class BorderedComponent extends JPanel implements ActionListener {
JComponent comp; JComponent comp;
boolean collapsed = false; boolean collapsed = false;
private JPopupMenu popupMenu;
private Icon collapseIcon; private Icon collapseIcon;
private Icon expandIcon; private Icon expandIcon;
...@@ -100,7 +97,7 @@ public class BorderedComponent extends JPanel implements ActionListener { ...@@ -100,7 +97,7 @@ public class BorderedComponent extends JPanel implements ActionListener {
moreOrLessButton.setMargin(new Insets(0, 0, 0, 0)); moreOrLessButton.setMargin(new Insets(0, 0, 0, 0));
moreOrLessButton.addActionListener(this); moreOrLessButton.addActionListener(this);
String toolTip = String toolTip =
getText("BorderedComponent.moreOrLessButton.toolTip"); Messages.BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP;
moreOrLessButton.setToolTipText(toolTip); moreOrLessButton.setToolTipText(toolTip);
borderLabel.add(moreOrLessButton); borderLabel.add(moreOrLessButton);
borderLabel.setSize(borderLabel.getPreferredSize()); borderLabel.setSize(borderLabel.getPreferredSize());
...@@ -136,7 +133,8 @@ public class BorderedComponent extends JPanel implements ActionListener { ...@@ -136,7 +133,8 @@ public class BorderedComponent extends JPanel implements ActionListener {
public void setValueLabel(String str) { public void setValueLabel(String str) {
this.valueLabelStr = str; this.valueLabelStr = str;
if (label != null) { if (label != null) {
label.setText(Resources.getText("Current value",valueLabelStr)); label.setText(Resources.format(Messages.CURRENT_VALUE,
valueLabelStr));
} }
} }
...@@ -151,8 +149,8 @@ public class BorderedComponent extends JPanel implements ActionListener { ...@@ -151,8 +149,8 @@ public class BorderedComponent extends JPanel implements ActionListener {
remove(comp); remove(comp);
if (valueLabelStr != null) { if (valueLabelStr != null) {
if (label == null) { if (label == null) {
label = new JLabel(Resources.getText("Current value", label = new JLabel(Resources.format(Messages.CURRENT_VALUE,
valueLabelStr)); valueLabelStr));
} }
add(label); add(label);
} }
...@@ -439,8 +437,6 @@ public class BorderedComponent extends JPanel implements ActionListener { ...@@ -439,8 +437,6 @@ public class BorderedComponent extends JPanel implements ActionListener {
* @param insets the object to be reinitialized * @param insets the object to be reinitialized
*/ */
public Insets getBorderInsets(Component c, Insets insets) { public Insets getBorderInsets(Component c, Insets insets) {
int height = 16;
Border border = getBorder(); Border border = getBorder();
if (border != null) { if (border != null) {
if (border instanceof AbstractBorder) { if (border instanceof AbstractBorder) {
......
...@@ -33,17 +33,11 @@ import java.lang.reflect.*; ...@@ -33,17 +33,11 @@ import java.lang.reflect.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.text.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.*;
import sun.awt.*; import java.util.concurrent.*;
import static sun.tools.jconsole.Formatter.*; import static sun.tools.jconsole.Formatter.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
...@@ -58,13 +52,9 @@ class ClassTab extends Tab implements ActionListener { ...@@ -58,13 +52,9 @@ class ClassTab extends Tab implements ActionListener {
private static final String loadedPlotterKey = "loaded"; private static final String loadedPlotterKey = "loaded";
private static final String totalLoadedPlotterKey = "totalLoaded"; private static final String totalLoadedPlotterKey = "totalLoaded";
private static final String loadedPlotterName = Resources.getText("Loaded");
private static final String totalLoadedPlotterName = Resources.getText("Total Loaded");
private static final Color loadedPlotterColor = Plotter.defaultColor; private static final Color loadedPlotterColor = Plotter.defaultColor;
private static final Color totalLoadedPlotterColor = Color.red; private static final Color totalLoadedPlotterColor = Color.red;
private static final String infoLabelFormat = "ClassTab.infoLabelFormat";
/* /*
Hierarchy of panels and layouts for this tab: Hierarchy of panels and layouts for this tab:
...@@ -88,7 +78,7 @@ class ClassTab extends Tab implements ActionListener { ...@@ -88,7 +78,7 @@ class ClassTab extends Tab implements ActionListener {
*/ */
public static String getTabName() { public static String getTabName() {
return Resources.getText("Classes"); return Messages.CLASSES;
} }
public ClassTab(VMPanel vmPanel) { public ClassTab(VMPanel vmPanel) {
...@@ -108,40 +98,40 @@ class ClassTab extends Tab implements ActionListener { ...@@ -108,40 +98,40 @@ class ClassTab extends Tab implements ActionListener {
JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5)); JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5));
topPanel.add(controlPanel, BorderLayout.CENTER); topPanel.add(controlPanel, BorderLayout.CENTER);
verboseCheckBox = new JCheckBox(Resources.getText("Verbose Output")); verboseCheckBox = new JCheckBox(Messages.VERBOSE_OUTPUT);
verboseCheckBox.addActionListener(this); verboseCheckBox.addActionListener(this);
verboseCheckBox.setToolTipText(getText("Verbose Output.toolTip")); verboseCheckBox.setToolTipText(Messages.VERBOSE_OUTPUT_TOOLTIP);
JPanel topRightPanel = new JPanel(); JPanel topRightPanel = new JPanel();
topRightPanel.setBorder(new EmptyBorder(0, 65-8, 0, 70)); topRightPanel.setBorder(new EmptyBorder(0, 65-8, 0, 70));
topRightPanel.add(verboseCheckBox); topRightPanel.add(verboseCheckBox);
topPanel.add(topRightPanel, BorderLayout.AFTER_LINE_ENDS); topPanel.add(topRightPanel, BorderLayout.AFTER_LINE_ENDS);
loadedClassesMeter = new PlotterPanel(Resources.getText("Number of Loaded Classes"), loadedClassesMeter = new PlotterPanel(Messages.NUMBER_OF_LOADED_CLASSES,
Plotter.Unit.NONE, false); Plotter.Unit.NONE, false);
loadedClassesMeter.plotter.createSequence(loadedPlotterKey, loadedClassesMeter.plotter.createSequence(loadedPlotterKey,
loadedPlotterName, Messages.LOADED,
loadedPlotterColor, loadedPlotterColor,
true); true);
loadedClassesMeter.plotter.createSequence(totalLoadedPlotterKey, loadedClassesMeter.plotter.createSequence(totalLoadedPlotterKey,
totalLoadedPlotterName, Messages.TOTAL_LOADED,
totalLoadedPlotterColor, totalLoadedPlotterColor,
true); true);
setAccessibleName(loadedClassesMeter.plotter, setAccessibleName(loadedClassesMeter.plotter,
getText("ClassTab.loadedClassesPlotter.accessibleName")); Messages.CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME);
plotterPanel.add(loadedClassesMeter); plotterPanel.add(loadedClassesMeter);
timeComboBox = new TimeComboBox(loadedClassesMeter.plotter); timeComboBox = new TimeComboBox(loadedClassesMeter.plotter);
controlPanel.add(new LabeledComponent(Resources.getText("Time Range:"), controlPanel.add(new LabeledComponent(Messages.TIME_RANGE_COLON,
getMnemonicInt("Time Range:"), Resources.getMnemonicInt(Messages.TIME_RANGE_COLON),
timeComboBox)); timeComboBox));
LabeledComponent.layout(plotterPanel); LabeledComponent.layout(plotterPanel);
bottomPanel.setBorder(new CompoundBorder(new TitledBorder(Resources.getText("Details")), bottomPanel.setBorder(new CompoundBorder(new TitledBorder(Messages.DETAILS),
new EmptyBorder(10, 10, 10, 10))); new EmptyBorder(10, 10, 10, 10)));
details = new HTMLPane(); details = new HTMLPane();
setAccessibleName(details, getText("Details")); setAccessibleName(details, Messages.DETAILS);
JScrollPane scrollPane = new JScrollPane(details); JScrollPane scrollPane = new JScrollPane(details);
scrollPane.setPreferredSize(new Dimension(0, 150)); scrollPane.setPreferredSize(new Dimension(0, 150));
bottomPanel.add(scrollPane, BorderLayout.SOUTH); bottomPanel.add(scrollPane, BorderLayout.SOUTH);
...@@ -226,10 +216,10 @@ class ClassTab extends Tab implements ActionListener { ...@@ -226,10 +216,10 @@ class ClassTab extends Tab implements ActionListener {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String timeStamp = formatDateTime(time); String timeStamp = formatDateTime(time);
text += newRow(Resources.getText("Time"), timeStamp); text += newRow(Messages.TIME, timeStamp);
text += newRow(Resources.getText("Current classes loaded"), justify(clCount, 5)); text += newRow(Messages.CURRENT_CLASSES_LOADED, justify(clCount, 5));
text += newRow(Resources.getText("Total classes loaded"), justify(ctCount, 5)); text += newRow(Messages.TOTAL_CLASSES_LOADED, justify(ctCount, 5));
text += newRow(Resources.getText("Total classes unloaded"), justify(cuCount, 5)); text += newRow(Messages.TOTAL_CLASSES_UNLOADED, justify(cuCount, 5));
return text; return text;
} }
...@@ -246,12 +236,13 @@ class ClassTab extends Tab implements ActionListener { ...@@ -246,12 +236,13 @@ class ClassTab extends Tab implements ActionListener {
private static class ClassOverviewPanel extends OverviewPanel { private static class ClassOverviewPanel extends OverviewPanel {
ClassOverviewPanel() { ClassOverviewPanel() {
super(getText("Classes"), loadedPlotterKey, loadedPlotterName, null); super(Messages.CLASSES, loadedPlotterKey, Messages.LOADED, null);
} }
private void updateClassInfo(long total, long loaded) { private void updateClassInfo(long total, long loaded) {
long unloaded = (total - loaded); long unloaded = (total - loaded);
getInfoLabel().setText(getText(infoLabelFormat, loaded, unloaded, total)); getInfoLabel().setText(Resources.format(Messages.CLASS_TAB_INFO_LABEL_FORMAT,
loaded, unloaded, total));
} }
} }
} }
...@@ -29,23 +29,17 @@ import java.util.List; ...@@ -29,23 +29,17 @@ import java.util.List;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.util.*; import java.util.*;
import java.net.MalformedURLException;
import java.io.IOException;
import javax.accessibility.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.Timer;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.*; import javax.swing.event.*;
import javax.swing.plaf.basic.BasicRadioButtonUI; import javax.swing.plaf.basic.BasicRadioButtonUI;
import javax.swing.table.*; import javax.swing.table.*;
import javax.management.remote.JMXServiceURL;
import javax.management.remote.JMXConnector;
import static java.awt.BorderLayout.*; import static java.awt.BorderLayout.*;
import static javax.swing.ListSelectionModel.*; import static javax.swing.ListSelectionModel.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
...@@ -66,7 +60,7 @@ public class ConnectDialog extends InternalDialog ...@@ -66,7 +60,7 @@ public class ConnectDialog extends InternalDialog
JPanel radioButtonPanel; JPanel radioButtonPanel;
private Icon mastheadIcon = private Icon mastheadIcon =
new MastheadIcon(getText("ConnectDialog.masthead.title")); new MastheadIcon(Messages.CONNECT_DIALOG_MASTHEAD_TITLE);
private Color hintTextColor, disabledTableCellColor; private Color hintTextColor, disabledTableCellColor;
// The table of managed VM (local process) // The table of managed VM (local process)
...@@ -79,11 +73,11 @@ public class ConnectDialog extends InternalDialog ...@@ -79,11 +73,11 @@ public class ConnectDialog extends InternalDialog
public ConnectDialog(JConsole jConsole) { public ConnectDialog(JConsole jConsole) {
super(jConsole, Resources.getText("ConnectDialog.title"), true); super(jConsole, Messages.CONNECT_DIALOG_TITLE, true);
this.jConsole = jConsole; this.jConsole = jConsole;
setAccessibleDescription(this, setAccessibleDescription(this,
getText("ConnectDialog.accessibleDescription")); Messages.CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION);
setDefaultCloseOperation(HIDE_ON_CLOSE); setDefaultCloseOperation(HIDE_ON_CLOSE);
setResizable(false); setResizable(false);
Container cp = (JComponent)getContentPane(); Container cp = (JComponent)getContentPane();
...@@ -95,7 +89,7 @@ public class ConnectDialog extends InternalDialog ...@@ -95,7 +89,7 @@ public class ConnectDialog extends InternalDialog
statusBar = new JLabel(" ", JLabel.CENTER); statusBar = new JLabel(" ", JLabel.CENTER);
setAccessibleName(statusBar, setAccessibleName(statusBar,
getText("ConnectDialog.statusBar.accessibleName")); Messages.CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME);
Font normalLabelFont = statusBar.getFont(); Font normalLabelFont = statusBar.getFont();
Font boldLabelFont = normalLabelFont.deriveFont(Font.BOLD); Font boldLabelFont = normalLabelFont.deriveFont(Font.BOLD);
...@@ -103,7 +97,7 @@ public class ConnectDialog extends InternalDialog ...@@ -103,7 +97,7 @@ public class ConnectDialog extends InternalDialog
JLabel mastheadLabel = new JLabel(mastheadIcon); JLabel mastheadLabel = new JLabel(mastheadIcon);
setAccessibleName(mastheadLabel, setAccessibleName(mastheadLabel,
getText("ConnectDialog.masthead.accessibleName")); Messages.CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME);
cp.add(mastheadLabel, NORTH); cp.add(mastheadLabel, NORTH);
cp.add(radioButtonPanel, CENTER); cp.add(radioButtonPanel, CENTER);
...@@ -117,7 +111,7 @@ public class ConnectDialog extends InternalDialog ...@@ -117,7 +111,7 @@ public class ConnectDialog extends InternalDialog
remoteTF.addFocusListener(this); remoteTF.addFocusListener(this);
remoteTF.setPreferredSize(remoteTF.getPreferredSize()); remoteTF.setPreferredSize(remoteTF.getPreferredSize());
setAccessibleName(remoteTF, setAccessibleName(remoteTF,
getText("Remote Process.textField.accessibleName")); Messages.REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME);
// //
// If the VM supports the local attach mechanism (is: Sun // If the VM supports the local attach mechanism (is: Sun
...@@ -141,8 +135,8 @@ public class ConnectDialog extends InternalDialog ...@@ -141,8 +135,8 @@ public class ConnectDialog extends InternalDialog
TableColumn cmdLineColumn = columnModel.getColumn(COL_NAME); TableColumn cmdLineColumn = columnModel.getColumn(COL_NAME);
cmdLineColumn.setResizable(false); cmdLineColumn.setResizable(false);
localRadioButton = new JRadioButton(getText("Local Process:")); localRadioButton = new JRadioButton(Messages.LOCAL_PROCESS_COLON);
localRadioButton.setMnemonic(getMnemonicInt("Local Process:")); localRadioButton.setMnemonic(Resources.getMnemonicInt(Messages.LOCAL_PROCESS_COLON));
localRadioButton.setFont(boldLabelFont); localRadioButton.setFont(boldLabelFont);
localRadioButton.addItemListener(this); localRadioButton.addItemListener(this);
radioButtonGroup.add(localRadioButton); radioButtonGroup.add(localRadioButton);
...@@ -167,8 +161,8 @@ public class ConnectDialog extends InternalDialog ...@@ -167,8 +161,8 @@ public class ConnectDialog extends InternalDialog
localTablePanel.add(localMessageLabel, SOUTH); localTablePanel.add(localMessageLabel, SOUTH);
} }
remoteRadioButton = new JRadioButton(getText("Remote Process:")); remoteRadioButton = new JRadioButton(Messages.REMOTE_PROCESS_COLON);
remoteRadioButton.setMnemonic(getMnemonicInt("Remote Process:")); remoteRadioButton.setMnemonic(Resources.getMnemonicInt(Messages.REMOTE_PROCESS_COLON));
remoteRadioButton.setFont(boldLabelFont); remoteRadioButton.setFont(boldLabelFont);
radioButtonGroup.add(remoteRadioButton); radioButtonGroup.add(remoteRadioButton);
...@@ -207,7 +201,7 @@ public class ConnectDialog extends InternalDialog ...@@ -207,7 +201,7 @@ public class ConnectDialog extends InternalDialog
remoteTFPanel.add(remoteTF, NORTH); remoteTFPanel.add(remoteTF, NORTH);
remoteMessageLabel = new JLabel("<html>" + getText("remoteTF.usage")); remoteMessageLabel = new JLabel("<html>" + Messages.REMOTE_TF_USAGE + "</html>");
remoteMessageLabel.setFont(smallLabelFont); remoteMessageLabel.setFont(smallLabelFont);
remoteMessageLabel.setForeground(hintTextColor); remoteMessageLabel.setForeground(hintTextColor);
remoteTFPanel.add(remoteMessageLabel, CENTER); remoteTFPanel.add(remoteMessageLabel, CENTER);
...@@ -222,11 +216,10 @@ public class ConnectDialog extends InternalDialog ...@@ -222,11 +216,10 @@ public class ConnectDialog extends InternalDialog
userNameTF.getDocument().addDocumentListener(this); userNameTF.getDocument().addDocumentListener(this);
userNameTF.addFocusListener(this); userNameTF.addFocusListener(this);
setAccessibleName(userNameTF, setAccessibleName(userNameTF,
getText("Username.accessibleName")); Messages.USERNAME_ACCESSIBLE_NAME);
String labelKey = "Username: ";
LabeledComponent lc; LabeledComponent lc;
lc = new LabeledComponent(getText(labelKey), lc = new LabeledComponent(Messages.USERNAME_COLON_,
getMnemonicInt(labelKey), Resources.getMnemonicInt(Messages.USERNAME_COLON_),
userNameTF); userNameTF);
lc.label.setFont(boldLabelFont); lc.label.setFont(boldLabelFont);
userPwdPanel.add(lc); userPwdPanel.add(lc);
...@@ -238,10 +231,10 @@ public class ConnectDialog extends InternalDialog ...@@ -238,10 +231,10 @@ public class ConnectDialog extends InternalDialog
passwordTF.getDocument().addDocumentListener(this); passwordTF.getDocument().addDocumentListener(this);
passwordTF.addFocusListener(this); passwordTF.addFocusListener(this);
setAccessibleName(passwordTF, setAccessibleName(passwordTF,
getText("Password.accessibleName")); Messages.PASSWORD_ACCESSIBLE_NAME);
labelKey = "Password: ";
lc = new LabeledComponent(getText(labelKey), lc = new LabeledComponent(Messages.PASSWORD_COLON_,
getMnemonicInt(labelKey), Resources.getMnemonicInt(Messages.PASSWORD_COLON_),
passwordTF); passwordTF);
lc.setBorder(new EmptyBorder(0, 12, 0, 0)); // Left padding lc.setBorder(new EmptyBorder(0, 12, 0, 0)); // Left padding
lc.label.setFont(boldLabelFont); lc.label.setFont(boldLabelFont);
...@@ -250,7 +243,7 @@ public class ConnectDialog extends InternalDialog ...@@ -250,7 +243,7 @@ public class ConnectDialog extends InternalDialog
remoteTFPanel.add(userPwdPanel, SOUTH); remoteTFPanel.add(userPwdPanel, SOUTH);
String connectButtonToolTipText = String connectButtonToolTipText =
getText("ConnectDialog.connectButton.toolTip"); Messages.CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP;
connectButton = new JButton(connectAction); connectButton = new JButton(connectAction);
connectButton.setToolTipText(connectButtonToolTipText); connectButton.setToolTipText(connectButtonToolTipText);
...@@ -288,7 +281,7 @@ public class ConnectDialog extends InternalDialog ...@@ -288,7 +281,7 @@ public class ConnectDialog extends InternalDialog
String colorStr = String colorStr =
String.format("%06x", hintTextColor.getRGB() & 0xFFFFFF); String.format("%06x", hintTextColor.getRGB() & 0xFFFFFF);
remoteMessageLabel.setText("<html><font color=#" + colorStr + ">" + remoteMessageLabel.setText("<html><font color=#" + colorStr + ">" +
getText("remoteTF.usage")); Messages.REMOTE_TF_USAGE);
} }
if (localMessageLabel != null) { if (localMessageLabel != null) {
localMessageLabel.setForeground(hintTextColor); localMessageLabel.setForeground(hintTextColor);
...@@ -300,9 +293,9 @@ public class ConnectDialog extends InternalDialog ...@@ -300,9 +293,9 @@ public class ConnectDialog extends InternalDialog
} }
private void createActions() { private void createActions() {
connectAction = new AbstractAction(getText("Connect")) { connectAction = new AbstractAction(Messages.CONNECT) {
/* init */ { /* init */ {
putValue(Action.MNEMONIC_KEY, getMnemonicInt("Connect")); putValue(Action.MNEMONIC_KEY, Resources.getMnemonicInt(Messages.CONNECT));
} }
public void actionPerformed(ActionEvent ev) { public void actionPerformed(ActionEvent ev) {
...@@ -321,7 +314,6 @@ public class ConnectDialog extends InternalDialog ...@@ -321,7 +314,6 @@ public class ConnectDialog extends InternalDialog
try { try {
if (txt.startsWith(JConsole.ROOT_URL)) { if (txt.startsWith(JConsole.ROOT_URL)) {
String url = txt; String url = txt;
String msg = null;
jConsole.addUrl(url, userName, password, false); jConsole.addUrl(url, userName, password, false);
remoteTF.setText(JConsole.ROOT_URL); remoteTF.setText(JConsole.ROOT_URL);
return; return;
...@@ -361,7 +353,7 @@ public class ConnectDialog extends InternalDialog ...@@ -361,7 +353,7 @@ public class ConnectDialog extends InternalDialog
} }
}; };
cancelAction = new AbstractAction(getText("Cancel")) { cancelAction = new AbstractAction(Messages.CANCEL) {
public void actionPerformed(ActionEvent ev) { public void actionPerformed(ActionEvent ev) {
setVisible(false); setVisible(false);
statusBar.setText(""); statusBar.setText("");
...@@ -588,9 +580,9 @@ public class ConnectDialog extends InternalDialog ...@@ -588,9 +580,9 @@ public class ConnectDialog extends InternalDialog
LocalVirtualMachine lvm = vmModel.vmAt(row); LocalVirtualMachine lvm = vmModel.vmAt(row);
if (!lvm.isManageable()) { if (!lvm.isManageable()) {
if (lvm.isAttachable()) { if (lvm.isAttachable()) {
labelText = getText("Management Will Be Enabled"); labelText = Messages.MANAGEMENT_WILL_BE_ENABLED;
} else { } else {
labelText = getText("Management Not Enabled"); labelText = Messages.MANAGEMENT_NOT_ENABLED;
} }
} }
} }
...@@ -650,8 +642,8 @@ public class ConnectDialog extends InternalDialog ...@@ -650,8 +642,8 @@ public class ConnectDialog extends InternalDialog
// Represents the list of managed VMs as a tabular data model. // Represents the list of managed VMs as a tabular data model.
private static class ManagedVmTableModel extends AbstractTableModel { private static class ManagedVmTableModel extends AbstractTableModel {
private static String[] columnNames = { private static String[] columnNames = {
Resources.getText("Column.Name"), Messages.COLUMN_NAME,
Resources.getText("Column.PID"), Messages.COLUMN_PID,
}; };
private List<LocalVirtualMachine> vmList; private List<LocalVirtualMachine> vmList;
...@@ -678,7 +670,7 @@ public class ConnectDialog extends InternalDialog ...@@ -678,7 +670,7 @@ public class ConnectDialog extends InternalDialog
} }
} }
public Class getColumnClass(int column) { public Class<?> getColumnClass(int column) {
switch (column) { switch (column) {
case COL_NAME: return String.class; case COL_NAME: return String.class;
case COL_PID: return Integer.class; case COL_PID: return Integer.class;
...@@ -706,13 +698,6 @@ public class ConnectDialog extends InternalDialog ...@@ -706,13 +698,6 @@ public class ConnectDialog extends InternalDialog
} }
} }
// Convenience method
private static String getText(String key) {
return Resources.getText(key);
}
// A blank component that takes up as much space as the // A blank component that takes up as much space as the
// button part of a JRadioButton. // button part of a JRadioButton.
private static class Padder extends JPanel { private static class Padder extends JPanel {
...@@ -721,7 +706,7 @@ public class ConnectDialog extends InternalDialog ...@@ -721,7 +706,7 @@ public class ConnectDialog extends InternalDialog
Padder(JRadioButton radioButton) { Padder(JRadioButton radioButton) {
this.radioButton = radioButton; this.radioButton = radioButton;
setAccessibleName(this, getText("Blank")); setAccessibleName(this, Messages.BLANK);
} }
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
...@@ -758,7 +743,6 @@ public class ConnectDialog extends InternalDialog ...@@ -758,7 +743,6 @@ public class ConnectDialog extends InternalDialog
if (g == null) { if (g == null) {
return null; return null;
} }
String clippedText =
SwingUtilities.layoutCompoundLabel(button, SwingUtilities.layoutCompoundLabel(button,
g.getFontMetrics(), g.getFontMetrics(),
text, text,
......
...@@ -32,23 +32,21 @@ import java.util.TreeSet; ...@@ -32,23 +32,21 @@ import java.util.TreeSet;
import java.util.Comparator; import java.util.Comparator;
import javax.swing.*; import javax.swing.*;
import javax.swing.Timer;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.*;
import javax.management.MBeanServerConnection; import javax.management.MBeanServerConnection;
import javax.management.ObjectName; import javax.management.ObjectName;
import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException; import javax.management.InstanceNotFoundException;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class CreateMBeanDialog extends InternalDialog public class CreateMBeanDialog extends InternalDialog
implements ActionListener { implements ActionListener {
JConsole jConsole; JConsole jConsole;
JComboBox connections; JComboBox<ProxyClient> connections;
JButton createMBeanButton, unregisterMBeanButton, cancelButton; JButton createMBeanButton, unregisterMBeanButton, cancelButton;
private static final String HOTSPOT_MBEAN = private static final String HOTSPOT_MBEAN =
...@@ -60,7 +58,7 @@ public class CreateMBeanDialog extends InternalDialog ...@@ -60,7 +58,7 @@ public class CreateMBeanDialog extends InternalDialog
this.jConsole = jConsole; this.jConsole = jConsole;
setAccessibleDescription(this, setAccessibleDescription(this,
getText("Hotspot MBeans.dialog.accessibleDescription")); Messages.HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION);
Container cp = getContentPane(); Container cp = getContentPane();
((JComponent)cp).setBorder(new EmptyBorder(10, 10, 4, 10)); ((JComponent)cp).setBorder(new EmptyBorder(10, 10, 4, 10));
...@@ -71,12 +69,10 @@ public class CreateMBeanDialog extends InternalDialog ...@@ -71,12 +69,10 @@ public class CreateMBeanDialog extends InternalDialog
false, false,
true)); true));
cp.add(centerPanel, BorderLayout.CENTER); cp.add(centerPanel, BorderLayout.CENTER);
connections = new JComboBox(); connections = new JComboBox<ProxyClient>();
updateConnections(); updateConnections();
centerPanel.add(new LabeledComponent(Resources. centerPanel.add(new LabeledComponent(Resources.format(Messages.MANAGE_HOTSPOT_MBEANS_IN_COLON_),
getText("Manage Hotspot MBeans "+
"in: "),
connections)); connections));
JPanel bottomPanel = new JPanel(new BorderLayout()); JPanel bottomPanel = new JPanel(new BorderLayout());
...@@ -85,11 +81,11 @@ public class CreateMBeanDialog extends InternalDialog ...@@ -85,11 +81,11 @@ public class CreateMBeanDialog extends InternalDialog
JPanel buttonPanel = new JPanel(); JPanel buttonPanel = new JPanel();
bottomPanel.add(buttonPanel, BorderLayout.NORTH); bottomPanel.add(buttonPanel, BorderLayout.NORTH);
buttonPanel.add(createMBeanButton = buttonPanel.add(createMBeanButton =
new JButton(Resources.getText("Create"))); new JButton(Messages.CREATE));
buttonPanel.add(unregisterMBeanButton = buttonPanel.add(unregisterMBeanButton =
new JButton(Resources.getText("Unregister"))); new JButton(Messages.UNREGISTER));
buttonPanel.add(cancelButton = buttonPanel.add(cancelButton =
new JButton(Resources.getText("Cancel"))); new JButton(Messages.CANCEL));
statusBar = new JLabel(" ", JLabel.CENTER); statusBar = new JLabel(" ", JLabel.CENTER);
bottomPanel.add(statusBar, BorderLayout.SOUTH); bottomPanel.add(statusBar, BorderLayout.SOUTH);
...@@ -133,7 +129,8 @@ public class CreateMBeanDialog extends InternalDialog ...@@ -133,7 +129,8 @@ public class CreateMBeanDialog extends InternalDialog
} }
} }
connections.invalidate(); connections.invalidate();
connections.setModel(new DefaultComboBoxModel(data.toArray())); connections.setModel(new DefaultComboBoxModel<ProxyClient>
(data.toArray(new ProxyClient[data.size()])));
connections.validate(); connections.validate();
} }
...@@ -144,7 +141,6 @@ public class CreateMBeanDialog extends InternalDialog ...@@ -144,7 +141,6 @@ public class CreateMBeanDialog extends InternalDialog
new Thread("CreateMBeanDialog.actionPerformed") { new Thread("CreateMBeanDialog.actionPerformed") {
public void run() { public void run() {
try { try {
StringBuffer buff = null;
Object c = connections.getSelectedItem(); Object c = connections.getSelectedItem();
if(c == null) return; if(c == null) return;
if(ev.getSource() == createMBeanButton) { if(ev.getSource() == createMBeanButton) {
...@@ -163,13 +159,9 @@ public class CreateMBeanDialog extends InternalDialog ...@@ -163,13 +159,9 @@ public class CreateMBeanDialog extends InternalDialog
} }
return; return;
} catch(InstanceAlreadyExistsException e) { } catch(InstanceAlreadyExistsException e) {
statusBar.setText(Resources. statusBar.setText(Messages.ERROR_COLON_MBEANS_ALREADY_EXIST);
getText("Error: MBeans already "
+ "exist"));
} catch(InstanceNotFoundException e) { } catch(InstanceNotFoundException e) {
statusBar.setText(Resources. statusBar.setText(Messages.ERROR_COLON_MBEANS_DO_NOT_EXIST);
getText("Error: MBeans do not "
+ "exist"));
} catch(Exception e) { } catch(Exception e) {
statusBar.setText(e.toString()); statusBar.setText(e.toString());
} }
......
...@@ -28,7 +28,6 @@ package sun.tools.jconsole; ...@@ -28,7 +28,6 @@ package sun.tools.jconsole;
import java.text.*; import java.text.*;
import java.util.*; import java.util.*;
import static sun.tools.jconsole.Resources.*;
class Formatter { class Formatter {
final static long SECOND = 1000; final static long SECOND = 1000;
...@@ -48,7 +47,7 @@ class Formatter { ...@@ -48,7 +47,7 @@ class Formatter {
String str; String str;
if (t < 1 * MINUTE) { if (t < 1 * MINUTE) {
String seconds = String.format("%.3f", t / (double)SECOND); String seconds = String.format("%.3f", t / (double)SECOND);
str = Resources.getText("DurationSeconds", seconds); str = Resources.format(Messages.DURATION_SECONDS, seconds);
} else { } else {
long remaining = t; long remaining = t;
long days = remaining / DAY; long days = remaining / DAY;
...@@ -58,13 +57,13 @@ class Formatter { ...@@ -58,13 +57,13 @@ class Formatter {
long minutes = remaining / MINUTE; long minutes = remaining / MINUTE;
if (t >= 1 * DAY) { if (t >= 1 * DAY) {
str = Resources.getText("DurationDaysHoursMinutes", str = Resources.format(Messages.DURATION_DAYS_HOURS_MINUTES,
days, hours, minutes); days, hours, minutes);
} else if (t >= 1 * HOUR) { } else if (t >= 1 * HOUR) {
str = Resources.getText("DurationHoursMinutes", str = Resources.format(Messages.DURATION_HOURS_MINUTES,
hours, minutes); hours, minutes);
} else { } else {
str = Resources.getText("DurationMinutes", minutes); str = Resources.format(Messages.DURATION_MINUTES, minutes);
} }
} }
return str; return str;
...@@ -88,8 +87,7 @@ class Formatter { ...@@ -88,8 +87,7 @@ class Formatter {
return dateDF.format(time) + " " + timeWithSecondsDF.format(time); return dateDF.format(time) + " " + timeWithSecondsDF.format(time);
} }
static DateFormat getDateTimeFormat(String key) { static DateFormat getDateTimeFormat(String dtfStr) {
String dtfStr = getText(key);
int dateStyle = -1; int dateStyle = -1;
int timeStyle = -1; int timeStyle = -1;
...@@ -153,18 +151,18 @@ class Formatter { ...@@ -153,18 +151,18 @@ class Formatter {
} }
String[] strings = formatLongs(bytes); String[] strings = formatLongs(bytes);
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
strings[i] = getText("kbytes", strings[i]); strings[i] = Resources.format(Messages.KBYTES, strings[i]);
} }
return strings; return strings;
} }
static String formatKBytes(long bytes) { static String formatKBytes(long bytes) {
if (bytes == -1) { if (bytes == -1) {
return getText("kbytes", "-1"); return Resources.format(Messages.KBYTES, "-1");
} }
long kb = bytes / 1024; long kb = bytes / 1024;
return getText("kbytes", justify(kb, 10)); return Resources.format(Messages.KBYTES, justify(kb, 10));
} }
...@@ -182,13 +180,13 @@ class Formatter { ...@@ -182,13 +180,13 @@ class Formatter {
int exp = (int)Math.log10((double)vMax); int exp = (int)Math.log10((double)vMax);
if (exp < 3) { if (exp < 3) {
s = Resources.getText("Size Bytes", v); s = Resources.format(Messages.SIZE_BYTES, v);
} else if (exp < 6) { } else if (exp < 6) {
s = Resources.getText("Size Kb", trimDouble(v / Math.pow(10.0, 3))); s = Resources.format(Messages.SIZE_KB, trimDouble(v / Math.pow(10.0, 3)));
} else if (exp < 9) { } else if (exp < 9) {
s = Resources.getText("Size Mb", trimDouble(v / Math.pow(10.0, 6))); s = Resources.format(Messages.SIZE_MB, trimDouble(v / Math.pow(10.0, 6)));
} else { } else {
s = Resources.getText("Size Gb", trimDouble(v / Math.pow(10.0, 9))); s = Resources.format(Messages.SIZE_GB, trimDouble(v / Math.pow(10.0, 9)));
} }
if (html) { if (html) {
s = s.replace(" ", "&nbsp;"); s = s.replace(" ", "&nbsp;");
......
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.Color;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*; import javax.swing.event.*;
import javax.swing.text.*; import javax.swing.text.*;
......
...@@ -30,8 +30,8 @@ import java.awt.event.*; ...@@ -30,8 +30,8 @@ import java.awt.event.*;
import javax.swing.*; import javax.swing.*;
import static javax.swing.JLayeredPane.*; import static javax.swing.JLayeredPane.*;
import static sun.tools.jconsole.Resources.*;
/** /**
* Used instead of JDialog in a JDesktopPane/JInternalFrame environment. * Used instead of JDialog in a JDesktopPane/JInternalFrame environment.
...@@ -73,7 +73,7 @@ public class InternalDialog extends JInternalFrame { ...@@ -73,7 +73,7 @@ public class InternalDialog extends JInternalFrame {
private ImageIcon rightIcon = private ImageIcon rightIcon =
new ImageIcon(InternalDialog.class.getResource("resources/masthead-right.png")); new ImageIcon(InternalDialog.class.getResource("resources/masthead-right.png"));
private Font font = Font.decode(getText("Masthead.font")); private Font font = Font.decode(Messages.MASTHEAD_FONT);
private int gap = 10; private int gap = 10;
private String title; private String title;
......
...@@ -29,7 +29,6 @@ import java.awt.*; ...@@ -29,7 +29,6 @@ import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.beans.*; import java.beans.*;
import java.io.*; import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.net.*; import java.net.*;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
...@@ -38,8 +37,6 @@ import javax.swing.*; ...@@ -38,8 +37,6 @@ import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.*; import javax.swing.event.*;
import javax.swing.plaf.*; import javax.swing.plaf.*;
import javax.management.remote.JMXServiceURL;
import javax.management.remote.JMXConnector;
import javax.security.auth.login.FailedLoginException; import javax.security.auth.login.FailedLoginException;
import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLHandshakeException;
...@@ -47,7 +44,6 @@ import com.sun.tools.jconsole.JConsolePlugin; ...@@ -47,7 +44,6 @@ import com.sun.tools.jconsole.JConsolePlugin;
import sun.net.util.IPAddressUtil; import sun.net.util.IPAddressUtil;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
...@@ -68,7 +64,7 @@ public class JConsole extends JFrame ...@@ -68,7 +64,7 @@ public class JConsole extends JFrame
try { try {
UIManager.setLookAndFeel(systemLaF); UIManager.setLookAndFeel(systemLaF);
} catch (Exception e) { } catch (Exception e) {
System.err.println(Resources.getText("JConsole: ", e.getMessage())); System.err.println(Resources.format(Messages.JCONSOLE_COLON_, e.getMessage()));
} }
} }
} }
...@@ -87,7 +83,7 @@ public class JConsole extends JFrame ...@@ -87,7 +83,7 @@ public class JConsole extends JFrame
private final static String title = private final static String title =
Resources.getText("Java Monitoring & Management Console"); Messages.JAVA_MONITORING___MANAGEMENT_CONSOLE;
public final static String ROOT_URL = public final static String ROOT_URL =
"service:jmx:"; "service:jmx:";
...@@ -116,7 +112,7 @@ public class JConsole extends JFrame ...@@ -116,7 +112,7 @@ public class JConsole extends JFrame
setRootPane(new FixedJRootPane()); setRootPane(new FixedJRootPane());
setAccessibleDescription(this, setAccessibleDescription(this,
getText("JConsole.accessibleDescription")); Messages.JCONSOLE_ACCESSIBLE_DESCRIPTION);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
menuBar = new JMenuBar(); menuBar = new JMenuBar();
...@@ -124,12 +120,12 @@ public class JConsole extends JFrame ...@@ -124,12 +120,12 @@ public class JConsole extends JFrame
// TODO: Use Actions ! // TODO: Use Actions !
JMenu connectionMenu = new JMenu(getText("Connection")); JMenu connectionMenu = new JMenu(Messages.CONNECTION);
connectionMenu.setMnemonic(getMnemonicInt("Connection")); connectionMenu.setMnemonic(Resources.getMnemonicInt(Messages.CONNECTION));
menuBar.add(connectionMenu); menuBar.add(connectionMenu);
if(hotspot) { if(hotspot) {
hotspotMI = new JMenuItem(getText("Hotspot MBeans...")); hotspotMI = new JMenuItem(Messages.HOTSPOT_MBEANS_ELLIPSIS);
hotspotMI.setMnemonic(getMnemonicInt("Hotspot MBeans...")); hotspotMI.setMnemonic(Resources.getMnemonicInt(Messages.HOTSPOT_MBEANS_ELLIPSIS));
hotspotMI.setAccelerator(KeyStroke. hotspotMI.setAccelerator(KeyStroke.
getKeyStroke(KeyEvent.VK_H, getKeyStroke(KeyEvent.VK_H,
InputEvent.CTRL_MASK)); InputEvent.CTRL_MASK));
...@@ -139,8 +135,8 @@ public class JConsole extends JFrame ...@@ -139,8 +135,8 @@ public class JConsole extends JFrame
connectionMenu.addSeparator(); connectionMenu.addSeparator();
} }
connectMI = new JMenuItem(Resources.getText("New Connection...")); connectMI = new JMenuItem(Messages.NEW_CONNECTION_ELLIPSIS);
connectMI.setMnemonic(getMnemonicInt("New Connection...")); connectMI.setMnemonic(Resources.getMnemonicInt(Messages.NEW_CONNECTION_ELLIPSIS));
connectMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, connectMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,
InputEvent.CTRL_MASK)); InputEvent.CTRL_MASK));
connectMI.addActionListener(this); connectMI.addActionListener(this);
...@@ -148,27 +144,27 @@ public class JConsole extends JFrame ...@@ -148,27 +144,27 @@ public class JConsole extends JFrame
connectionMenu.addSeparator(); connectionMenu.addSeparator();
exitMI = new JMenuItem(Resources.getText("Exit")); exitMI = new JMenuItem(Messages.EXIT);
exitMI.setMnemonic(getMnemonicInt("Exit")); exitMI.setMnemonic(Resources.getMnemonicInt(Messages.EXIT));
exitMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, exitMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4,
InputEvent.ALT_MASK)); InputEvent.ALT_MASK));
exitMI.addActionListener(this); exitMI.addActionListener(this);
connectionMenu.add(exitMI); connectionMenu.add(exitMI);
JMenu helpMenu = new JMenu(getText("HelpMenu.title")); JMenu helpMenu = new JMenu(Messages.HELP_MENU_TITLE);
helpMenu.setMnemonic(getMnemonicInt("HelpMenu.title")); helpMenu.setMnemonic(Resources.getMnemonicInt(Messages.HELP_MENU_TITLE));
menuBar.add(helpMenu); menuBar.add(helpMenu);
if (AboutDialog.isBrowseSupported()) { if (AboutDialog.isBrowseSupported()) {
userGuideMI = new JMenuItem(getText("HelpMenu.UserGuide.title")); userGuideMI = new JMenuItem(Messages.HELP_MENU_USER_GUIDE_TITLE);
userGuideMI.setMnemonic(getMnemonicInt("HelpMenu.UserGuide.title")); userGuideMI.setMnemonic(Resources.getMnemonicInt(Messages.HELP_MENU_USER_GUIDE_TITLE));
userGuideMI.addActionListener(this); userGuideMI.addActionListener(this);
helpMenu.add(userGuideMI); helpMenu.add(userGuideMI);
helpMenu.addSeparator(); helpMenu.addSeparator();
} }
aboutMI = new JMenuItem(getText("HelpMenu.About.title")); aboutMI = new JMenuItem(Messages.HELP_MENU_ABOUT_TITLE);
aboutMI.setMnemonic(getMnemonicInt("HelpMenu.About.title")); aboutMI.setMnemonic(Resources.getMnemonicInt(Messages.HELP_MENU_ABOUT_TITLE));
aboutMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); aboutMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
aboutMI.addActionListener(this); aboutMI.addActionListener(this);
helpMenu.add(aboutMI); helpMenu.add(aboutMI);
...@@ -191,8 +187,8 @@ public class JConsole extends JFrame ...@@ -191,8 +187,8 @@ public class JConsole extends JFrame
((BorderLayout)cp.getLayout()). ((BorderLayout)cp.getLayout()).
getLayoutComponent(BorderLayout.CENTER); getLayoutComponent(BorderLayout.CENTER);
windowMenu = new WindowMenu(Resources.getText("Window")); windowMenu = new WindowMenu(Messages.WINDOW);
windowMenu.setMnemonic(getMnemonicInt("Window")); windowMenu.setMnemonic(Resources.getMnemonicInt(Messages.WINDOW));
// Add Window menu before Help menu // Add Window menu before Help menu
menuBar.add(windowMenu, menuBar.getComponentCount() - 1); menuBar.add(windowMenu, menuBar.getComponentCount() - 1);
...@@ -219,25 +215,25 @@ public class JConsole extends JFrame ...@@ -219,25 +215,25 @@ public class JConsole extends JFrame
WindowMenu(String text) { WindowMenu(String text) {
super(text); super(text);
cascadeMI = new JMenuItem(Resources.getText("Cascade")); cascadeMI = new JMenuItem(Messages.CASCADE);
cascadeMI.setMnemonic(getMnemonicInt("Cascade")); cascadeMI.setMnemonic(Resources.getMnemonicInt(Messages.CASCADE));
cascadeMI.addActionListener(JConsole.this); cascadeMI.addActionListener(JConsole.this);
add(cascadeMI); add(cascadeMI);
tileMI = new JMenuItem(Resources.getText("Tile")); tileMI = new JMenuItem(Messages.TILE);
tileMI.setMnemonic(getMnemonicInt("Tile")); tileMI.setMnemonic(Resources.getMnemonicInt(Messages.TILE));
tileMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, tileMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,
InputEvent.CTRL_MASK)); InputEvent.CTRL_MASK));
tileMI.addActionListener(JConsole.this); tileMI.addActionListener(JConsole.this);
add(tileMI); add(tileMI);
minimizeAllMI = new JMenuItem(Resources.getText("Minimize All")); minimizeAllMI = new JMenuItem(Messages.MINIMIZE_ALL);
minimizeAllMI.setMnemonic(getMnemonicInt("Minimize All")); minimizeAllMI.setMnemonic(Resources.getMnemonicInt(Messages.MINIMIZE_ALL));
minimizeAllMI.addActionListener(JConsole.this); minimizeAllMI.addActionListener(JConsole.this);
add(minimizeAllMI); add(minimizeAllMI);
restoreAllMI = new JMenuItem(Resources.getText("Restore All")); restoreAllMI = new JMenuItem(Messages.RESTORE_ALL);
restoreAllMI.setMnemonic(getMnemonicInt("Restore All")); restoreAllMI.setMnemonic(Resources.getMnemonicInt(Messages.RESTORE_ALL));
restoreAllMI.addActionListener(JConsole.this); restoreAllMI.addActionListener(JConsole.this);
add(restoreAllMI); add(restoreAllMI);
...@@ -721,7 +717,7 @@ public class JConsole extends JFrame ...@@ -721,7 +717,7 @@ public class JConsole extends JFrame
} }
private String errorMessage(Exception ex) { private String errorMessage(Exception ex) {
String msg = Resources.getText("Connection failed"); String msg = Messages.CONNECTION_FAILED;
if (ex instanceof IOException || ex instanceof SecurityException) { if (ex instanceof IOException || ex instanceof SecurityException) {
Throwable cause = null; Throwable cause = null;
Throwable c = ex.getCause(); Throwable c = ex.getCause();
...@@ -732,7 +728,7 @@ public class JConsole extends JFrame ...@@ -732,7 +728,7 @@ public class JConsole extends JFrame
if (cause instanceof ConnectException) { if (cause instanceof ConnectException) {
return msg + ": " + cause.getMessage(); return msg + ": " + cause.getMessage();
} else if (cause instanceof UnknownHostException) { } else if (cause instanceof UnknownHostException) {
return Resources.getText("Unknown Host", cause.getMessage()); return Resources.format(Messages.UNKNOWN_HOST, cause.getMessage());
} else if (cause instanceof NoRouteToHostException) { } else if (cause instanceof NoRouteToHostException) {
return msg + ": " + cause.getMessage(); return msg + ": " + cause.getMessage();
} else if (cause instanceof FailedLoginException) { } else if (cause instanceof FailedLoginException) {
...@@ -741,7 +737,7 @@ public class JConsole extends JFrame ...@@ -741,7 +737,7 @@ public class JConsole extends JFrame
return msg + ": "+ cause.getMessage(); return msg + ": "+ cause.getMessage();
} }
} else if (ex instanceof MalformedURLException) { } else if (ex instanceof MalformedURLException) {
return Resources.getText("Invalid URL", ex.getMessage()); return Resources.format(Messages.INVALID_URL, ex.getMessage());
} }
return msg + ": " + ex.getMessage(); return msg + ": " + ex.getMessage();
} }
...@@ -770,7 +766,7 @@ public class JConsole extends JFrame ...@@ -770,7 +766,7 @@ public class JConsole extends JFrame
private static void usage() { private static void usage() {
System.err.println(Resources.getText("zz usage text", "jconsole")); System.err.println(Resources.format(Messages.ZZ_USAGE_TEXT, "jconsole"));
} }
private static void mainInit(final List<String> urls, private static void mainInit(final List<String> urls,
...@@ -1003,13 +999,13 @@ public class JConsole extends JFrame ...@@ -1003,13 +999,13 @@ public class JConsole extends JFrame
pluginService = plugins; pluginService = plugins;
} catch (ServiceConfigurationError e) { } catch (ServiceConfigurationError e) {
// Error occurs during initialization of plugin // Error occurs during initialization of plugin
System.out.println(Resources.getText("Fail to load plugin", System.out.println(Resources.format(Messages.FAIL_TO_LOAD_PLUGIN,
e.getMessage())); e.getMessage()));
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
if (JConsole.isDebug()) { if (JConsole.isDebug()) {
e.printStackTrace(); e.printStackTrace();
} }
System.out.println(Resources.getText("Invalid plugin path", System.out.println(Resources.format(Messages.INVALID_PLUGIN_PATH,
e.getMessage())); e.getMessage()));
} }
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.*; import java.awt.*;
import java.awt.event.*;
import javax.swing.*; import javax.swing.*;
......
...@@ -39,7 +39,6 @@ import com.sun.tools.attach.AttachNotSupportedException; ...@@ -39,7 +39,6 @@ import com.sun.tools.attach.AttachNotSupportedException;
// Sun private // Sun private
import sun.management.ConnectorAddressLink; import sun.management.ConnectorAddressLink;
import sun.jvmstat.monitor.HostIdentifier; import sun.jvmstat.monitor.HostIdentifier;
import sun.jvmstat.monitor.Monitor;
import sun.jvmstat.monitor.MonitoredHost; import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm; import sun.jvmstat.monitor.MonitoredVm;
import sun.jvmstat.monitor.MonitoredVmUtil; import sun.jvmstat.monitor.MonitoredVmUtil;
...@@ -131,7 +130,7 @@ public class LocalVirtualMachine { ...@@ -131,7 +130,7 @@ public class LocalVirtualMachine {
private static void getMonitoredVMs(Map<Integer, LocalVirtualMachine> map) { private static void getMonitoredVMs(Map<Integer, LocalVirtualMachine> map) {
MonitoredHost host; MonitoredHost host;
Set vms; Set<Integer> vms;
try { try {
host = MonitoredHost.getMonitoredHost(new HostIdentifier((String)null)); host = MonitoredHost.getMonitoredHost(new HostIdentifier((String)null));
vms = host.activeVms(); vms = host.activeVms();
......
...@@ -52,7 +52,7 @@ public class MBeansTab extends Tab implements ...@@ -52,7 +52,7 @@ public class MBeansTab extends Tab implements
private XDataViewer viewer; private XDataViewer viewer;
public static String getTabName() { public static String getTabName() {
return Resources.getText("MBeans"); return Messages.MBEANS;
} }
public MBeansTab(final VMPanel vmPanel) { public MBeansTab(final VMPanel vmPanel) {
......
...@@ -222,7 +222,7 @@ public class MaximizableInternalFrame extends JInternalFrame { ...@@ -222,7 +222,7 @@ public class MaximizableInternalFrame extends JInternalFrame {
static { static {
if (JConsole.IS_WIN) { if (JConsole.IS_WIN) {
try { try {
Class Part = Class<?> Part =
Class.forName("com.sun.java.swing.plaf.windows.TMSchema$Part"); Class.forName("com.sun.java.swing.plaf.windows.TMSchema$Part");
if (Part != null) { if (Part != null) {
WP_MINBUTTON = Part.getField("WP_MINBUTTON").get(null); WP_MINBUTTON = Part.getField("WP_MINBUTTON").get(null);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import javax.management.ObjectName; import javax.management.ObjectName;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage; import java.lang.management.MemoryUsage;
import com.sun.management.GarbageCollectorMXBean; import com.sun.management.GarbageCollectorMXBean;
...@@ -34,21 +33,18 @@ import com.sun.management.GcInfo; ...@@ -34,21 +33,18 @@ import com.sun.management.GcInfo;
import java.util.HashMap; import java.util.HashMap;
import java.util.Set; import java.util.Set;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import static java.lang.management.ManagementFactory.*; import static java.lang.management.ManagementFactory.*;
public class MemoryPoolProxy { public class MemoryPoolProxy {
private String poolName; private String poolName;
private ProxyClient client; private ProxyClient client;
private ObjectName objName;
private MemoryPoolMXBean pool; private MemoryPoolMXBean pool;
private Map<ObjectName,Long> gcMBeans; private Map<ObjectName,Long> gcMBeans;
private GcInfo lastGcInfo; private GcInfo lastGcInfo;
public MemoryPoolProxy(ProxyClient client, ObjectName poolName) throws java.io.IOException { public MemoryPoolProxy(ProxyClient client, ObjectName poolName) throws java.io.IOException {
this.client = client; this.client = client;
this.objName = objName;
this.pool = client.getMXBean(poolName, MemoryPoolMXBean.class); this.pool = client.getMXBean(poolName, MemoryPoolMXBean.class);
this.poolName = this.pool.getName(); this.poolName = this.pool.getName();
this.gcMBeans = new HashMap<ObjectName,Long>(); this.gcMBeans = new HashMap<ObjectName,Long>();
...@@ -73,10 +69,6 @@ public class MemoryPoolProxy { ...@@ -73,10 +69,6 @@ public class MemoryPoolProxy {
return (gcMBeans.size() != 0); return (gcMBeans.size() != 0);
} }
public ObjectName getObjectName() {
return objName;
}
public MemoryPoolStat getStat() throws java.io.IOException { public MemoryPoolStat getStat() throws java.io.IOException {
long usageThreshold = (pool.isUsageThresholdSupported() long usageThreshold = (pool.isUsageThresholdSupported()
? pool.getUsageThreshold() ? pool.getUsageThreshold()
......
...@@ -129,6 +129,6 @@ public class MemoryPoolStat { ...@@ -129,6 +129,6 @@ public class MemoryPoolStat {
* null if no GC occurs. * null if no GC occurs.
*/ */
public MemoryUsage getAfterGcUsage() { public MemoryUsage getAfterGcUsage() {
return beforeGcUsage; return afterGcUsage;
} }
} }
...@@ -38,18 +38,14 @@ import javax.management.*; ...@@ -38,18 +38,14 @@ import javax.management.*;
import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeData;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.text.*;
import sun.management.*;
import static sun.tools.jconsole.Formatter.*; import static sun.tools.jconsole.Formatter.*;
import static sun.tools.jconsole.OverviewPanel.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
class MemoryTab extends Tab implements ActionListener, ItemListener { class MemoryTab extends Tab implements ActionListener, ItemListener {
JComboBox plotterChoice; JComboBox<Plotter> plotterChoice;
TimeComboBox timeComboBox; TimeComboBox timeComboBox;
JButton gcButton; JButton gcButton;
...@@ -67,19 +63,11 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -67,19 +63,11 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
private static final String committedKey = "committed"; private static final String committedKey = "committed";
private static final String maxKey = "max"; private static final String maxKey = "max";
private static final String thresholdKey = "threshold"; private static final String thresholdKey = "threshold";
private static final String usedName = Resources.getText("Used");
private static final String committedName = Resources.getText("Committed");
private static final String maxName = Resources.getText("Max");
private static final String thresholdName = Resources.getText("Threshold");
private static final Color usedColor = Plotter.defaultColor; private static final Color usedColor = Plotter.defaultColor;
private static final Color committedColor = null; private static final Color committedColor = null;
private static final Color maxColor = null; private static final Color maxColor = null;
private static final Color thresholdColor = Color.red; private static final Color thresholdColor = Color.red;
private static final String infoLabelFormat = "MemoryTab.infoLabelFormat";
/* /*
Hierarchy of panels and layouts for this tab: Hierarchy of panels and layouts for this tab:
...@@ -105,7 +93,7 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -105,7 +93,7 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
public static String getTabName() { public static String getTabName() {
return getText("Memory"); return Messages.MEMORY;
} }
public MemoryTab(VMPanel vmPanel) { public MemoryTab(VMPanel vmPanel) {
...@@ -125,32 +113,32 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -125,32 +113,32 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
topPanel.add(controlPanel, BorderLayout.CENTER); topPanel.add(controlPanel, BorderLayout.CENTER);
// Plotter choice // Plotter choice
plotterChoice = new JComboBox(); plotterChoice = new JComboBox<Plotter>();
plotterChoice.addItemListener(this); plotterChoice.addItemListener(this);
controlPanel.add(new LabeledComponent(getText("Chart:"), controlPanel.add(new LabeledComponent(Messages.CHART_COLON,
getMnemonicInt("Chart:"), Resources.getMnemonicInt(Messages.CHART_COLON),
plotterChoice)); plotterChoice));
// Range control // Range control
timeComboBox = new TimeComboBox(); timeComboBox = new TimeComboBox();
controlPanel.add(new LabeledComponent(getText("Time Range:"), controlPanel.add(new LabeledComponent(Messages.TIME_RANGE_COLON,
getMnemonicInt("Time Range:"), Resources.getMnemonicInt(Messages.TIME_RANGE_COLON),
timeComboBox)); timeComboBox));
gcButton = new JButton(getText("Perform GC")); gcButton = new JButton(Messages.PERFORM_GC);
gcButton.setMnemonic(getMnemonicInt("Perform GC")); gcButton.setMnemonic(Resources.getMnemonicInt(Messages.PERFORM_GC));
gcButton.addActionListener(this); gcButton.addActionListener(this);
gcButton.setToolTipText(getText("Perform GC.toolTip")); gcButton.setToolTipText(Messages.PERFORM_GC_TOOLTIP);
JPanel topRightPanel = new JPanel(); JPanel topRightPanel = new JPanel();
topRightPanel.setBorder(new EmptyBorder(0, 65-8, 0, 70)); topRightPanel.setBorder(new EmptyBorder(0, 65-8, 0, 70));
topRightPanel.add(gcButton); topRightPanel.add(gcButton);
topPanel.add(topRightPanel, BorderLayout.AFTER_LINE_ENDS); topPanel.add(topRightPanel, BorderLayout.AFTER_LINE_ENDS);
bottomPanel.setBorder(new CompoundBorder(new TitledBorder(getText("Details")), bottomPanel.setBorder(new CompoundBorder(new TitledBorder(Messages.DETAILS),
new EmptyBorder(10, 10, 10, 10))); new EmptyBorder(10, 10, 10, 10)));
details = new HTMLPane(); details = new HTMLPane();
setAccessibleName(details, getText("Details")); setAccessibleName(details, Messages.DETAILS);
bottomPanel.add(new JScrollPane(details), BorderLayout.CENTER); bottomPanel.add(new JScrollPane(details), BorderLayout.CENTER);
poolChart = new PoolChart(); poolChart = new PoolChart();
...@@ -165,31 +153,31 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -165,31 +153,31 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
heapPlotter = new Plotter(Plotter.Unit.BYTES) { heapPlotter = new Plotter(Plotter.Unit.BYTES) {
public String toString() { public String toString() {
return Resources.getText("Heap Memory Usage"); return Messages.HEAP_MEMORY_USAGE;
} }
}; };
proxyClient.addWeakPropertyChangeListener(heapPlotter); proxyClient.addWeakPropertyChangeListener(heapPlotter);
nonHeapPlotter = new Plotter(Plotter.Unit.BYTES) { nonHeapPlotter = new Plotter(Plotter.Unit.BYTES) {
public String toString() { public String toString() {
return Resources.getText("Non-Heap Memory Usage"); return Messages.NON_HEAP_MEMORY_USAGE;
} }
}; };
setAccessibleName(heapPlotter, setAccessibleName(heapPlotter,
getText("MemoryTab.heapPlotter.accessibleName")); Messages.MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME);
setAccessibleName(nonHeapPlotter, setAccessibleName(nonHeapPlotter,
getText("MemoryTab.nonHeapPlotter.accessibleName")); Messages.MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME);
proxyClient.addWeakPropertyChangeListener(nonHeapPlotter); proxyClient.addWeakPropertyChangeListener(nonHeapPlotter);
heapPlotter.createSequence(usedKey, usedName, usedColor, true); heapPlotter.createSequence(usedKey, Messages.USED, usedColor, true);
heapPlotter.createSequence(committedKey, committedName, committedColor, false); heapPlotter.createSequence(committedKey, Messages.COMMITTED, committedColor, false);
heapPlotter.createSequence(maxKey, maxName, maxColor, false); heapPlotter.createSequence(maxKey, Messages.MAX, maxColor, false);
nonHeapPlotter.createSequence(usedKey, usedName, usedColor, true); nonHeapPlotter.createSequence(usedKey, Messages.USED, usedColor, true);
nonHeapPlotter.createSequence(committedKey, committedName, committedColor, false); nonHeapPlotter.createSequence(committedKey, Messages.COMMITTED, committedColor, false);
nonHeapPlotter.createSequence(maxKey, maxName, maxColor, false); nonHeapPlotter.createSequence(maxKey, Messages.MAX, maxColor, false);
plotterList.add(heapPlotter); plotterList.add(heapPlotter);
plotterList.add(nonHeapPlotter); plotterList.add(nonHeapPlotter);
...@@ -202,8 +190,8 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -202,8 +190,8 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
for (ObjectName objectName : objectNames) { for (ObjectName objectName : objectNames) {
String type = objectName.getKeyProperty("type"); String type = objectName.getKeyProperty("type");
if (type.equals("MemoryPool")) { if (type.equals("MemoryPool")) {
String name = getText("MemoryPoolLabel", String name = Resources.format(Messages.MEMORY_POOL_LABEL,
objectName.getKeyProperty("name")); objectName.getKeyProperty("name"));
// Heap or non-heap? // Heap or non-heap?
boolean isHeap = false; boolean isHeap = false;
AttributeList al = AttributeList al =
...@@ -215,10 +203,10 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -215,10 +203,10 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
PoolPlotter poolPlotter = new PoolPlotter(objectName, name, isHeap); PoolPlotter poolPlotter = new PoolPlotter(objectName, name, isHeap);
proxyClient.addWeakPropertyChangeListener(poolPlotter); proxyClient.addWeakPropertyChangeListener(poolPlotter);
poolPlotter.createSequence(usedKey, usedName, usedColor, true); poolPlotter.createSequence(usedKey, Messages.USED, usedColor, true);
poolPlotter.createSequence(committedKey, committedName, committedColor, false); poolPlotter.createSequence(committedKey, Messages.COMMITTED, committedColor, false);
poolPlotter.createSequence(maxKey, maxName, maxColor, false); poolPlotter.createSequence(maxKey, Messages.MAX, maxColor, false);
poolPlotter.createSequence(thresholdKey, thresholdName, thresholdColor, false); poolPlotter.createSequence(thresholdKey, Messages.THRESHOLD, thresholdColor, false);
poolPlotter.setUseDashedTransitions(thresholdKey, true); poolPlotter.setUseDashedTransitions(thresholdKey, true);
if (isHeap) { if (isHeap) {
...@@ -286,7 +274,6 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -286,7 +274,6 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
max = new long[n]; max = new long[n];
threshold = new long[n]; threshold = new long[n];
timeStamp = System.currentTimeMillis(); timeStamp = System.currentTimeMillis();
int poolCount = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
Plotter plotter = plotterList.get(i); Plotter plotter = plotterList.get(i);
...@@ -400,22 +387,22 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -400,22 +387,22 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
//long time = plotter.getLastTimeStamp(); //long time = plotter.getLastTimeStamp();
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
String timeStamp = formatDateTime(time); String timeStamp = formatDateTime(time);
text += newRow(getText("Time"), timeStamp); text += newRow(Messages.TIME, timeStamp);
long used = plotter.getLastValue(usedKey); long used = plotter.getLastValue(usedKey);
long committed = plotter.getLastValue(committedKey); long committed = plotter.getLastValue(committedKey);
long max = plotter.getLastValue(maxKey); long max = plotter.getLastValue(maxKey);
long threshold = plotter.getLastValue(thresholdKey); long threshold = plotter.getLastValue(thresholdKey);
text += newRow(getText("Used"), formatKBytes(used)); text += newRow(Messages.USED, formatKBytes(used));
if (committed > 0L) { if (committed > 0L) {
text += newRow(getText("Committed"), formatKBytes(committed)); text += newRow(Messages.COMMITTED, formatKBytes(committed));
} }
if (max > 0L) { if (max > 0L) {
text += newRow(getText("Max"), formatKBytes(max)); text += newRow(Messages.MAX, formatKBytes(max));
} }
if (threshold > 0L) { if (threshold > 0L) {
text += newRow(getText("Usage Threshold"), formatKBytes(threshold)); text += newRow(Messages.USAGE_THRESHOLD, formatKBytes(threshold));
} }
try { try {
...@@ -427,11 +414,11 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -427,11 +414,11 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
String gcName = garbageCollectorMBean.getName(); String gcName = garbageCollectorMBean.getName();
long gcCount = garbageCollectorMBean.getCollectionCount(); long gcCount = garbageCollectorMBean.getCollectionCount();
long gcTime = garbageCollectorMBean.getCollectionTime(); long gcTime = garbageCollectorMBean.getCollectionTime();
String str = getText("GC time details", justify(formatTime(gcTime), 14), String str = Resources.format(Messages.GC_TIME_DETAILS, justify(formatTime(gcTime), 14),
gcName, gcName,
String.format("%,d",gcCount)); String.format("%,d",gcCount));
if (!descPrinted) { if (!descPrinted) {
text += newRow(getText("GC time"), str); text += newRow(Messages.GC_TIME, str);
descPrinted = true; descPrinted = true;
} else { } else {
text += newRow(null, str); text += newRow(null, str);
...@@ -465,8 +452,8 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -465,8 +452,8 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
this.isHeap = isHeap; this.isHeap = isHeap;
setAccessibleName(this, setAccessibleName(this,
getText("MemoryTab.poolPlotter.accessibleName", Resources.format(Messages.MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME,
name)); name));
} }
...@@ -627,7 +614,7 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -627,7 +614,7 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
g.setColor(nonHeapColor); g.setColor(nonHeapColor);
g.fillRect(nonHeapRect.x + 1, nonHeapRect.y + 1, nonHeapRect.width - 1, nonHeapRect.height - 1); g.fillRect(nonHeapRect.x + 1, nonHeapRect.y + 1, nonHeapRect.width - 1, nonHeapRect.height - 1);
String str = getText("Heap"); String str = Messages.HEAP;
int stringWidth = fm.stringWidth(str); int stringWidth = fm.stringWidth(str);
int x = heapRect.x + (heapRect.width - stringWidth) / 2; int x = heapRect.x + (heapRect.width - stringWidth) / 2;
int y = heapRect.y + heapRect.height - 6; int y = heapRect.y + heapRect.height - 6;
...@@ -639,7 +626,7 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -639,7 +626,7 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
g.setColor(Color.black); g.setColor(Color.black);
g.drawString(str, x, y); g.drawString(str, x, y);
str = getText("Non-Heap"); str = Messages.NON_HEAP;
stringWidth = fm.stringWidth(str); stringWidth = fm.stringWidth(str);
x = nonHeapRect.x + (nonHeapRect.width - stringWidth) / 2; x = nonHeapRect.x + (nonHeapRect.width - stringWidth) / 2;
y = nonHeapRect.y + nonHeapRect.height - 6; y = nonHeapRect.y + nonHeapRect.height - 6;
...@@ -728,26 +715,26 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -728,26 +715,26 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
protected class AccessiblePoolChart extends AccessibleJPanel { protected class AccessiblePoolChart extends AccessibleJPanel {
public String getAccessibleName() { public String getAccessibleName() {
String name = getText("MemoryTab.poolChart.accessibleName"); String name = Messages.MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME;
String keyValueList = ""; String keyValueList = "";
for (PoolPlotter poolPlotter : poolPlotters) { for (PoolPlotter poolPlotter : poolPlotters) {
String value = (poolPlotter.value * 100 / poolPlotter.max) + "%"; String value = (poolPlotter.value * 100 / poolPlotter.max) + "%";
// Assume format string ends with newline // Assume format string ends with newline
keyValueList += keyValueList +=
getText("Plotter.accessibleName.keyAndValue", Resources.format(Messages.PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE,
poolPlotter.toString(), value); poolPlotter.toString(), value);
if (poolPlotter.threshold > 0L) { if (poolPlotter.threshold > 0L) {
String threshold = String threshold =
(poolPlotter.threshold * 100 / poolPlotter.max) + "%"; (poolPlotter.threshold * 100 / poolPlotter.max) + "%";
if (poolPlotter.value > poolPlotter.threshold) { if (poolPlotter.value > poolPlotter.threshold) {
keyValueList += keyValueList +=
getText("MemoryTab.poolChart.aboveThreshold", Resources.format(Messages.MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD,
threshold); threshold);
} else { } else {
keyValueList += keyValueList +=
getText("MemoryTab.poolChart.belowThreshold", Resources.format(Messages.MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD,
threshold); threshold);
} }
} }
} }
...@@ -767,14 +754,14 @@ class MemoryTab extends Tab implements ActionListener, ItemListener { ...@@ -767,14 +754,14 @@ class MemoryTab extends Tab implements ActionListener, ItemListener {
private static class MemoryOverviewPanel extends OverviewPanel { private static class MemoryOverviewPanel extends OverviewPanel {
MemoryOverviewPanel() { MemoryOverviewPanel() {
super(getText("Heap Memory Usage"), usedKey, usedName, Plotter.Unit.BYTES); super(Messages.HEAP_MEMORY_USAGE, usedKey, Messages.USED, Plotter.Unit.BYTES);
} }
private void updateMemoryInfo(long used, long committed, long max) { private void updateMemoryInfo(long used, long committed, long max) {
getInfoLabel().setText(getText(infoLabelFormat, getInfoLabel().setText(Resources.format(Messages.MEMORY_TAB_INFO_LABEL_FORMAT,
formatBytes(used, true), formatBytes(used, true),
formatBytes(committed, true), formatBytes(committed, true),
formatBytes(max, true))); formatBytes(max, true)));
} }
} }
} }
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.tools.jconsole;
/**
* Class that contains localized messages.
*
*/
final public class Messages {
private static final String BUNDLE_NAME = "sun.tools.jconsole.resources.messages";
static {
Resources.initializeMessages(Messages.class, BUNDLE_NAME);
}
// TODO:
// The names of some of the constants below looks strange.
// That's because they were generated programmatically
// from the messages. They should be cleaned up,
// ___ should be removed etc.
public static String ONE_DAY;
public static String ONE_HOUR;
public static String ONE_MIN;
public static String ONE_MONTH;
public static String ONE_YEAR;
public static String TWO_HOURS;
public static String THREE_HOURS;
public static String THREE_MONTHS;
public static String FIVE_MIN;
public static String SIX_HOURS;
public static String SIX_MONTHS;
public static String SEVEN_DAYS;
public static String TEN_MIN;
public static String TWELVE_HOURS;
public static String THIRTY_MIN;
public static String LESS_THAN;
public static String A_LOT_LESS_THAN;
public static String GREATER_THAN;
public static String ACTION_CAPITALIZED;
public static String ACTION_INFO_CAPITALIZED;
public static String ALL;
public static String ARCHITECTURE;
public static String ATTRIBUTE;
public static String ATTRIBUTE_VALUE;
public static String ATTRIBUTE_VALUES;
public static String ATTRIBUTES;
public static String BLANK;
public static String BLOCKED_COUNT_WAITED_COUNT;
public static String BOOT_CLASS_PATH;
public static String BORDERED_COMPONENT_MORE_OR_LESS_BUTTON_TOOLTIP;
public static String CPU_USAGE;
public static String CPU_USAGE_FORMAT;
public static String CANCEL;
public static String CASCADE;
public static String CHART_COLON;
public static String CLASS_PATH;
public static String CLASS_NAME;
public static String CLASS_TAB_INFO_LABEL_FORMAT;
public static String CLASS_TAB_LOADED_CLASSES_PLOTTER_ACCESSIBLE_NAME;
public static String CLASSES;
public static String CLOSE;
public static String COLUMN_NAME;
public static String COLUMN_PID;
public static String COMMITTED_MEMORY;
public static String COMMITTED_VIRTUAL_MEMORY;
public static String COMMITTED;
public static String CONNECT;
public static String CONNECT_DIALOG_CONNECT_BUTTON_TOOLTIP;
public static String CONNECT_DIALOG_ACCESSIBLE_DESCRIPTION;
public static String CONNECT_DIALOG_MASTHEAD_ACCESSIBLE_NAME;
public static String CONNECT_DIALOG_MASTHEAD_TITLE;
public static String CONNECT_DIALOG_STATUS_BAR_ACCESSIBLE_NAME;
public static String CONNECT_DIALOG_TITLE;
public static String CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_;
public static String CONNECTION_FAILED;
public static String CONNECTION;
public static String CONNECTION_NAME;
public static String CONNECTION_NAME__DISCONNECTED_;
public static String CONSTRUCTOR;
public static String CURRENT_CLASSES_LOADED;
public static String CURRENT_HEAP_SIZE;
public static String CURRENT_VALUE;
public static String CREATE;
public static String DAEMON_THREADS;
public static String DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_;
public static String DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE;
public static String DOUBLE_CLICK_TO_VISUALIZE;
public static String DESCRIPTION;
public static String DESCRIPTOR;
public static String DETAILS;
public static String DETECT_DEADLOCK;
public static String DETECT_DEADLOCK_TOOLTIP;
public static String DIMENSION_IS_NOT_SUPPORTED_COLON;
public static String DISCARD_CHART;
public static String DURATION_DAYS_HOURS_MINUTES;
public static String DURATION_HOURS_MINUTES;
public static String DURATION_MINUTES;
public static String DURATION_SECONDS;
public static String EMPTY_ARRAY;
public static String ERROR;
public static String ERROR_COLON_MBEANS_ALREADY_EXIST;
public static String ERROR_COLON_MBEANS_DO_NOT_EXIST;
public static String EVENT;
public static String EXIT;
public static String FAIL_TO_LOAD_PLUGIN;
public static String FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION;
public static String FILE_CHOOSER_FILE_EXISTS_MESSAGE;
public static String FILE_CHOOSER_FILE_EXISTS_OK_OPTION;
public static String FILE_CHOOSER_FILE_EXISTS_TITLE;
public static String FILE_CHOOSER_SAVED_FILE;
public static String FILE_CHOOSER_SAVE_FAILED_MESSAGE;
public static String FILE_CHOOSER_SAVE_FAILED_TITLE;
public static String FREE_PHYSICAL_MEMORY;
public static String FREE_SWAP_SPACE;
public static String GARBAGE_COLLECTOR;
public static String GC_INFO;
public static String GC_TIME;
public static String GC_TIME_DETAILS;
public static String HEAP_MEMORY_USAGE;
public static String HEAP;
public static String HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION;
public static String HELP_ABOUT_DIALOG_JCONSOLE_VERSION;
public static String HELP_ABOUT_DIALOG_JAVA_VERSION;
public static String HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME;
public static String HELP_ABOUT_DIALOG_MASTHEAD_TITLE;
public static String HELP_ABOUT_DIALOG_TITLE;
public static String HELP_ABOUT_DIALOG_USER_GUIDE_LINK;
public static String HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL;
public static String HELP_MENU_ABOUT_TITLE;
public static String HELP_MENU_USER_GUIDE_TITLE;
public static String HELP_MENU_TITLE;
public static String HOTSPOT_MBEANS_ELLIPSIS;
public static String HOTSPOT_MBEANS_DIALOG_ACCESSIBLE_DESCRIPTION;
public static String IMPACT;
public static String INFO;
public static String INFO_CAPITALIZED;
public static String INVALID_PLUGIN_PATH;
public static String INVALID_URL;
public static String IS;
public static String JAVA_MONITORING___MANAGEMENT_CONSOLE;
public static String JCONSOLE_COLON_;
public static String JCONSOLE_VERSION; // in version template
public static String JCONSOLE_ACCESSIBLE_DESCRIPTION;
public static String JIT_COMPILER;
public static String LIBRARY_PATH;
public static String LIVE_THREADS;
public static String LOADED;
public static String LOCAL_PROCESS_COLON;
public static String MASTHEAD_FONT;
public static String MANAGEMENT_NOT_ENABLED;
public static String MANAGEMENT_WILL_BE_ENABLED;
public static String MBEAN_ATTRIBUTE_INFO;
public static String MBEAN_INFO;
public static String MBEAN_NOTIFICATION_INFO;
public static String MBEAN_OPERATION_INFO;
public static String MBEANS;
public static String MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON;
public static String MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP;
public static String MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE;
public static String MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE;
public static String MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON;
public static String MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP;
public static String MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON;
public static String MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP;
public static String MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE;
public static String MBEANS_TAB_TABULAR_NAVIGATION_SINGLE;
public static String MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON;
public static String MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP;
public static String MANAGE_HOTSPOT_MBEANS_IN_COLON_;
public static String MAX;
public static String MAXIMUM_HEAP_SIZE;
public static String MEMORY;
public static String MEMORY_POOL_LABEL;
public static String MEMORY_TAB_HEAP_PLOTTER_ACCESSIBLE_NAME;
public static String MEMORY_TAB_INFO_LABEL_FORMAT;
public static String MEMORY_TAB_NON_HEAP_PLOTTER_ACCESSIBLE_NAME;
public static String MEMORY_TAB_POOL_CHART_ABOVE_THRESHOLD;
public static String MEMORY_TAB_POOL_CHART_ACCESSIBLE_NAME;
public static String MEMORY_TAB_POOL_CHART_BELOW_THRESHOLD;
public static String MEMORY_TAB_POOL_PLOTTER_ACCESSIBLE_NAME;
public static String MESSAGE;
public static String METHOD_SUCCESSFULLY_INVOKED;
public static String MINIMIZE_ALL;
public static String MONITOR_LOCKED;
public static String NAME;
public static String NAME_STATE;
public static String NAME_STATE_LOCK_NAME;
public static String NAME_STATE_LOCK_NAME_LOCK_OWNER;
public static String NAME_AND_BUILD;// in version template
public static String NEW_CONNECTION_ELLIPSIS;
public static String NO_DEADLOCK_DETECTED;
public static String NON_HEAP_MEMORY_USAGE;
public static String NON_HEAP;
public static String NOTIFICATION;
public static String NOTIFICATION_BUFFER;
public static String NOTIFICATIONS;
public static String NOTIF_TYPES;
public static String NUMBER_OF_THREADS;
public static String NUMBER_OF_LOADED_CLASSES;
public static String NUMBER_OF_PROCESSORS;
public static String OBJECT_NAME;
public static String OPERATING_SYSTEM;
public static String OPERATION;
public static String OPERATION_INVOCATION;
public static String OPERATION_RETURN_VALUE;
public static String OPERATIONS;
public static String OVERVIEW;
public static String OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME;
public static String PARAMETER;
public static String PASSWORD_COLON_;
public static String PASSWORD_ACCESSIBLE_NAME;
public static String PEAK;
public static String PERFORM_GC;
public static String PERFORM_GC_TOOLTIP;
public static String PLOTTER_ACCESSIBLE_NAME;
public static String PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE;
public static String PLOTTER_ACCESSIBLE_NAME_NO_DATA;
public static String PLOTTER_SAVE_AS_MENU_ITEM;
public static String PLOTTER_TIME_RANGE_MENU;
public static String PROBLEM_ADDING_LISTENER;
public static String PROBLEM_DISPLAYING_MBEAN;
public static String PROBLEM_INVOKING;
public static String PROBLEM_REMOVING_LISTENER;
public static String PROBLEM_SETTING_ATTRIBUTE;
public static String PROCESS_CPU_TIME;
public static String READABLE;
public static String RECONNECT;
public static String REMOTE_PROCESS_COLON;
public static String REMOTE_PROCESS_TEXT_FIELD_ACCESSIBLE_NAME;
public static String RESTORE_ALL;
public static String RETURN_TYPE;
public static String SEQ_NUM;
public static String SIZE_BYTES;
public static String SIZE_GB;
public static String SIZE_KB;
public static String SIZE_MB;
public static String SOURCE;
public static String STACK_TRACE;
public static String SUMMARY_TAB_HEADER_DATE_TIME_FORMAT;
public static String SUMMARY_TAB_PENDING_FINALIZATION_LABEL;
public static String SUMMARY_TAB_PENDING_FINALIZATION_VALUE;
public static String SUMMARY_TAB_TAB_NAME;
public static String SUMMARY_TAB_VM_VERSION;
public static String THREADS;
public static String THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME;
public static String THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME;
public static String THRESHOLD;
public static String TILE;
public static String TIME_RANGE_COLON;
public static String TIME;
public static String TIME_STAMP;
public static String TOTAL_LOADED;
public static String TOTAL_CLASSES_LOADED;
public static String TOTAL_CLASSES_UNLOADED;
public static String TOTAL_COMPILE_TIME;
public static String TOTAL_PHYSICAL_MEMORY;
public static String TOTAL_THREADS_STARTED;
public static String TOTAL_SWAP_SPACE;
public static String TYPE;
public static String UNAVAILABLE;
public static String UNKNOWN_CAPITALIZED;
public static String UNKNOWN_HOST;
public static String UNREGISTER;
public static String UPTIME;
public static String USAGE_THRESHOLD;
public static String REMOTE_TF_USAGE;
public static String USED;
public static String USERNAME_COLON_;
public static String USERNAME_ACCESSIBLE_NAME;
public static String USER_DATA;
public static String VIRTUAL_MACHINE;
public static String VM_ARGUMENTS;
public static String VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION;
public static String VALUE;
public static String VENDOR;
public static String VERBOSE_OUTPUT;
public static String VERBOSE_OUTPUT_TOOLTIP;
public static String VIEW;
public static String WINDOW;
public static String WINDOWS;
public static String WRITABLE;
public static String CONNECTION_FAILED1;
public static String CONNECTION_FAILED2;
public static String CONNECTION_LOST1;
public static String CONNECTING_TO1;
public static String CONNECTING_TO2;
public static String DEADLOCK_TAB;
public static String DEADLOCK_TAB_N;
public static String EXPAND;
public static String KBYTES;
public static String PLOT;
public static String VISUALIZE;
public static String ZZ_USAGE_TEXT;
}
...@@ -26,14 +26,12 @@ ...@@ -26,14 +26,12 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.*; import java.awt.*;
import java.awt.event.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*;
import static javax.swing.SwingConstants.*; import static javax.swing.SwingConstants.*;
import static sun.tools.jconsole.JConsole.*; import static sun.tools.jconsole.JConsole.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
...@@ -68,7 +66,7 @@ abstract class OverviewPanel extends PlotterPanel { ...@@ -68,7 +66,7 @@ abstract class OverviewPanel extends PlotterPanel {
} }
plotter.createSequence(plotterKey, plotterName, PLOTTER_COLOR, true); plotter.createSequence(plotterKey, plotterName, PLOTTER_COLOR, true);
setAccessibleName(plotter, setAccessibleName(plotter,
getText("OverviewPanel.plotter.accessibleName", Resources.format(Messages.OVERVIEW_PANEL_PLOTTER_ACCESSIBLE_NAME,
title)); title));
setPlotter(plotter); setPlotter(plotter);
} }
......
...@@ -26,15 +26,11 @@ ...@@ -26,15 +26,11 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.*; import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import static sun.tools.jconsole.JConsole.*;
import static sun.tools.jconsole.Resources.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
class OverviewTab extends Tab { class OverviewTab extends Tab {
...@@ -42,7 +38,7 @@ class OverviewTab extends Tab { ...@@ -42,7 +38,7 @@ class OverviewTab extends Tab {
TimeComboBox timeComboBox; TimeComboBox timeComboBox;
public static String getTabName() { public static String getTabName() {
return getText("Overview"); return Messages.OVERVIEW;
} }
public OverviewTab(VMPanel vmPanel) { public OverviewTab(VMPanel vmPanel) {
...@@ -58,8 +54,8 @@ class OverviewTab extends Tab { ...@@ -58,8 +54,8 @@ class OverviewTab extends Tab {
topPanel.add(controlPanel, BorderLayout.CENTER); topPanel.add(controlPanel, BorderLayout.CENTER);
timeComboBox = new TimeComboBox(); timeComboBox = new TimeComboBox();
LabeledComponent lc = new LabeledComponent(Resources.getText("Time Range:"), LabeledComponent lc = new LabeledComponent(Messages.TIME_RANGE_COLON,
getMnemonicInt("Time Range:"), Resources.getMnemonicInt(Messages.TIME_RANGE_COLON),
timeComboBox); timeComboBox);
controlPanel.add(lc); controlPanel.add(lc);
......
...@@ -38,14 +38,11 @@ import javax.swing.border.*; ...@@ -38,14 +38,11 @@ import javax.swing.border.*;
import javax.swing.filechooser.*; import javax.swing.filechooser.*;
import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileFilter;
import com.sun.tools.jconsole.JConsoleContext;
import static com.sun.tools.jconsole.JConsoleContext.ConnectionState.*; import com.sun.tools.jconsole.JConsoleContext;
import static sun.tools.jconsole.Formatter.*; import static sun.tools.jconsole.Formatter.*;
import static sun.tools.jconsole.ProxyClient.*; import static sun.tools.jconsole.ProxyClient.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Plotter extends JComponent public class Plotter extends JComponent
...@@ -56,22 +53,22 @@ public class Plotter extends JComponent ...@@ -56,22 +53,22 @@ public class Plotter extends JComponent
} }
static final String[] rangeNames = { static final String[] rangeNames = {
Resources.getText(" 1 min"), Messages.ONE_MIN,
Resources.getText(" 5 min"), Messages.FIVE_MIN,
Resources.getText("10 min"), Messages.TEN_MIN,
Resources.getText("30 min"), Messages.THIRTY_MIN,
Resources.getText(" 1 hour"), Messages.ONE_HOUR,
Resources.getText(" 2 hours"), Messages.TWO_HOURS,
Resources.getText(" 3 hours"), Messages.THREE_HOURS,
Resources.getText(" 6 hours"), Messages.SIX_HOURS,
Resources.getText("12 hours"), Messages.TWELVE_HOURS,
Resources.getText(" 1 day"), Messages.ONE_DAY,
Resources.getText(" 7 days"), Messages.SEVEN_DAYS,
Resources.getText(" 1 month"), Messages.ONE_MONTH,
Resources.getText(" 3 months"), Messages.THREE_MONTHS,
Resources.getText(" 6 months"), Messages.SIX_MONTHS,
Resources.getText(" 1 year"), Messages.ONE_YEAR,
Resources.getText("All") Messages.ALL
}; };
static final int[] rangeValues = { static final int[] rangeValues = {
...@@ -247,9 +244,9 @@ public class Plotter extends JComponent ...@@ -247,9 +244,9 @@ public class Plotter extends JComponent
@Override @Override
public JPopupMenu getComponentPopupMenu() { public JPopupMenu getComponentPopupMenu() {
if (popupMenu == null) { if (popupMenu == null) {
popupMenu = new JPopupMenu(Resources.getText("Chart:")); popupMenu = new JPopupMenu(Messages.CHART_COLON);
timeRangeMenu = new JMenu(Resources.getText("Plotter.timeRangeMenu")); timeRangeMenu = new JMenu(Messages.PLOTTER_TIME_RANGE_MENU);
timeRangeMenu.setMnemonic(getMnemonicInt("Plotter.timeRangeMenu")); timeRangeMenu.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_TIME_RANGE_MENU));
popupMenu.add(timeRangeMenu); popupMenu.add(timeRangeMenu);
menuRBs = new JRadioButtonMenuItem[rangeNames.length]; menuRBs = new JRadioButtonMenuItem[rangeNames.length];
ButtonGroup rbGroup = new ButtonGroup(); ButtonGroup rbGroup = new ButtonGroup();
...@@ -265,8 +262,8 @@ public class Plotter extends JComponent ...@@ -265,8 +262,8 @@ public class Plotter extends JComponent
popupMenu.addSeparator(); popupMenu.addSeparator();
saveAsMI = new JMenuItem(getText("Plotter.saveAsMenuItem")); saveAsMI = new JMenuItem(Messages.PLOTTER_SAVE_AS_MENU_ITEM);
saveAsMI.setMnemonic(getMnemonicInt("Plotter.saveAsMenuItem")); saveAsMI.setMnemonic(Resources.getMnemonicInt(Messages.PLOTTER_SAVE_AS_MENU_ITEM));
saveAsMI.addActionListener(this); saveAsMI.addActionListener(this);
popupMenu.add(saveAsMI); popupMenu.add(saveAsMI);
} }
...@@ -318,9 +315,9 @@ public class Plotter extends JComponent ...@@ -318,9 +315,9 @@ public class Plotter extends JComponent
out.close(); out.close();
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
getText("FileChooser.savedFile", Resources.format(Messages.FILE_CHOOSER_SAVED_FILE,
file.getAbsolutePath(), file.getAbsolutePath(),
file.length())); file.length()));
} catch (IOException ex) { } catch (IOException ex) {
String msg = ex.getLocalizedMessage(); String msg = ex.getLocalizedMessage();
String path = file.getAbsolutePath(); String path = file.getAbsolutePath();
...@@ -328,9 +325,10 @@ public class Plotter extends JComponent ...@@ -328,9 +325,10 @@ public class Plotter extends JComponent
msg = msg.substring(path.length()).trim(); msg = msg.substring(path.length()).trim();
} }
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
getText("FileChooser.saveFailed.message", Resources.format(Messages.FILE_CHOOSER_SAVE_FAILED_MESSAGE,
path, msg), path,
getText("FileChooser.saveFailed.title"), msg),
Messages.FILE_CHOOSER_SAVE_FAILED_TITLE,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
} }
...@@ -1020,13 +1018,13 @@ public class Plotter extends JComponent ...@@ -1020,13 +1018,13 @@ public class Plotter extends JComponent
} }
if (file.exists()) { if (file.exists()) {
String okStr = getText("FileChooser.fileExists.okOption"); String okStr = Messages.FILE_CHOOSER_FILE_EXISTS_OK_OPTION;
String cancelStr = getText("FileChooser.fileExists.cancelOption"); String cancelStr = Messages.FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION;
int ret = int ret =
JOptionPane.showOptionDialog(this, JOptionPane.showOptionDialog(this,
getText("FileChooser.fileExists.message", Resources.format(Messages.FILE_CHOOSER_FILE_EXISTS_MESSAGE,
file.getName()), file.getName()),
getText("FileChooser.fileExists.title"), Messages.FILE_CHOOSER_FILE_EXISTS_TITLE,
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE, JOptionPane.WARNING_MESSAGE,
null, null,
...@@ -1053,7 +1051,7 @@ public class Plotter extends JComponent ...@@ -1053,7 +1051,7 @@ public class Plotter extends JComponent
protected class AccessiblePlotter extends AccessibleJComponent { protected class AccessiblePlotter extends AccessibleJComponent {
private static final long serialVersionUID = -3847205410473510922L; private static final long serialVersionUID = -3847205410473510922L;
protected AccessiblePlotter() { protected AccessiblePlotter() {
setAccessibleName(getText("Plotter.accessibleName")); setAccessibleName(Messages.PLOTTER_ACCESSIBLE_NAME);
} }
@Override @Override
...@@ -1067,7 +1065,7 @@ public class Plotter extends JComponent ...@@ -1067,7 +1065,7 @@ public class Plotter extends JComponent
String value = "null"; String value = "null";
if (seq.size > 0) { if (seq.size > 0) {
if (unit == Unit.BYTES) { if (unit == Unit.BYTES) {
value = getText("Size Bytes", seq.value(seq.size - 1)); value = Resources.format(Messages.SIZE_BYTES, seq.value(seq.size - 1));
} else { } else {
value = value =
getFormattedValue(seq.value(seq.size - 1), false) + getFormattedValue(seq.value(seq.size - 1), false) +
...@@ -1076,13 +1074,13 @@ public class Plotter extends JComponent ...@@ -1076,13 +1074,13 @@ public class Plotter extends JComponent
} }
// Assume format string ends with newline // Assume format string ends with newline
keyValueList += keyValueList +=
getText("Plotter.accessibleName.keyAndValue", Resources.format(Messages.PLOTTER_ACCESSIBLE_NAME_KEY_AND_VALUE,
seq.key, value); seq.key, value);
} }
} }
name += "\n" + keyValueList + "."; name += "\n" + keyValueList + ".";
} else { } else {
name += "\n" + getText("Plotter.accessibleName.noData"); name += "\n" + Messages.PLOTTER_ACCESSIBLE_NAME_NO_DATA;
} }
return name; return name;
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import javax.accessibility.*; import javax.accessibility.*;
......
...@@ -27,7 +27,6 @@ package sun.tools.jconsole; ...@@ -27,7 +27,6 @@ package sun.tools.jconsole;
import com.sun.management.HotSpotDiagnosticMXBean; import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.tools.jconsole.JConsoleContext; import com.sun.tools.jconsole.JConsoleContext;
import com.sun.tools.jconsole.JConsoleContext.ConnectionState;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.io.IOException; import java.io.IOException;
...@@ -504,7 +503,7 @@ public class ProxyClient implements JConsoleContext { ...@@ -504,7 +503,7 @@ public class ProxyClient implements JConsoleContext {
public String toString() { public String toString() {
if (!isConnected()) { if (!isConnected()) {
return Resources.getText("ConnectionName (disconnected)", displayName); return Resources.format(Messages.CONNECTION_NAME__DISCONNECTED_, displayName);
} else { } else {
return displayName; return displayName;
} }
...@@ -595,10 +594,10 @@ public class ProxyClient implements JConsoleContext { ...@@ -595,10 +594,10 @@ public class ProxyClient implements JConsoleContext {
assert(false); assert(false);
} }
} }
Set mbeans = server.queryNames(name, null); Set<ObjectName> mbeans = server.queryNames(name, null);
Map<ObjectName,MBeanInfo> result = Map<ObjectName,MBeanInfo> result =
new HashMap<ObjectName,MBeanInfo>(mbeans.size()); new HashMap<ObjectName,MBeanInfo>(mbeans.size());
Iterator iterator = mbeans.iterator(); Iterator<ObjectName> iterator = mbeans.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Object object = iterator.next(); Object object = iterator.next();
if (object instanceof ObjectName) { if (object instanceof ObjectName) {
...@@ -704,10 +703,10 @@ public class ProxyClient implements JConsoleContext { ...@@ -704,10 +703,10 @@ public class ProxyClient implements JConsoleContext {
// should not reach here // should not reach here
assert(false); assert(false);
} }
Set mbeans = server.queryNames(poolName, null); Set<ObjectName> mbeans = server.queryNames(poolName, null);
if (mbeans != null) { if (mbeans != null) {
memoryPoolProxies = new ArrayList<MemoryPoolProxy>(); memoryPoolProxies = new ArrayList<MemoryPoolProxy>();
Iterator iterator = mbeans.iterator(); Iterator<ObjectName> iterator = mbeans.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ObjectName objName = (ObjectName) iterator.next(); ObjectName objName = (ObjectName) iterator.next();
MemoryPoolProxy p = new MemoryPoolProxy(this, objName); MemoryPoolProxy p = new MemoryPoolProxy(this, objName);
...@@ -730,10 +729,10 @@ public class ProxyClient implements JConsoleContext { ...@@ -730,10 +729,10 @@ public class ProxyClient implements JConsoleContext {
// should not reach here // should not reach here
assert(false); assert(false);
} }
Set mbeans = server.queryNames(gcName, null); Set<ObjectName> mbeans = server.queryNames(gcName, null);
if (mbeans != null) { if (mbeans != null) {
garbageCollectorMBeans = new ArrayList<GarbageCollectorMXBean>(); garbageCollectorMBeans = new ArrayList<GarbageCollectorMXBean>();
Iterator iterator = mbeans.iterator(); Iterator<ObjectName> iterator = mbeans.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ObjectName on = (ObjectName) iterator.next(); ObjectName on = (ObjectName) iterator.next();
String name = GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + String name = GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE +
......
...@@ -25,89 +25,185 @@ ...@@ -25,89 +25,185 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.event.KeyEvent;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import sun.tools.jconsole.resources.JConsoleResources;
/** /**
* Provides resource support for jconsole. * Toolkit that provides resource support for JConsole.
*/ */
public final class Resources { public final class Resources {
private static Map<String, Integer> MNEMONIC_LOOKUP = Collections
.synchronizedMap(new HashMap<String, Integer>());
private Resources() {
throw new AssertionError();
}
/**
* Convenience method for {@link MessageFormat#format(String, Object...)}.
*
* @param pattern the pattern
* @param objects the arguments for the pattern
*
* @return a formatted string
*/
public static String format(String pattern, Object... arguments) {
return MessageFormat.format(pattern, arguments);
}
/**
* Returns the mnemonic for a message.
*
* @param message the message
*
* @return the mnemonic <code>int</code>
*/
public static int getMnemonicInt(String message) {
Integer integer = MNEMONIC_LOOKUP.get(message);
if (integer != null) {
return integer.intValue();
}
return 0;
}
private static final Object lock = new Object(); /**
private static JConsoleResources resources = null; * Initializes all non-final public static fields in the given class with
static { * messages from a {@link ResourceBundle}.
*
* @param clazz the class containing the fields
*/
public static void initializeMessages(Class<?> clazz, String rbName) {
ResourceBundle rb = null;
try { try {
resources = rb = ResourceBundle.getBundle(rbName);
(JConsoleResources)ResourceBundle.getBundle("sun.tools.jconsole.resources.JConsoleResources"); } catch (MissingResourceException mre) {
} catch (MissingResourceException e) { // fall through, handled later
// gracefully handle this later }
for (Field field : clazz.getFields()) {
if (isWritableField(field)) {
String key = field.getName();
String message = getMessage(rb, key);
int mnemonicInt = findMnemonicInt(message);
message = removeMnemonicAmpersand(message);
message = replaceWithPlatformLineFeed(message);
setFieldValue(field, message);
MNEMONIC_LOOKUP.put(message, mnemonicInt);
}
} }
} }
private Resources() { throw new AssertionError(); } private static boolean isWritableField(Field field) {
int modifiers = field.getModifiers();
return Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers)
&& !Modifier.isFinal(modifiers);
}
/** /**
* Returns the text of the jconsole resource for the specified key * Returns the message corresponding to the key in the bundle or a text
* formatted with the specified arguments. * describing it's missing.
* *
* @param rb the resource bundle
* @param key the key
*
* @return the message
*/ */
public static String getText(String key, Object... args) { private static String getMessage(ResourceBundle rb, String key) {
String format = getString(key); if (rb == null) {
if (format == null) { return "missing resource bundle";
format = "missing resource key: key = \"" + key + "\", " + }
"arguments = \"{0}\", \"{1}\", \"{2}\""; try {
return rb.getString(key);
} catch (MissingResourceException mre) {
return "missing message for key = \"" + key
+ "\" in resource bundle ";
} }
return formatMessage(format, args);
} }
static String formatMessage(String format, Object... args) { private static void setFieldValue(Field field, String value) {
String ss = null; try {
synchronized (lock) { field.set(null, value);
/* } catch (IllegalArgumentException | IllegalAccessException e) {
* External synchronization required for safe use of throw new Error("Unable to access or set message for field " + field.getName());
* java.text.MessageFormat:
*/
ss = MessageFormat.format(format, args);
} }
return ss;
} }
/** /**
* Returns the mnemonic keycode int of the jconsole resource for the specified key. * Returns a {@link String} where all <code>\n</code> in the <text> have
* been replaced with the line separator for the platform.
*
* @param text the to be replaced
* *
* @return the replaced text
*/ */
public static int getMnemonicInt(String key) { private static String replaceWithPlatformLineFeed(String text) {
int mnemonic = 0; return text.replace("\n", System.getProperty("line.separator"));
if (resources != null) { }
Object obj = resources.getObject(key+".mnemonic");
if (obj instanceof Character) { /**
mnemonic = (int)(Character)obj; * Removes the mnemonic identifier (<code>&</code>) from a string unless
if (mnemonic >= 'a' && mnemonic <='z') { * it's escaped by <code>&&</code> or placed at the end.
mnemonic -= ('a' - 'A'); *
} * @param message the message
} else if (obj instanceof Integer) { *
mnemonic = (Integer)obj; * @return a message with the mnemonic identifier removed
*/
private static String removeMnemonicAmpersand(String message) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < message.length(); i++) {
char current = message.charAt(i);
if (current != '&' || i == message.length() - 1
|| message.charAt(i + 1) == '&') {
s.append(current);
} }
} }
return mnemonic; return s.toString();
} }
/** /**
* Returns the jconsole resource string for the specified key. * Finds the mnemonic character in a message.
*
* The mnemonic character is the first character followed by the first
* <code>&</code> that is not followed by another <code>&</code>.
* *
* @return the mnemonic as an <code>int</code>, or <code>0</code> if it
* can't be found.
*/ */
private static String getString(String key) { private static int findMnemonicInt(String s) {
if (resources != null) { for (int i = 0; i < s.length() - 1; i++) {
try { if (s.charAt(i) == '&') {
return resources.getString(key); if (s.charAt(i + 1) != '&') {
} catch (MissingResourceException e) { return lookupMnemonicInt(s.substring(i + 1, i + 2));
return null; } else {
i++;
}
} }
} }
return "missing resource bundle: key = \"" + key + "\", " + return 0;
"arguments = \"{0}\", \"{1}\", \"{2}\""; }
/**
* Lookups the mnemonic for a key in the {@link KeyEvent} class.
*
* @param c the character to lookup
*
* @return the mnemonic as an <code>int</code>, or <code>0</code> if it
* can't be found.
*/
private static int lookupMnemonicInt(String c) {
try {
return KeyEvent.class.getDeclaredField("VK_" + c.toUpperCase())
.getInt(null);
} catch (IllegalArgumentException | IllegalAccessException
| NoSuchFieldException | SecurityException e) {
// Missing VK is okay
return 0;
}
} }
} }
...@@ -29,24 +29,19 @@ import java.awt.*; ...@@ -29,24 +29,19 @@ import java.awt.*;
import java.io.*; import java.io.*;
import java.lang.management.*; import java.lang.management.*;
import java.lang.reflect.*; import java.lang.reflect.*;
import java.net.URL;
import java.text.*; import java.text.*;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import static sun.tools.jconsole.Formatter.*; import static sun.tools.jconsole.Formatter.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
class SummaryTab extends Tab { class SummaryTab extends Tab {
private static final String cpuUsageKey = "cpu"; private static final String cpuUsageKey = "cpu";
private static final String cpuUsageName = getText("CPU Usage");
private static final String cpuUsageFormat = "CPUUsageFormat";
private static final String newDivider = "<tr><td colspan=4><font size =-1><hr>"; private static final String newDivider = "<tr><td colspan=4><font size =-1><hr>";
private static final String newTable = "<tr><td colspan=4 align=left><table cellpadding=1>"; private static final String newTable = "<tr><td colspan=4 align=left><table cellpadding=1>";
...@@ -70,7 +65,7 @@ class SummaryTab extends Tab { ...@@ -70,7 +65,7 @@ class SummaryTab extends Tab {
} }
public static String getTabName() { public static String getTabName() {
return Resources.getText("SummaryTab.tabName"); return Messages.SUMMARY_TAB_TAB_NAME;
} }
public SummaryTab(VMPanel vmPanel) { public SummaryTab(VMPanel vmPanel) {
...@@ -83,7 +78,7 @@ class SummaryTab extends Tab { ...@@ -83,7 +78,7 @@ class SummaryTab extends Tab {
add(new JScrollPane(info)); add(new JScrollPane(info));
headerDateTimeFormat = headerDateTimeFormat =
getDateTimeFormat("SummaryTab.headerDateTimeFormat"); Formatter.getDateTimeFormat(Messages.SUMMARY_TAB_HEADER_DATE_TIME_FORMAT);
} }
public SwingWorker<?, ?> newSwingWorker() { public SwingWorker<?, ?> newSwingWorker() {
...@@ -138,7 +133,7 @@ class SummaryTab extends Tab { ...@@ -138,7 +133,7 @@ class SummaryTab extends Tab {
proxyClient.getSunOperatingSystemMXBean(); proxyClient.getSunOperatingSystemMXBean();
append("<tr><td colspan=4>"); append("<tr><td colspan=4>");
append("<center><b>" + getText("SummaryTab.tabName") + "</b></center>"); append("<center><b>" + Messages.SUMMARY_TAB_TAB_NAME + "</b></center>");
String dateTime = String dateTime =
headerDateTimeFormat.format(System.currentTimeMillis()); headerDateTimeFormat.format(System.currentTimeMillis());
append("<center>" + dateTime + "</center>"); append("<center>" + dateTime + "</center>");
...@@ -147,30 +142,30 @@ class SummaryTab extends Tab { ...@@ -147,30 +142,30 @@ class SummaryTab extends Tab {
{ // VM info { // VM info
append(newLeftTable); append(newLeftTable);
append("Connection name", vmPanel.getDisplayName()); append(Messages.CONNECTION_NAME, vmPanel.getDisplayName());
append("Virtual Machine", append(Messages.VIRTUAL_MACHINE,
getText("SummaryTab.vmVersion", Resources.format(Messages.SUMMARY_TAB_VM_VERSION,
rmBean.getVmName(), rmBean.getVmVersion())); rmBean.getVmName(), rmBean.getVmVersion()));
append("Vendor", rmBean.getVmVendor()); append(Messages.VENDOR, rmBean.getVmVendor());
append("Name", rmBean.getName()); append(Messages.NAME, rmBean.getName());
append(endTable); append(endTable);
append(newRightTable); append(newRightTable);
result.upTime = rmBean.getUptime(); result.upTime = rmBean.getUptime();
append("Uptime", formatTime(result.upTime)); append(Messages.UPTIME, formatTime(result.upTime));
if (sunOSMBean != null) { if (sunOSMBean != null) {
result.processCpuTime = sunOSMBean.getProcessCpuTime(); result.processCpuTime = sunOSMBean.getProcessCpuTime();
append("Process CPU time", formatNanoTime(result.processCpuTime)); append(Messages.PROCESS_CPU_TIME, formatNanoTime(result.processCpuTime));
} }
if (cmpMBean != null) { if (cmpMBean != null) {
append("JIT compiler", cmpMBean.getName()); append(Messages.JIT_COMPILER, cmpMBean.getName());
append("Total compile time", append(Messages.TOTAL_COMPILE_TIME,
cmpMBean.isCompilationTimeMonitoringSupported() cmpMBean.isCompilationTimeMonitoringSupported()
? formatTime(cmpMBean.getTotalCompilationTime()) ? formatTime(cmpMBean.getTotalCompilationTime())
: getText("Unavailable")); : Messages.UNAVAILABLE);
} else { } else {
append("JIT compiler", getText("Unavailable")); append(Messages.JIT_COMPILER, Messages.UNAVAILABLE);
} }
append(endTable); append(endTable);
} }
...@@ -185,10 +180,10 @@ class SummaryTab extends Tab { ...@@ -185,10 +180,10 @@ class SummaryTab extends Tab {
long ttCount = tmBean.getTotalStartedThreadCount(); long ttCount = tmBean.getTotalStartedThreadCount();
String[] strings1 = formatLongs(tlCount, tpCount, String[] strings1 = formatLongs(tlCount, tpCount,
tdCount, ttCount); tdCount, ttCount);
append("Live Threads", strings1[0]); append(Messages.LIVE_THREADS, strings1[0]);
append("Peak", strings1[1]); append(Messages.PEAK, strings1[1]);
append("Daemon threads", strings1[2]); append(Messages.DAEMON_THREADS, strings1[2]);
append("Total threads started", strings1[3]); append(Messages.TOTAL_THREADS_STARTED, strings1[3]);
append(endTable); append(endTable);
append(newRightTable); append(newRightTable);
...@@ -196,9 +191,9 @@ class SummaryTab extends Tab { ...@@ -196,9 +191,9 @@ class SummaryTab extends Tab {
long cuCount = clMBean.getUnloadedClassCount(); long cuCount = clMBean.getUnloadedClassCount();
long ctCount = clMBean.getTotalLoadedClassCount(); long ctCount = clMBean.getTotalLoadedClassCount();
String[] strings2 = formatLongs(clCount, cuCount, ctCount); String[] strings2 = formatLongs(clCount, cuCount, ctCount);
append("Current classes loaded", strings2[0]); append(Messages.CURRENT_CLASSES_LOADED, strings2[0]);
append("Total classes loaded", strings2[2]); append(Messages.TOTAL_CLASSES_LOADED, strings2[2]);
append("Total classes unloaded", strings2[1]); append(Messages.TOTAL_CLASSES_UNLOADED, strings2[1]);
append(null, ""); append(null, "");
append(endTable); append(endTable);
} }
...@@ -210,16 +205,16 @@ class SummaryTab extends Tab { ...@@ -210,16 +205,16 @@ class SummaryTab extends Tab {
append(newLeftTable); append(newLeftTable);
String[] strings1 = formatKByteStrings(u.getUsed(), u.getMax()); String[] strings1 = formatKByteStrings(u.getUsed(), u.getMax());
append("Current heap size", strings1[0]); append(Messages.CURRENT_HEAP_SIZE, strings1[0]);
append("Maximum heap size", strings1[1]); append(Messages.MAXIMUM_HEAP_SIZE, strings1[1]);
append(endTable); append(endTable);
append(newRightTable); append(newRightTable);
String[] strings2 = formatKByteStrings(u.getCommitted()); String[] strings2 = formatKByteStrings(u.getCommitted());
append("Committed memory", strings2[0]); append(Messages.COMMITTED_MEMORY, strings2[0]);
append("SummaryTab.pendingFinalization.label", append(Messages.SUMMARY_TAB_PENDING_FINALIZATION_LABEL,
getText("SummaryTab.pendingFinalization.value", Messages.SUMMARY_TAB_PENDING_FINALIZATION_VALUE,
memoryBean.getObjectPendingFinalizationCount())); memoryBean.getObjectPendingFinalizationCount());
append(endTable); append(endTable);
append(newTable); append(newTable);
...@@ -230,10 +225,10 @@ class SummaryTab extends Tab { ...@@ -230,10 +225,10 @@ class SummaryTab extends Tab {
long gcCount = garbageCollectorMBean.getCollectionCount(); long gcCount = garbageCollectorMBean.getCollectionCount();
long gcTime = garbageCollectorMBean.getCollectionTime(); long gcTime = garbageCollectorMBean.getCollectionTime();
append("Garbage collector", append(Messages.GARBAGE_COLLECTOR,
getText("GcInfo", gcName, gcCount, Resources.format(Messages.GC_INFO, gcName, gcCount,
(gcTime >= 0) ? formatTime(gcTime) (gcTime >= 0) ? formatTime(gcTime)
: getText("Unavailable")), : Messages.UNAVAILABLE),
4); 4);
} }
append(endTable); append(endTable);
...@@ -247,9 +242,9 @@ class SummaryTab extends Tab { ...@@ -247,9 +242,9 @@ class SummaryTab extends Tab {
String osVersion = osMBean.getVersion(); String osVersion = osMBean.getVersion();
String osArch = osMBean.getArch(); String osArch = osMBean.getArch();
result.nCPUs = osMBean.getAvailableProcessors(); result.nCPUs = osMBean.getAvailableProcessors();
append("Operating System", osName + " " + osVersion); append(Messages.OPERATING_SYSTEM, osName + " " + osVersion);
append("Architecture", osArch); append(Messages.ARCHITECTURE, osArch);
append("Number of processors", result.nCPUs+""); append(Messages.NUMBER_OF_PROCESSORS, result.nCPUs+"");
if (pathSeparator == null) { if (pathSeparator == null) {
// Must use separator of remote OS, not File.pathSeparator // Must use separator of remote OS, not File.pathSeparator
...@@ -268,14 +263,14 @@ class SummaryTab extends Tab { ...@@ -268,14 +263,14 @@ class SummaryTab extends Tab {
sunOSMBean.getTotalSwapSpaceSize(), sunOSMBean.getTotalSwapSpaceSize(),
sunOSMBean.getFreeSwapSpaceSize()); sunOSMBean.getFreeSwapSpaceSize());
append("Committed virtual memory", kbStrings1[0]); append(Messages.COMMITTED_VIRTUAL_MEMORY, kbStrings1[0]);
append(endTable); append(endTable);
append(newRightTable); append(newRightTable);
append("Total physical memory", kbStrings2[0]); append(Messages.TOTAL_PHYSICAL_MEMORY, kbStrings2[0]);
append("Free physical memory", kbStrings2[1]); append(Messages.FREE_PHYSICAL_MEMORY, kbStrings2[1]);
append("Total swap space", kbStrings2[2]); append(Messages.TOTAL_SWAP_SPACE, kbStrings2[2]);
append("Free swap space", kbStrings2[3]); append(Messages.FREE_SWAP_SPACE, kbStrings2[3]);
} }
append(endTable); append(endTable);
...@@ -290,13 +285,13 @@ class SummaryTab extends Tab { ...@@ -290,13 +285,13 @@ class SummaryTab extends Tab {
for (String arg : inputArguments) { for (String arg : inputArguments) {
args += arg + " "; args += arg + " ";
} }
append("VM arguments", args, 4); append(Messages.VM_ARGUMENTS, args, 4);
append("Class path", rmBean.getClassPath(), 4); append(Messages.CLASS_PATH, rmBean.getClassPath(), 4);
append("Library path", rmBean.getLibraryPath(), 4); append(Messages.LIBRARY_PATH, rmBean.getLibraryPath(), 4);
append("Boot class path", append(Messages.BOOT_CLASS_PATH,
rmBean.isBootClassPathSupported() rmBean.isBootClassPathSupported()
? rmBean.getBootClassPath() ? rmBean.getBootClassPath()
: getText("Unavailable"), : Messages.UNAVAILABLE,
4); 4);
append(endTable); append(endTable);
} }
...@@ -327,7 +322,7 @@ class SummaryTab extends Tab { ...@@ -327,7 +322,7 @@ class SummaryTab extends Tab {
} }
void append(String label, String value) { void append(String label, String value) {
append(newRow((label != null) ? getText(label) : label, value)); append(newRow(label, value));
} }
private void append(String label, String value, int columnPerRow) { private void append(String label, String value, int columnPerRow) {
...@@ -335,13 +330,7 @@ class SummaryTab extends Tab { ...@@ -335,13 +330,7 @@ class SummaryTab extends Tab {
value = value.replace(pathSeparator, value = value.replace(pathSeparator,
"<b></b>" + pathSeparator); "<b></b>" + pathSeparator);
} }
append(newRow(getText(label), value, columnPerRow)); append(newRow(label, value, columnPerRow));
}
void append(String label1, String value1,
String label2, String value2) {
append(newRow(getText(label1), value1,
getText(label2), value2));
} }
OverviewPanel[] getOverviewPanels() { OverviewPanel[] getOverviewPanels() {
...@@ -355,7 +344,7 @@ class SummaryTab extends Tab { ...@@ -355,7 +344,7 @@ class SummaryTab extends Tab {
private long prevUpTime, prevProcessCpuTime; private long prevUpTime, prevProcessCpuTime;
CPUOverviewPanel() { CPUOverviewPanel() {
super(getText("CPU Usage"), cpuUsageKey, cpuUsageName, Plotter.Unit.PERCENT); super(Messages.CPU_USAGE, cpuUsageKey, Messages.CPU_USAGE, Plotter.Unit.PERCENT);
getPlotter().setDecimals(CPU_DECIMALS); getPlotter().setDecimals(CPU_DECIMALS);
} }
...@@ -373,14 +362,11 @@ class SummaryTab extends Tab { ...@@ -373,14 +362,11 @@ class SummaryTab extends Tab {
getPlotter().addValues(result.timeStamp, getPlotter().addValues(result.timeStamp,
Math.round(cpuUsage * Math.pow(10.0, CPU_DECIMALS))); Math.round(cpuUsage * Math.pow(10.0, CPU_DECIMALS)));
getInfoLabel().setText(getText(cpuUsageFormat, getInfoLabel().setText(Resources.format(Messages.CPU_USAGE_FORMAT,
String.format("%."+CPU_DECIMALS+"f", cpuUsage))); String.format("%."+CPU_DECIMALS+"f", cpuUsage)));
} }
this.prevUpTime = result.upTime; this.prevUpTime = result.upTime;
this.prevProcessCpuTime = result.processCpuTime; this.prevProcessCpuTime = result.processCpuTime;
} }
} }
} }
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.*; import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import javax.swing.*; import javax.swing.*;
public abstract class Tab extends JPanel { public abstract class Tab extends JPanel {
......
...@@ -35,14 +35,11 @@ import javax.swing.*; ...@@ -35,14 +35,11 @@ import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
import javax.swing.event.*; import javax.swing.event.*;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.List; import java.util.List;
import sun.awt.*;
import static sun.tools.jconsole.OverviewPanel.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
...@@ -51,7 +48,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -51,7 +48,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
PlotterPanel threadMeter; PlotterPanel threadMeter;
TimeComboBox timeComboBox; TimeComboBox timeComboBox;
JTabbedPane threadListTabbedPane; JTabbedPane threadListTabbedPane;
DefaultListModel listModel; DefaultListModel<Long> listModel;
JTextField filterTF; JTextField filterTF;
JLabel messageLabel; JLabel messageLabel;
JSplitPane threadsSplitPane; JSplitPane threadsSplitPane;
...@@ -64,9 +61,6 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -64,9 +61,6 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
private static final String threadCountKey = "threadCount"; private static final String threadCountKey = "threadCount";
private static final String peakKey = "peak"; private static final String peakKey = "peak";
private static final String threadCountName = Resources.getText("Live Threads");
private static final String peakName = Resources.getText("Peak");
private static final Color threadCountColor = Plotter.defaultColor; private static final Color threadCountColor = Plotter.defaultColor;
private static final Color peakColor = Color.red; private static final Color peakColor = Color.red;
...@@ -93,7 +87,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -93,7 +87,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
public static String getTabName() { public static String getTabName() {
return Resources.getText("Threads"); return Messages.THREADS;
} }
public ThreadTab(VMPanel vmPanel) { public ThreadTab(VMPanel vmPanel) {
...@@ -111,28 +105,28 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -111,28 +105,28 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5)); JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5));
topPanel.add(controlPanel, BorderLayout.CENTER); topPanel.add(controlPanel, BorderLayout.CENTER);
threadMeter = new PlotterPanel(Resources.getText("Number of Threads"), threadMeter = new PlotterPanel(Messages.NUMBER_OF_THREADS,
Plotter.Unit.NONE, true); Plotter.Unit.NONE, true);
threadMeter.plotter.createSequence(threadCountKey, threadCountName, threadCountColor, true); threadMeter.plotter.createSequence(threadCountKey, Messages.LIVE_THREADS, threadCountColor, true);
threadMeter.plotter.createSequence(peakKey, peakName, peakColor, true); threadMeter.plotter.createSequence(peakKey, Messages.PEAK, peakColor, true);
setAccessibleName(threadMeter.plotter, setAccessibleName(threadMeter.plotter,
getText("ThreadTab.threadPlotter.accessibleName")); Messages.THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME);
plotterPanel.add(threadMeter); plotterPanel.add(threadMeter);
timeComboBox = new TimeComboBox(threadMeter.plotter); timeComboBox = new TimeComboBox(threadMeter.plotter);
controlPanel.add(new LabeledComponent(Resources.getText("Time Range:"), controlPanel.add(new LabeledComponent(Messages.TIME_RANGE_COLON,
getMnemonicInt("Time Range:"), Resources.getMnemonicInt(Messages.TIME_RANGE_COLON),
timeComboBox)); timeComboBox));
listModel = new DefaultListModel(); listModel = new DefaultListModel<Long>();
JTextArea textArea = new JTextArea(); JTextArea textArea = new JTextArea();
textArea.setBorder(thinEmptyBorder); textArea.setBorder(thinEmptyBorder);
textArea.setEditable(false); textArea.setEditable(false);
setAccessibleName(textArea, setAccessibleName(textArea,
getText("ThreadTab.threadInfo.accessibleName")); Messages.THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME);
JList list = new ThreadJList(listModel, textArea); ThreadJList list = new ThreadJList(listModel, textArea);
Dimension di = new Dimension(super.getPreferredSize()); Dimension di = new Dimension(super.getPreferredSize());
di.width = Math.min(di.width, 200); di.width = Math.min(di.width, 200);
...@@ -165,11 +159,11 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -165,11 +159,11 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
filterTF.getPreferredSize().height)); filterTF.getPreferredSize().height));
firstTabToolPanel.add(separator); firstTabToolPanel.add(separator);
JButton detectDeadlockButton = new JButton(Resources.getText("Detect Deadlock")); JButton detectDeadlockButton = new JButton(Messages.DETECT_DEADLOCK);
detectDeadlockButton.setMnemonic(getMnemonicInt("Detect Deadlock")); detectDeadlockButton.setMnemonic(Resources.getMnemonicInt(Messages.DETECT_DEADLOCK));
detectDeadlockButton.setActionCommand("detectDeadlock"); detectDeadlockButton.setActionCommand("detectDeadlock");
detectDeadlockButton.addActionListener(this); detectDeadlockButton.addActionListener(this);
detectDeadlockButton.setToolTipText(getText("Detect Deadlock.toolTip")); detectDeadlockButton.setToolTipText(Messages.DETECT_DEADLOCK_TOOLTIP);
firstTabToolPanel.add(detectDeadlockButton); firstTabToolPanel.add(detectDeadlockButton);
messageLabel = new JLabel(); messageLabel = new JLabel();
...@@ -177,7 +171,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -177,7 +171,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
firstTabPanel.add(threadsSplitPane, BorderLayout.CENTER); firstTabPanel.add(threadsSplitPane, BorderLayout.CENTER);
firstTabPanel.add(firstTabToolPanel, BorderLayout.SOUTH); firstTabPanel.add(firstTabToolPanel, BorderLayout.SOUTH);
threadListTabbedPane.addTab(Resources.getText("Threads"), firstTabPanel); threadListTabbedPane.addTab(Messages.THREADS, firstTabPanel);
plotterPanel.add(threadListTabbedPane); plotterPanel.add(threadListTabbedPane);
} }
...@@ -356,32 +350,32 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -356,32 +350,32 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
} }
if (ti != null) { if (ti != null) {
if (ti.getLockName() == null) { if (ti.getLockName() == null) {
sb.append(Resources.getText("Name State", sb.append(Resources.format(Messages.NAME_STATE,
ti.getThreadName(), ti.getThreadName(),
ti.getThreadState().toString())); ti.getThreadState().toString()));
} else if (ti.getLockOwnerName() == null) { } else if (ti.getLockOwnerName() == null) {
sb.append(Resources.getText("Name State LockName", sb.append(Resources.format(Messages.NAME_STATE_LOCK_NAME,
ti.getThreadName(), ti.getThreadName(),
ti.getThreadState().toString(), ti.getThreadState().toString(),
ti.getLockName())); ti.getLockName()));
} else { } else {
sb.append(Resources.getText("Name State LockName LockOwner", sb.append(Resources.format(Messages.NAME_STATE_LOCK_NAME_LOCK_OWNER,
ti.getThreadName(), ti.getThreadName(),
ti.getThreadState().toString(), ti.getThreadState().toString(),
ti.getLockName(), ti.getLockName(),
ti.getLockOwnerName())); ti.getLockOwnerName()));
} }
sb.append(Resources.getText("BlockedCount WaitedCount", sb.append(Resources.format(Messages.BLOCKED_COUNT_WAITED_COUNT,
ti.getBlockedCount(), ti.getBlockedCount(),
ti.getWaitedCount())); ti.getWaitedCount()));
sb.append(Resources.getText("Stack trace")); sb.append(Messages.STACK_TRACE);
int index = 0; int index = 0;
for (StackTraceElement e : ti.getStackTrace()) { for (StackTraceElement e : ti.getStackTrace()) {
sb.append(e.toString()+"\n"); sb.append(e.toString()+"\n");
if (monitors != null) { if (monitors != null) {
for (MonitorInfo mi : monitors) { for (MonitorInfo mi : monitors) {
if (mi.getLockedStackDepth() == index) { if (mi.getLockedStackDepth() == index) {
sb.append(Resources.getText("Monitor locked", mi.toString())); sb.append(Resources.format(Messages.MONITOR_LOCKED, mi.toString()));
} }
} }
} }
...@@ -429,7 +423,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -429,7 +423,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
try { try {
SwingUtilities.invokeAndWait(new Runnable() { SwingUtilities.invokeAndWait(new Runnable() {
public void run() { public void run() {
String msg = Resources.getText("No deadlock detected"); String msg = Messages.NO_DEADLOCK_DETECTED;
messageLabel.setText(msg); messageLabel.setText(msg);
threadListTabbedPane.revalidate(); threadListTabbedPane.revalidate();
} }
...@@ -459,13 +453,13 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -459,13 +453,13 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
if (deadlockedThreads != null) { if (deadlockedThreads != null) {
for (int i = 0; i < deadlockedThreads.length; i++) { for (int i = 0; i < deadlockedThreads.length; i++) {
DefaultListModel listModel = new DefaultListModel(); DefaultListModel<Long> listModel = new DefaultListModel<Long>();
JTextArea textArea = new JTextArea(); JTextArea textArea = new JTextArea();
textArea.setBorder(thinEmptyBorder); textArea.setBorder(thinEmptyBorder);
textArea.setEditable(false); textArea.setEditable(false);
setAccessibleName(textArea, setAccessibleName(textArea,
getText("ThreadTab.threadInfo.accessibleName")); Messages.THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME);
JList list = new ThreadJList(listModel, textArea); ThreadJList list = new ThreadJList(listModel, textArea);
JScrollPane threadlistSP = new JScrollPane(list); JScrollPane threadlistSP = new JScrollPane(list);
JScrollPane textAreaSP = new JScrollPane(textArea); JScrollPane textAreaSP = new JScrollPane(textArea);
threadlistSP.setBorder(null); threadlistSP.setBorder(null);
...@@ -477,9 +471,9 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -477,9 +471,9 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
splitPane.setDividerLocation(threadsSplitPane.getDividerLocation()); splitPane.setDividerLocation(threadsSplitPane.getDividerLocation());
String tabName; String tabName;
if (deadlockedThreads.length > 1) { if (deadlockedThreads.length > 1) {
tabName = Resources.getText("deadlockTabN", i+1); tabName = Resources.format(Messages.DEADLOCK_TAB_N, i+1);
} else { } else {
tabName = Resources.getText("deadlockTab"); tabName = Messages.DEADLOCK_TAB;
} }
threadListTabbedPane.addTab(tabName, splitPane); threadListTabbedPane.addTab(tabName, splitPane);
...@@ -591,10 +585,10 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -591,10 +585,10 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
private class ThreadJList extends JList { private class ThreadJList extends JList<Long> {
private JTextArea textArea; private JTextArea textArea;
ThreadJList(DefaultListModel listModel, JTextArea textArea) { ThreadJList(DefaultListModel<Long> listModel, JTextArea textArea) {
super(listModel); super(listModel);
this.textArea = textArea; this.textArea = textArea;
...@@ -603,7 +597,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -603,7 +597,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
addListSelectionListener(ThreadTab.this); addListSelectionListener(ThreadTab.this);
setCellRenderer(new DefaultListCellRenderer() { setCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, public Component getListCellRendererComponent(JList<?> list, Object value, int index,
boolean isSelected, boolean cellHasFocus) { boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
...@@ -691,12 +685,12 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel ...@@ -691,12 +685,12 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
private static class ThreadOverviewPanel extends OverviewPanel { private static class ThreadOverviewPanel extends OverviewPanel {
ThreadOverviewPanel() { ThreadOverviewPanel() {
super(getText("Threads"), threadCountKey, threadCountName, null); super(Messages.THREADS, threadCountKey, Messages.LIVE_THREADS, null);
} }
private void updateThreadsInfo(long tlCount, long tpCount, long ttCount, long timeStamp) { private void updateThreadsInfo(long tlCount, long tpCount, long ttCount, long timeStamp) {
getPlotter().addValues(timeStamp, tlCount); getPlotter().addValues(timeStamp, tlCount);
getInfoLabel().setText(getText(infoLabelFormat, tlCount, tpCount, ttCount)); getInfoLabel().setText(Resources.format(infoLabelFormat, tlCount, tpCount, ttCount));
} }
} }
} }
...@@ -26,16 +26,9 @@ ...@@ -26,16 +26,9 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.*; import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.Timer;
import javax.swing.border.*;
import javax.swing.event.*;
import static sun.tools.jconsole.Resources.*;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
...@@ -47,7 +40,7 @@ public class VMInternalFrame extends MaximizableInternalFrame { ...@@ -47,7 +40,7 @@ public class VMInternalFrame extends MaximizableInternalFrame {
this.vmPanel = vmPanel; this.vmPanel = vmPanel;
setAccessibleDescription(this, setAccessibleDescription(this,
getText("VMInternalFrame.accessibleDescription")); Messages.VMINTERNAL_FRAME_ACCESSIBLE_DESCRIPTION);
getContentPane().add(vmPanel, BorderLayout.CENTER); getContentPane().add(vmPanel, BorderLayout.CENTER);
pack(); pack();
vmPanel.updateFrameTitle(); vmPanel.updateFrameTitle();
......
...@@ -28,18 +28,16 @@ package sun.tools.jconsole; ...@@ -28,18 +28,16 @@ package sun.tools.jconsole;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.beans.*; import java.beans.*;
import java.io.*;
import java.lang.reflect.*; import java.lang.reflect.*;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
import java.util.Timer; import java.util.Timer;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.*; import javax.swing.plaf.*;
import com.sun.tools.jconsole.JConsolePlugin; import com.sun.tools.jconsole.JConsolePlugin;
import com.sun.tools.jconsole.JConsoleContext; import com.sun.tools.jconsole.JConsoleContext;
import static com.sun.tools.jconsole.JConsoleContext.ConnectionState.*;
import static sun.tools.jconsole.ProxyClient.*; import static sun.tools.jconsole.ProxyClient.*;
...@@ -51,13 +49,10 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -51,13 +49,10 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
private int updateInterval; private int updateInterval;
private String hostName; private String hostName;
private int port; private int port;
private int vmid;
private String userName; private String userName;
private String password; private String password;
private String url; private String url;
private VMInternalFrame vmIF = null; private VMInternalFrame vmIF = null;
private static final String windowsLaF =
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
private static ArrayList<TabInfo> tabInfos = new ArrayList<TabInfo>(); private static ArrayList<TabInfo> tabInfos = new ArrayList<TabInfo>();
private boolean wasConnected = false; private boolean wasConnected = false;
...@@ -100,7 +95,6 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -100,7 +95,6 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
this.updateInterval = updateInterval; this.updateInterval = updateInterval;
this.hostName = proxyClient.getHostName(); this.hostName = proxyClient.getHostName();
this.port = proxyClient.getPort(); this.port = proxyClient.getPort();
this.vmid = proxyClient.getVmid();
this.userName = proxyClient.getUserName(); this.userName = proxyClient.getUserName();
this.password = proxyClient.getPassword(); this.password = proxyClient.getPassword();
this.url = proxyClient.getUrl(); this.url = proxyClient.getUrl();
...@@ -186,9 +180,9 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -186,9 +180,9 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
public String getToolTipText(MouseEvent event) { public String getToolTipText(MouseEvent event) {
if (connectedIconBounds.contains(event.getPoint())) { if (connectedIconBounds.contains(event.getPoint())) {
if (isConnected()) { if (isConnected()) {
return getText("Connected. Click to disconnect."); return Messages.CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_;
} else { } else {
return getText("Disconnected. Click to connect."); return Messages.DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_;
} }
} else { } else {
return super.getToolTipText(event); return super.getToolTipText(event);
...@@ -219,7 +213,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -219,7 +213,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
private Tab instantiate(TabInfo tabInfo) { private Tab instantiate(TabInfo tabInfo) {
try { try {
Constructor con = tabInfo.tabClass.getConstructor(VMPanel.class); Constructor<?> con = tabInfo.tabClass.getConstructor(VMPanel.class);
return (Tab) con.newInstance(this); return (Tab) con.newInstance(this);
} catch (Exception ex) { } catch (Exception ex) {
System.err.println(ex); System.err.println(ex);
...@@ -354,7 +348,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -354,7 +348,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
private void onConnecting() { private void onConnecting() {
time0 = System.currentTimeMillis(); time0 = System.currentTimeMillis();
final JConsole jc = (JConsole) SwingUtilities.getWindowAncestor(this); SwingUtilities.getWindowAncestor(this);
String connectionName = getConnectionName(); String connectionName = getConnectionName();
progressBar = new JProgressBar(); progressBar = new JProgressBar();
...@@ -363,9 +357,9 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -363,9 +357,9 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
progressPanel.add(progressBar); progressPanel.add(progressBar);
Object[] message = { Object[] message = {
"<html><h3>" + getText("connectingTo1", connectionName) + "</h3></html>", "<html><h3>" + Resources.format(Messages.CONNECTING_TO1, connectionName) + "</h3></html>",
progressPanel, progressPanel,
"<html><b>" + getText("connectingTo2", connectionName) + "</b></html>" "<html><b>" + Resources.format(Messages.CONNECTING_TO2, connectionName) + "</b></html>"
}; };
optionPane = optionPane =
...@@ -373,7 +367,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -373,7 +367,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
message, message,
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, JOptionPane.INFORMATION_MESSAGE, null,
new String[]{getText("Cancel")}, new String[]{Messages.CANCEL},
0); 0);
...@@ -409,7 +403,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -409,7 +403,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
if (vmIF != null) { if (vmIF != null) {
String displayName = getDisplayName(); String displayName = getDisplayName();
if (!proxyClient.isConnected()) { if (!proxyClient.isConnected()) {
displayName = getText("ConnectionName (disconnected)", displayName); displayName = Resources.format(Messages.CONNECTION_NAME__DISCONNECTED_, displayName);
} }
vmIF.setTitle(displayName); vmIF.setTitle(displayName);
} }
...@@ -458,25 +452,18 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -458,25 +452,18 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
private void vmPanelDied() { private void vmPanelDied() {
disconnect(); disconnect();
final JConsole jc = (JConsole) SwingUtilities.getWindowAncestor(this);
JOptionPane optionPane; JOptionPane optionPane;
final String connectStr = getText("Connect");
final String reconnectStr = getText("Reconnect");
final String cancelStr = getText("Cancel");
String msgTitle, msgExplanation, buttonStr; String msgTitle, msgExplanation, buttonStr;
if (wasConnected) { if (wasConnected) {
wasConnected = false; wasConnected = false;
msgTitle = getText("connectionLost1"); msgTitle = Messages.CONNECTION_LOST1;
msgExplanation = getText("connectionLost2", getConnectionName()); msgExplanation = Resources.format(Messages.CONNECTING_TO2, getConnectionName());
buttonStr = reconnectStr; buttonStr = Messages.RECONNECT;
} else { } else {
msgTitle = getText("connectionFailed1"); msgTitle =Messages.CONNECTION_FAILED1;
msgExplanation = getText("connectionFailed2", getConnectionName()); msgExplanation = Resources.format(Messages.CONNECTION_FAILED2, getConnectionName());
buttonStr = connectStr; buttonStr = Messages.CONNECT;
} }
optionPane = optionPane =
...@@ -485,7 +472,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -485,7 +472,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
"<b>" + msgExplanation + "</b>", "<b>" + msgExplanation + "</b>",
JOptionPane.DEFAULT_OPTION, JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE, null, JOptionPane.WARNING_MESSAGE, null,
new String[]{buttonStr, cancelStr}, new String[]{buttonStr, Messages.CANCEL},
0); 0);
optionPane.addPropertyChangeListener(new PropertyChangeListener() { optionPane.addPropertyChangeListener(new PropertyChangeListener() {
...@@ -494,7 +481,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -494,7 +481,7 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) { if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) {
Object value = event.getNewValue(); Object value = event.getNewValue();
if (value == reconnectStr || value == connectStr) { if (value == Messages.RECONNECT || value == Messages.CONNECT) {
connect(); connect();
} else if (!everConnected) { } else if (!everConnected) {
try { try {
...@@ -643,11 +630,6 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener { ...@@ -643,11 +630,6 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
} }
} }
// Convenience methods
private static String getText(String key, Object... args) {
return Resources.getText(key, args);
}
private void createPluginTabs() { private void createPluginTabs() {
// add plugin tabs if not done // add plugin tabs if not done
if (!pluginTabsAdded) { if (!pluginTabsAdded) {
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.awt.*; import java.awt.*;
import java.util.*;
import javax.swing.*; import javax.swing.*;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package sun.tools.jconsole; package sun.tools.jconsole;
import java.io.PrintStream; import java.io.PrintStream;
import sun.tools.jconsole.Messages;
public class Version { public class Version {
private static final String jconsole_version = private static final String jconsole_version =
...@@ -34,19 +35,19 @@ public class Version { ...@@ -34,19 +35,19 @@ public class Version {
public static void print(PrintStream ps) { public static void print(PrintStream ps) {
printFullVersion(ps); printFullVersion(ps);
ps.println(Resources.getText("Name and Build", ps.println(Resources.format(Messages.NAME_AND_BUILD,
System.getProperty("java.runtime.name"), System.getProperty("java.runtime.name"),
System.getProperty("java.runtime.version"))); System.getProperty("java.runtime.version")));
ps.println(Resources.getText("Name Build and Mode", ps.println(Resources.format(Messages.NAME_AND_BUILD,
System.getProperty("java.vm.name"), System.getProperty("java.vm.name"),
System.getProperty("java.vm.version"), System.getProperty("java.vm.version"),
System.getProperty("java.vm.info"))); System.getProperty("java.vm.info")));
} }
public static void printFullVersion(PrintStream ps) { public static void printFullVersion(PrintStream ps) {
ps.println(Resources.getText("JConsole version", jconsole_version)); ps.println(Resources.format(Messages.JCONSOLE_VERSION, jconsole_version));
} }
static String getVersion() { static String getVersion() {
......
...@@ -25,30 +25,14 @@ ...@@ -25,30 +25,14 @@
package sun.tools.jconsole.inspector; package sun.tools.jconsole.inspector;
// java import
import java.awt.*; import java.awt.*;
import java.awt.event.*;
import java.awt.dnd.*;
import java.lang.reflect.*;
import java.io.*;
//
// swing import
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.*; import javax.swing.*;
//
// jmx import
import javax.management.*; import javax.management.*;
//
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class OperationEntry extends JPanel { public class OperationEntry extends JPanel {
private MBeanOperationInfo operation; private MBeanOperationInfo operation;
private JComboBox sigs; private JComboBox sigs;
private Dimension preferredSize;
private XTextField inputs[]; private XTextField inputs[];
public OperationEntry (MBeanOperationInfo operation, public OperationEntry (MBeanOperationInfo operation,
...@@ -61,26 +45,10 @@ public class OperationEntry extends JPanel { ...@@ -61,26 +45,10 @@ public class OperationEntry extends JPanel {
setPanel(isCallable, button, xoperations); setPanel(isCallable, button, xoperations);
} }
/** private void setPanel(boolean isCallable,
* This method chops off the throws exceptions, removes "java.lang".
*/
private String preProcessSignature(String signature) {
int index;
if ((index=signature.indexOf(" throws"))>0) {
signature = signature.substring(0,index);
}
while ((index = signature.indexOf("java.lang."))>0) {
signature = signature.substring(0,index)+
signature.substring(index+10,signature.length());
}
return signature;
}
private void setPanel(boolean isCallable,
JButton button, JButton button,
XOperations xoperations) { XOperations xoperations) {
try { try {
String defaultVal;
MBeanParameterInfo params[] = operation.getSignature(); MBeanParameterInfo params[] = operation.getSignature();
add(new JLabel("(",JLabel.CENTER)); add(new JLabel("(",JLabel.CENTER));
inputs = new XTextField[params.length]; inputs = new XTextField[params.length];
......
...@@ -94,7 +94,7 @@ public class TableSorter extends DefaultTableModel implements MouseListener { ...@@ -94,7 +94,7 @@ public class TableSorter extends DefaultTableModel implements MouseListener {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private int compare(Object o1, Object o2) { private int compare(Object o1, Object o2) {
// take care of the case where both o1 & o2 are null. Needed to keep // take care of the case where both o1 & o2 are null. Needed to keep
// the method symetric. Without this quickSort gives surprising results. // the method symmetric. Without this quickSort gives surprising results.
if (o1 == o2) if (o1 == o2)
return 0; return 0;
if (o1==null) if (o1==null)
......
...@@ -28,7 +28,6 @@ package sun.tools.jconsole.inspector; ...@@ -28,7 +28,6 @@ package sun.tools.jconsole.inspector;
// java import // java import
import java.awt.*; import java.awt.*;
import javax.swing.*; import javax.swing.*;
import java.io.*;
// //
public class ThreadDialog implements Runnable { public class ThreadDialog implements Runnable {
......
...@@ -284,7 +284,7 @@ public class Utils { ...@@ -284,7 +284,7 @@ public class Utils {
*/ */
public static Object newStringConstructor(String type, String param) public static Object newStringConstructor(String type, String param)
throws Exception { throws Exception {
Constructor c = Utils.getClass(type).getConstructor(String.class); Constructor<?> c = Utils.getClass(type).getConstructor(String.class);
try { try {
return c.newInstance(param); return c.newInstance(param);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
......
...@@ -46,9 +46,9 @@ class XArrayDataViewer { ...@@ -46,9 +46,9 @@ class XArrayDataViewer {
if (isViewableValue(value)) { if (isViewableValue(value)) {
Object[] arr; Object[] arr;
if (value instanceof Collection) { if (value instanceof Collection) {
arr = ((Collection) value).toArray(); arr = ((Collection<?>) value).toArray();
} else if (value instanceof Map) { } else if (value instanceof Map) {
arr = ((Map) value).entrySet().toArray(); arr = ((Map<?,?>) value).entrySet().toArray();
} else if (value instanceof Object[]) { } else if (value instanceof Object[]) {
arr = (Object[]) value; arr = (Object[]) value;
} else { } else {
......
...@@ -34,7 +34,7 @@ import java.awt.Component; ...@@ -34,7 +34,7 @@ import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import sun.tools.jconsole.MBeansTab; import sun.tools.jconsole.MBeansTab;
import sun.tools.jconsole.Resources; import sun.tools.jconsole.Messages;
public class XDataViewer { public class XDataViewer {
...@@ -100,10 +100,10 @@ public class XDataViewer { ...@@ -100,10 +100,10 @@ public class XDataViewer {
public static String getActionLabel(int type) { public static String getActionLabel(int type) {
if(type == ARRAY || if(type == ARRAY ||
type == OPEN) type == OPEN)
return Resources.getText("visualize"); return Messages.VISUALIZE;
if(type == NUMERIC) if(type == NUMERIC)
return Resources.getText("plot"); return Messages.PLOT;
return Resources.getText("expand"); return Messages.EXPAND;
} }
public Component createOperationViewer(Object value, public Component createOperationViewer(Object value,
......
...@@ -66,9 +66,9 @@ import javax.swing.table.TableColumn; ...@@ -66,9 +66,9 @@ import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel; import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
import sun.tools.jconsole.Resources;
import sun.tools.jconsole.MBeansTab; import sun.tools.jconsole.MBeansTab;
import sun.tools.jconsole.JConsole; import sun.tools.jconsole.JConsole;
import sun.tools.jconsole.Messages;
import sun.tools.jconsole.ProxyClient.SnapshotMBeanServerConnection; import sun.tools.jconsole.ProxyClient.SnapshotMBeanServerConnection;
/*IMPORTANT : /*IMPORTANT :
...@@ -84,8 +84,8 @@ public class XMBeanAttributes extends XTable { ...@@ -84,8 +84,8 @@ public class XMBeanAttributes extends XTable {
Logger.getLogger(XMBeanAttributes.class.getPackage().getName()); Logger.getLogger(XMBeanAttributes.class.getPackage().getName());
private final static String[] columnNames = private final static String[] columnNames =
{Resources.getText("Name"), {Messages.NAME,
Resources.getText("Value")}; Messages.VALUE};
private XMBean mbean; private XMBean mbean;
private MBeanInfo mbeanInfo; private MBeanInfo mbeanInfo;
...@@ -267,7 +267,7 @@ public class XMBeanAttributes extends XTable { ...@@ -267,7 +267,7 @@ public class XMBeanAttributes extends XTable {
public boolean isColumnEditable(int column) { public boolean isColumnEditable(int column) {
if (column < getColumnCount()) { if (column < getColumnCount()) {
return getColumnName(column).equals(Resources.getText("Value")); return getColumnName(column).equals(Messages.VALUE);
} }
else { else {
return false; return false;
...@@ -313,7 +313,7 @@ public class XMBeanAttributes extends XTable { ...@@ -313,7 +313,7 @@ public class XMBeanAttributes extends XTable {
if (value != null) { if (value != null) {
tip = value.toString(); tip = value.toString();
if(isAttributeViewable(row, VALUE_COLUMN)) if(isAttributeViewable(row, VALUE_COLUMN))
tip = Resources.getText("Double click to expand/collapse")+ tip = Messages.DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE+
". " + tip; ". " + tip;
} }
...@@ -589,7 +589,7 @@ public class XMBeanAttributes extends XTable { ...@@ -589,7 +589,7 @@ public class XMBeanAttributes extends XTable {
comp, comp,
rowMinHeight); rowMinHeight);
mbeansTab.getDataViewer().registerForMouseEvent( XDataViewer.registerForMouseEvent(
comp, mouseListener); comp, mouseListener);
} else } else
return cell; return cell;
...@@ -724,7 +724,7 @@ public class XMBeanAttributes extends XTable { ...@@ -724,7 +724,7 @@ public class XMBeanAttributes extends XTable {
mbeansTab.getDataViewer().createAttributeViewer( mbeansTab.getDataViewer().createAttributeViewer(
value, mbean, attribute, XMBeanAttributes.this); value, mbean, attribute, XMBeanAttributes.this);
cell.init(cell.getMinRenderer(), comp, cell.getMinHeight()); cell.init(cell.getMinRenderer(), comp, cell.getMinHeight());
mbeansTab.getDataViewer().registerForMouseEvent(comp, mouseListener); XDataViewer.registerForMouseEvent(comp, mouseListener);
} }
} else { } else {
cell = new ZoomedCell(value); cell = new ZoomedCell(value);
...@@ -735,7 +735,7 @@ public class XMBeanAttributes extends XTable { ...@@ -735,7 +735,7 @@ public class XMBeanAttributes extends XTable {
} }
} }
//will be called in a synchronzed block //will be called in a synchronized block
protected void addTableData(DefaultTableModel tableModel, protected void addTableData(DefaultTableModel tableModel,
XMBean mbean, XMBean mbean,
MBeanAttributeInfo[] attributesInfo, MBeanAttributeInfo[] attributesInfo,
...@@ -749,7 +749,7 @@ public class XMBeanAttributes extends XTable { ...@@ -749,7 +749,7 @@ public class XMBeanAttributes extends XTable {
for (int i = 0; i < attributesInfo.length; i++) { for (int i = 0; i < attributesInfo.length; i++) {
rowData[0] = (attributesInfo[i].getName()); rowData[0] = (attributesInfo[i].getName());
if (unavailableAttributes.containsKey(rowData[0])) { if (unavailableAttributes.containsKey(rowData[0])) {
rowData[1] = Resources.getText("Unavailable"); rowData[1] = Messages.UNAVAILABLE;
} else if (viewableAttributes.containsKey(rowData[0])) { } else if (viewableAttributes.containsKey(rowData[0])) {
rowData[1] = viewableAttributes.get(rowData[0]); rowData[1] = viewableAttributes.get(rowData[0]);
if (!attributesInfo[i].isWritable() || if (!attributesInfo[i].isWritable() ||
...@@ -811,7 +811,6 @@ public class XMBeanAttributes extends XTable { ...@@ -811,7 +811,6 @@ public class XMBeanAttributes extends XTable {
} }
} }
@SuppressWarnings("serial")
class ValueCellEditor extends XTextFieldEditor { class ValueCellEditor extends XTextFieldEditor {
// implements javax.swing.table.TableCellEditor // implements javax.swing.table.TableCellEditor
@Override @Override
...@@ -866,7 +865,6 @@ public class XMBeanAttributes extends XTable { ...@@ -866,7 +865,6 @@ public class XMBeanAttributes extends XTable {
} }
} }
@SuppressWarnings("serial")
class MaximizedCellRenderer extends DefaultTableCellRenderer { class MaximizedCellRenderer extends DefaultTableCellRenderer {
Component comp; Component comp;
MaximizedCellRenderer(Component comp) { MaximizedCellRenderer(Component comp) {
...@@ -1018,7 +1016,7 @@ public class XMBeanAttributes extends XTable { ...@@ -1018,7 +1016,7 @@ public class XMBeanAttributes extends XTable {
(String)tableValue);// value (String)tableValue);// value
} catch (Throwable ex) { } catch (Throwable ex) {
popupAndLog(ex,"tableChanged", popupAndLog(ex,"tableChanged",
"Problem setting attribute"); Messages.PROBLEM_SETTING_ATTRIBUTE);
} }
} }
final String attributeName = getValueName(e.getFirstRow()); final String attributeName = getValueName(e.getFirstRow());
...@@ -1042,7 +1040,7 @@ public class XMBeanAttributes extends XTable { ...@@ -1042,7 +1040,7 @@ public class XMBeanAttributes extends XTable {
} }
mbean.setAttribute(attribute); mbean.setAttribute(attribute);
} catch (Throwable ex) { } catch (Throwable ex) {
popupAndLog(ex,method,"Problem setting attribute"); popupAndLog(ex,method,Messages.PROBLEM_SETTING_ATTRIBUTE);
} }
return null; return null;
} }
...@@ -1062,7 +1060,7 @@ public class XMBeanAttributes extends XTable { ...@@ -1062,7 +1060,7 @@ public class XMBeanAttributes extends XTable {
} }
// Call this outside EDT // Call this outside EDT
private void popupAndLog(Throwable ex, String method, String key) { private void popupAndLog(Throwable ex, String method, String title) {
ex = Utils.getActualException(ex); ex = Utils.getActualException(ex);
if (JConsole.isDebug()) ex.printStackTrace(); if (JConsole.isDebug()) ex.printStackTrace();
...@@ -1070,7 +1068,7 @@ public class XMBeanAttributes extends XTable { ...@@ -1070,7 +1068,7 @@ public class XMBeanAttributes extends XTable {
: ex.toString(); : ex.toString();
EventQueue.invokeLater( EventQueue.invokeLater(
new ThreadDialog(component, message+"\n", new ThreadDialog(component, message+"\n",
Resources.getText(key), title,
JOptionPane.ERROR_MESSAGE)); JOptionPane.ERROR_MESSAGE));
} }
} }
......
...@@ -35,7 +35,8 @@ import javax.swing.*; ...@@ -35,7 +35,8 @@ import javax.swing.*;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import javax.swing.event.*; import javax.swing.event.*;
import javax.swing.table.*; import javax.swing.table.*;
import sun.tools.jconsole.Resources;
import sun.tools.jconsole.Messages;
import static sun.tools.jconsole.Utilities.*; import static sun.tools.jconsole.Utilities.*;
...@@ -43,11 +44,11 @@ import static sun.tools.jconsole.Utilities.*; ...@@ -43,11 +44,11 @@ import static sun.tools.jconsole.Utilities.*;
public class XMBeanInfo extends JPanel { public class XMBeanInfo extends JPanel {
private static final Color lightYellow = new Color(255, 255, 128); private static final Color lightYellow = new Color(255, 255, 128);
private final int NAME_COLUMN = 0; private final int NAME_COLUMN = 0;
private final int VALUE_COLUMN = 1; private final int VALUE_COLUMN = 1;
private final String[] columnNames = { private final String[] columnNames = {
Resources.getText("Name"), Messages.NAME,
Resources.getText("Value") Messages.VALUE
}; };
private JTable infoTable = new JTable(); private JTable infoTable = new JTable();
private JTable descTable = new JTable(); private JTable descTable = new JTable();
...@@ -163,7 +164,7 @@ public class XMBeanInfo extends JPanel { ...@@ -163,7 +164,7 @@ public class XMBeanInfo extends JPanel {
descTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); descTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
JScrollPane descTableScrollPane = new JScrollPane(descTable); JScrollPane descTableScrollPane = new JScrollPane(descTable);
descBorderPanel.setBorder( descBorderPanel.setBorder(
BorderFactory.createTitledBorder(Resources.getText("Descriptor"))); BorderFactory.createTitledBorder(Messages.DESCRIPTOR));
descBorderPanel.add(descTableScrollPane); descBorderPanel.add(descTableScrollPane);
// Add the two tables to the grid // Add the two tables to the grid
// //
...@@ -230,20 +231,20 @@ public class XMBeanInfo extends JPanel { ...@@ -230,20 +231,20 @@ public class XMBeanInfo extends JPanel {
emptyInfoTable(); emptyInfoTable();
emptyDescTable(); emptyDescTable();
((TitledBorder) infoBorderPanel.getBorder()).setTitle( ((TitledBorder) infoBorderPanel.getBorder()).setTitle(
Resources.getText("MBeanInfo")); Messages.MBEAN_INFO);
String text = Resources.getText("Info") + ":"; String text = Messages.INFO + ":";
DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel(); DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel();
Object rowData[] = new Object[2]; Object rowData[] = new Object[2];
rowData[0] = new TableRowDivider(text); rowData[0] = new TableRowDivider(text);
rowData[1] = new TableRowDivider(""); rowData[1] = new TableRowDivider("");
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("ObjectName"); rowData[0] = Messages.OBJECT_NAME;
rowData[1] = mbean.getObjectName(); rowData[1] = mbean.getObjectName();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("ClassName"); rowData[0] = Messages.CLASS_NAME;
rowData[1] = mbeanInfo.getClassName(); rowData[1] = mbeanInfo.getClassName();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Description"); rowData[0] = Messages.DESCRIPTION;
rowData[1] = mbeanInfo.getDescription(); rowData[1] = mbeanInfo.getDescription();
tableModel.addRow(rowData); tableModel.addRow(rowData);
addDescriptor(mbeanInfo.getDescriptor(), text); addDescriptor(mbeanInfo.getDescriptor(), text);
...@@ -252,13 +253,13 @@ public class XMBeanInfo extends JPanel { ...@@ -252,13 +253,13 @@ public class XMBeanInfo extends JPanel {
int i = 0; int i = 0;
for (MBeanConstructorInfo mbci : mbeanInfo.getConstructors()) { for (MBeanConstructorInfo mbci : mbeanInfo.getConstructors()) {
addMBeanConstructorInfo(mbci, addMBeanConstructorInfo(mbci,
Resources.getText("Constructor") + "-" + i + ":"); Messages.CONSTRUCTOR + "-" + i + ":");
// MBeanParameterInfo // MBeanParameterInfo
// //
int j = 0; int j = 0;
for (MBeanParameterInfo mbpi : mbci.getSignature()) { for (MBeanParameterInfo mbpi : mbci.getSignature()) {
addMBeanParameterInfo(mbpi, addMBeanParameterInfo(mbpi,
Resources.getText("Parameter") + "-" + i + "-" + j + ":"); Messages.PARAMETER + "-" + i + "-" + j + ":");
j++; j++;
} }
i++; i++;
...@@ -271,29 +272,29 @@ public class XMBeanInfo extends JPanel { ...@@ -271,29 +272,29 @@ public class XMBeanInfo extends JPanel {
emptyInfoTable(); emptyInfoTable();
emptyDescTable(); emptyDescTable();
((TitledBorder) infoBorderPanel.getBorder()).setTitle( ((TitledBorder) infoBorderPanel.getBorder()).setTitle(
Resources.getText("MBeanAttributeInfo")); Messages.MBEAN_ATTRIBUTE_INFO);
String text = Resources.getText("Attribute") + ":"; String text = Messages.ATTRIBUTE + ":";
DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel(); DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel();
Object rowData[] = new Object[2]; Object rowData[] = new Object[2];
rowData[0] = new TableRowDivider(text); rowData[0] = new TableRowDivider(text);
rowData[1] = new TableRowDivider(""); rowData[1] = new TableRowDivider("");
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Name"); rowData[0] = Messages.NAME;
rowData[1] = mbai.getName(); rowData[1] = mbai.getName();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Description"); rowData[0] = Messages.DESCRIPTION;
rowData[1] = mbai.getDescription(); rowData[1] = mbai.getDescription();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Readable"); rowData[0] = Messages.READABLE;
rowData[1] = mbai.isReadable(); rowData[1] = mbai.isReadable();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Writable"); rowData[0] = Messages.WRITABLE;
rowData[1] = mbai.isWritable(); rowData[1] = mbai.isWritable();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Is"); rowData[0] = Messages.IS;
rowData[1] = mbai.isIs(); rowData[1] = mbai.isIs();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Type"); rowData[0] = Messages.TYPE;
rowData[1] = mbai.getType(); rowData[1] = mbai.getType();
tableModel.addRow(rowData); tableModel.addRow(rowData);
addDescriptor(mbai.getDescriptor(), text); addDescriptor(mbai.getDescriptor(), text);
...@@ -305,36 +306,36 @@ public class XMBeanInfo extends JPanel { ...@@ -305,36 +306,36 @@ public class XMBeanInfo extends JPanel {
emptyInfoTable(); emptyInfoTable();
emptyDescTable(); emptyDescTable();
((TitledBorder) infoBorderPanel.getBorder()).setTitle( ((TitledBorder) infoBorderPanel.getBorder()).setTitle(
Resources.getText("MBeanOperationInfo")); Messages.MBEAN_OPERATION_INFO);
String text = Resources.getText("Operation") + ":"; String text = Messages.OPERATION + ":";
DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel(); DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel();
Object rowData[] = new Object[2]; Object rowData[] = new Object[2];
rowData[0] = new TableRowDivider(text); rowData[0] = new TableRowDivider(text);
rowData[1] = new TableRowDivider(""); rowData[1] = new TableRowDivider("");
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Name"); rowData[0] = Messages.NAME;
rowData[1] = mboi.getName(); rowData[1] = mboi.getName();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Description"); rowData[0] = Messages.DESCRIPTION;
rowData[1] = mboi.getDescription(); rowData[1] = mboi.getDescription();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Impact"); rowData[0] = Messages.IMPACT;
switch (mboi.getImpact()) { switch (mboi.getImpact()) {
case MBeanOperationInfo.INFO: case MBeanOperationInfo.INFO:
rowData[1] = Resources.getText("INFO"); rowData[1] = Messages.INFO_CAPITALIZED;
break; break;
case MBeanOperationInfo.ACTION: case MBeanOperationInfo.ACTION:
rowData[1] = Resources.getText("ACTION"); rowData[1] = Messages.ACTION_CAPITALIZED;
break; break;
case MBeanOperationInfo.ACTION_INFO: case MBeanOperationInfo.ACTION_INFO:
rowData[1] = Resources.getText("ACTION_INFO"); rowData[1] = Messages.ACTION_INFO_CAPITALIZED;
break; break;
case MBeanOperationInfo.UNKNOWN: case MBeanOperationInfo.UNKNOWN:
rowData[1] = Resources.getText("UNKNOWN"); rowData[1] = Messages.UNKNOWN_CAPITALIZED;
break; break;
} }
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("ReturnType"); rowData[0] = Messages.RETURN_TYPE;
rowData[1] = mboi.getReturnType(); rowData[1] = mboi.getReturnType();
tableModel.addRow(rowData); tableModel.addRow(rowData);
addDescriptor(mboi.getDescriptor(), text); addDescriptor(mboi.getDescriptor(), text);
...@@ -343,7 +344,7 @@ public class XMBeanInfo extends JPanel { ...@@ -343,7 +344,7 @@ public class XMBeanInfo extends JPanel {
int i = 0; int i = 0;
for (MBeanParameterInfo mbpi : mboi.getSignature()) { for (MBeanParameterInfo mbpi : mboi.getSignature()) {
addMBeanParameterInfo(mbpi, addMBeanParameterInfo(mbpi,
Resources.getText("Parameter") + "-" + i++ + ":"); Messages.PARAMETER + "-" + i++ + ":");
} }
tableModel.newDataAvailable(new TableModelEvent(tableModel)); tableModel.newDataAvailable(new TableModelEvent(tableModel));
} }
...@@ -353,20 +354,20 @@ public class XMBeanInfo extends JPanel { ...@@ -353,20 +354,20 @@ public class XMBeanInfo extends JPanel {
emptyInfoTable(); emptyInfoTable();
emptyDescTable(); emptyDescTable();
((TitledBorder) infoBorderPanel.getBorder()).setTitle( ((TitledBorder) infoBorderPanel.getBorder()).setTitle(
Resources.getText("MBeanNotificationInfo")); Messages.MBEAN_NOTIFICATION_INFO);
String text = Resources.getText("Notification") + ":"; String text = Messages.NOTIFICATION + ":";
DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel(); DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel();
Object rowData[] = new Object[2]; Object rowData[] = new Object[2];
rowData[0] = new TableRowDivider(text); rowData[0] = new TableRowDivider(text);
rowData[1] = new TableRowDivider(""); rowData[1] = new TableRowDivider("");
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Name"); rowData[0] = Messages.NAME;
rowData[1] = mbni.getName(); rowData[1] = mbni.getName();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Description"); rowData[0] = Messages.DESCRIPTION;
rowData[1] = mbni.getDescription(); rowData[1] = mbni.getDescription();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("NotifTypes"); rowData[0] = Messages.NOTIF_TYPES;
rowData[1] = Arrays.toString(mbni.getNotifTypes()); rowData[1] = Arrays.toString(mbni.getNotifTypes());
tableModel.addRow(rowData); tableModel.addRow(rowData);
addDescriptor(mbni.getDescriptor(), text); addDescriptor(mbni.getDescriptor(), text);
...@@ -380,10 +381,10 @@ public class XMBeanInfo extends JPanel { ...@@ -380,10 +381,10 @@ public class XMBeanInfo extends JPanel {
rowData[0] = new TableRowDivider(text); rowData[0] = new TableRowDivider(text);
rowData[1] = new TableRowDivider(""); rowData[1] = new TableRowDivider("");
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Name"); rowData[0] = Messages.NAME;
rowData[1] = mbci.getName(); rowData[1] = mbci.getName();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Description"); rowData[0] = Messages.DESCRIPTION;
rowData[1] = mbci.getDescription(); rowData[1] = mbci.getDescription();
tableModel.addRow(rowData); tableModel.addRow(rowData);
addDescriptor(mbci.getDescriptor(), text); addDescriptor(mbci.getDescriptor(), text);
...@@ -397,13 +398,13 @@ public class XMBeanInfo extends JPanel { ...@@ -397,13 +398,13 @@ public class XMBeanInfo extends JPanel {
rowData[0] = new TableRowDivider(text); rowData[0] = new TableRowDivider(text);
rowData[1] = new TableRowDivider(""); rowData[1] = new TableRowDivider("");
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Name"); rowData[0] = Messages.NAME;
rowData[1] = mbpi.getName(); rowData[1] = mbpi.getName();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Description"); rowData[0] = Messages.DESCRIPTION;
rowData[1] = mbpi.getDescription(); rowData[1] = mbpi.getDescription();
tableModel.addRow(rowData); tableModel.addRow(rowData);
rowData[0] = Resources.getText("Type"); rowData[0] = Messages.TYPE;
rowData[1] = mbpi.getType(); rowData[1] = mbpi.getType();
tableModel.addRow(rowData); tableModel.addRow(rowData);
addDescriptor(mbpi.getDescriptor(), text); addDescriptor(mbpi.getDescriptor(), text);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package sun.tools.jconsole.inspector; package sun.tools.jconsole.inspector;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*; import javax.swing.table.*;
import javax.swing.tree.*; import javax.swing.tree.*;
import java.awt.Font; import java.awt.Font;
...@@ -46,19 +45,19 @@ import javax.management.openmbean.CompositeData; ...@@ -46,19 +45,19 @@ import javax.management.openmbean.CompositeData;
import javax.management.openmbean.TabularData; import javax.management.openmbean.TabularData;
import sun.tools.jconsole.JConsole; import sun.tools.jconsole.JConsole;
import sun.tools.jconsole.Resources; import sun.tools.jconsole.Messages;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class XMBeanNotifications extends JTable implements NotificationListener { public class XMBeanNotifications extends JTable implements NotificationListener {
private final static String[] columnNames = { private final static String[] columnNames = {
Resources.getText("TimeStamp"), Messages.TIME_STAMP,
Resources.getText("Type"), Messages.TYPE,
Resources.getText("UserData"), Messages.USER_DATA,
Resources.getText("SeqNum"), Messages.SEQ_NUM,
Resources.getText("Message"), Messages.MESSAGE,
Resources.getText("Event"), Messages.EVENT,
Resources.getText("Source") Messages.SOURCE
}; };
private HashMap<ObjectName, XMBeanNotificationsListener> listeners = private HashMap<ObjectName, XMBeanNotificationsListener> listeners =
new HashMap<ObjectName, XMBeanNotificationsListener>(); new HashMap<ObjectName, XMBeanNotificationsListener>();
...@@ -183,7 +182,7 @@ public class XMBeanNotifications extends JTable implements NotificationListener ...@@ -183,7 +182,7 @@ public class XMBeanNotifications extends JTable implements NotificationListener
} }
if (cell != null) { if (cell != null) {
toolTip = Resources.getText("Double click to expand/collapse") + toolTip = Messages.DOUBLE_CLICK_TO_EXPAND_FORWARD_SLASH_COLLAPSE+
". " + cell.toString(); ". " + cell.toString();
} else { } else {
Object val = Object val =
...@@ -599,7 +598,6 @@ public class XMBeanNotifications extends JTable implements NotificationListener ...@@ -599,7 +598,6 @@ public class XMBeanNotifications extends JTable implements NotificationListener
class XMBeanNotificationsListener implements NotificationListener { class XMBeanNotificationsListener implements NotificationListener {
private String[] columnNames;
private XMBean xmbean; private XMBean xmbean;
private DefaultMutableTreeNode node; private DefaultMutableTreeNode node;
private volatile long received; private volatile long received;
...@@ -615,7 +613,6 @@ public class XMBeanNotifications extends JTable implements NotificationListener ...@@ -615,7 +613,6 @@ public class XMBeanNotifications extends JTable implements NotificationListener
this.notifications = notifications; this.notifications = notifications;
this.xmbean = xmbean; this.xmbean = xmbean;
this.node = node; this.node = node;
this.columnNames = columnNames;
register(node); register(node);
} }
......
...@@ -28,17 +28,6 @@ package sun.tools.jconsole.inspector; ...@@ -28,17 +28,6 @@ package sun.tools.jconsole.inspector;
// java import // java import
import javax.swing.*; import javax.swing.*;
//
// java import
import java.io.*;
import java.awt.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import java.net.*;
//
/** /**
* This provides a wrapper to the Object class to allow it to be * This provides a wrapper to the Object class to allow it to be
displayed/manipulated as a GUI object. displayed/manipulated as a GUI object.
......
...@@ -28,33 +28,21 @@ package sun.tools.jconsole.inspector; ...@@ -28,33 +28,21 @@ package sun.tools.jconsole.inspector;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*; import javax.swing.event.*;
import javax.swing.table.*; import javax.swing.table.*;
import javax.swing.tree.*;
import javax.swing.border.*;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.EventQueue;
import java.awt.Color; import java.awt.Color;
import java.awt.Font; import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.*; import java.awt.event.*;
import java.awt.Insets;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.*; import java.util.*;
import java.io.*;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import javax.management.*;
import javax.management.openmbean.*; import javax.management.openmbean.*;
import sun.tools.jconsole.BorderedComponent;
import sun.tools.jconsole.JConsole; import sun.tools.jconsole.JConsole;
import sun.tools.jconsole.LabeledComponent; import sun.tools.jconsole.Messages;
import sun.tools.jconsole.Resources; import sun.tools.jconsole.Resources;
import sun.tools.jconsole.VariableGridLayout;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class XOpenTypeViewer extends JPanel implements ActionListener { public class XOpenTypeViewer extends JPanel implements ActionListener {
...@@ -65,9 +53,9 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -65,9 +53,9 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
XOpenTypeDataListener listener = new XOpenTypeDataListener(); XOpenTypeDataListener listener = new XOpenTypeDataListener();
private static final String compositeNavigationSingle = private static final String compositeNavigationSingle =
Resources.getText("MBeansTab.compositeNavigationSingle"); Messages.MBEANS_TAB_COMPOSITE_NAVIGATION_SINGLE;
private static final String tabularNavigationSingle = private static final String tabularNavigationSingle =
Resources.getText("MBeansTab.tabularNavigationSingle"); Messages.MBEANS_TAB_TABULAR_NAVIGATION_SINGLE;
private static TableCellEditor editor = private static TableCellEditor editor =
new Utils.ReadOnlyTableCellEditor(new JTextField()); new Utils.ReadOnlyTableCellEditor(new JTextField());
...@@ -121,7 +109,6 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -121,7 +109,6 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
static abstract class XOpenTypeData extends JTable { static abstract class XOpenTypeData extends JTable {
XOpenTypeData parent; XOpenTypeData parent;
private Color defaultColor;
protected int col1Width = -1; protected int col1Width = -1;
protected int col2Width = -1; protected int col2Width = -1;
private boolean init; private boolean init;
...@@ -139,7 +126,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -139,7 +126,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
Object value = getModel().getValueAt(row, col); Object value = getModel().getValueAt(row, col);
if (value != null) { if (value != null) {
if(isClickableElement(value)) if(isClickableElement(value))
return Resources.getText("Double click to visualize") return Messages.DOUBLE_CLICK_TO_VISUALIZE
+ ". " + value.toString(); + ". " + value.toString();
else else
return value.toString(); return value.toString();
...@@ -265,7 +252,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -265,7 +252,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
Object c1 = o1.get(key); Object c1 = o1.get(key);
Object c2 = o2.get(key); Object c2 = o2.get(key);
if (c1 instanceof Comparable && c2 instanceof Comparable) { if (c1 instanceof Comparable && c2 instanceof Comparable) {
int result = ((Comparable) c1).compareTo(c2); int result = ((Comparable<Object>) c1).compareTo(c2);
if (result != 0) if (result != 0)
return result; return result;
} }
...@@ -358,7 +345,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -358,7 +345,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
static class XCompositeData extends XOpenTypeData { static class XCompositeData extends XOpenTypeData {
protected final String[] columnNames = { protected final String[] columnNames = {
Resources.getText("Name"), Resources.getText("Value") Messages.NAME, Messages.VALUE
}; };
CompositeData composite; CompositeData composite;
...@@ -398,8 +385,8 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -398,8 +385,8 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
private void load(CompositeData data) { private void load(CompositeData data) {
CompositeType type = data.getCompositeType(); CompositeType type = data.getCompositeType();
Set keys = type.keySet(); Set<String> keys = type.keySet();
Iterator it = keys.iterator(); Iterator<String> it = keys.iterator();
Object[] rowData = new Object[2]; Object[] rowData = new Object[2];
while (it.hasNext()) { while (it.hasNext()) {
String key = (String) it.next(); String key = (String) it.next();
...@@ -408,13 +395,13 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -408,13 +395,13 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
if (val == null) { if (val == null) {
rowData[1] = ""; rowData[1] = "";
} else { } else {
OpenType openType = type.getType(key); OpenType<?> openType = type.getType(key);
if (openType instanceof CompositeType) { if (openType instanceof CompositeType) {
rowData[1] = rowData[1] =
new XCompositeData(this, (CompositeData) val); new XCompositeData(this, (CompositeData) val);
} else if (openType instanceof ArrayType) { } else if (openType instanceof ArrayType) {
rowData[1] = rowData[1] =
new XArrayData(this, (ArrayType) openType, val); new XArrayData(this, (ArrayType<?>) openType, val);
} else if (openType instanceof SimpleType) { } else if (openType instanceof SimpleType) {
rowData[1] = val; rowData[1] = val;
} else if (openType instanceof TabularType) { } else if (openType instanceof TabularType) {
...@@ -453,21 +440,21 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -453,21 +440,21 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
private int dimension; private int dimension;
private int size; private int size;
private OpenType elemType; private OpenType<?> elemType;
private Object val; private Object val;
private boolean isCompositeType; private boolean isCompositeType;
private boolean isTabularType; private boolean isTabularType;
private int currentIndex; private int currentIndex;
private CompositeData[] elements; private CompositeData[] elements;
private final String[] arrayColumns = {Resources.getText("Value")}; private final String[] arrayColumns = {Messages.VALUE};
private Font normalFont, boldFont; private Font normalFont, boldFont;
XArrayData(XOpenTypeData parent, ArrayType type, Object val) { XArrayData(XOpenTypeData parent, ArrayType<?> type, Object val) {
this(parent, type.getDimension(), type.getElementOpenType(), val); this(parent, type.getDimension(), type.getElementOpenType(), val);
} }
XArrayData(XOpenTypeData parent, int dimension, XArrayData(XOpenTypeData parent, int dimension,
OpenType elemType, Object val) { OpenType<?> elemType, Object val) {
super(parent); super(parent);
this.dimension = dimension; this.dimension = dimension;
this.elemType = elemType; this.elemType = elemType;
...@@ -486,10 +473,9 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -486,10 +473,9 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
public void viewed(XOpenTypeViewer viewer) throws Exception { public void viewed(XOpenTypeViewer viewer) throws Exception {
if (size == 0) if (size == 0)
throw new Exception(Resources.getText("Empty array")); throw new Exception(Messages.EMPTY_ARRAY);
if (dimension > 1) if (dimension > 1)
throw new Exception(Resources.getText("Dimension is not " + throw new Exception(Messages.DIMENSION_IS_NOT_SUPPORTED_COLON +
"supported:") +
dimension); dimension);
super.viewed(viewer); super.viewed(viewer);
} }
...@@ -565,7 +551,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -565,7 +551,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
public String toString() { public String toString() {
if (dimension > 1) { if (dimension > 1) {
return Resources.getText("Dimension is not supported:") + return Messages.DIMENSION_IS_NOT_SUPPORTED_COLON +
dimension; dimension;
} else { } else {
return elemType.getTypeName() + "[" + size + "]"; return elemType.getTypeName() + "[" + size + "]";
...@@ -694,7 +680,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -694,7 +680,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
tabular.canIncrement() || tabular.canDecrement(); tabular.canIncrement() || tabular.canDecrement();
if (hasMoreThanOneElement) { if (hasMoreThanOneElement) {
tabularLabel.setText( tabularLabel.setText(
Resources.getText("MBeansTab.tabularNavigationMultiple", Resources.format(Messages.MBEANS_TAB_TABULAR_NAVIGATION_MULTIPLE,
String.format("%d", tabular.getSelectedElementIndex() + 1), String.format("%d", tabular.getSelectedElementIndex() + 1),
String.format("%d", tabular.getElementCount()))); String.format("%d", tabular.getElementCount())));
} else { } else {
...@@ -717,7 +703,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -717,7 +703,7 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
array.canIncrement() || array.canDecrement(); array.canIncrement() || array.canDecrement();
if (hasMoreThanOneElement) { if (hasMoreThanOneElement) {
compositeLabel.setText( compositeLabel.setText(
Resources.getText("MBeansTab.compositeNavigationMultiple", Resources.format(Messages.MBEANS_TAB_COMPOSITE_NAVIGATION_MULTIPLE,
String.format("%d", array.getSelectedElementIndex() + 1), String.format("%d", array.getSelectedElementIndex() + 1),
String.format("%d", array.getElementCount()))); String.format("%d", array.getElementCount())));
} else { } else {
...@@ -781,8 +767,8 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -781,8 +767,8 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel buttons = new JPanel(new FlowLayout(FlowLayout.LEFT));
tabularPrev = new JButton(Resources.getText("<")); tabularPrev = new JButton(Messages.LESS_THAN);
tabularNext = new JButton(Resources.getText(">")); tabularNext = new JButton(Messages.GREATER_THAN);
JPanel tabularButtons = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel tabularButtons = new JPanel(new FlowLayout(FlowLayout.LEFT));
tabularButtons.add(tabularPrev); tabularButtons.add(tabularPrev);
tabularPrev.addActionListener(this); tabularPrev.addActionListener(this);
...@@ -793,13 +779,13 @@ public class XOpenTypeViewer extends JPanel implements ActionListener { ...@@ -793,13 +779,13 @@ public class XOpenTypeViewer extends JPanel implements ActionListener {
tabularNext.addActionListener(this); tabularNext.addActionListener(this);
tabularButtons.setBackground(Color.white); tabularButtons.setBackground(Color.white);
prev = new JButton(Resources.getText("<<")); prev = new JButton(Messages.A_LOT_LESS_THAN);
prev.addActionListener(this); prev.addActionListener(this);
buttons.add(prev); buttons.add(prev);
incr = new JButton(Resources.getText(">")); incr = new JButton(Messages.GREATER_THAN);
incr.addActionListener(this); incr.addActionListener(this);
decr = new JButton(Resources.getText("<")); decr = new JButton(Messages.LESS_THAN);
decr.addActionListener(this); decr.addActionListener(this);
JPanel array = new JPanel(); JPanel array = new JPanel();
......
...@@ -26,22 +26,18 @@ ...@@ -26,22 +26,18 @@
package sun.tools.jconsole.inspector; package sun.tools.jconsole.inspector;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import javax.swing.tree.*;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.*; import java.awt.event.*;
import java.util.*; import java.util.*;
import java.io.*;
import javax.management.*; import javax.management.*;
import sun.tools.jconsole.Resources;
import sun.tools.jconsole.MBeansTab; import sun.tools.jconsole.MBeansTab;
import sun.tools.jconsole.JConsole; import sun.tools.jconsole.JConsole;
import sun.tools.jconsole.Messages;
public abstract class XOperations extends JPanel implements ActionListener { public abstract class XOperations extends JPanel implements ActionListener {
...@@ -185,8 +181,8 @@ public abstract class XOperations extends JPanel implements ActionListener { ...@@ -185,8 +181,8 @@ public abstract class XOperations extends JPanel implements ActionListener {
} else { } else {
new ThreadDialog( new ThreadDialog(
button, button,
Resources.getText("Method successfully invoked"), Messages.METHOD_SUCCESSFULLY_INVOKED,
Resources.getText("Info"), Messages.INFO,
JOptionPane.INFORMATION_MESSAGE).run(); JOptionPane.INFORMATION_MESSAGE).run();
} }
} catch (Throwable t) { } catch (Throwable t) {
...@@ -196,9 +192,9 @@ public abstract class XOperations extends JPanel implements ActionListener { ...@@ -196,9 +192,9 @@ public abstract class XOperations extends JPanel implements ActionListener {
} }
new ThreadDialog( new ThreadDialog(
button, button,
Resources.getText("Problem invoking") + " " + Messages.PROBLEM_INVOKING + " " +
button.getText() + " : " + t.toString(), button.getText() + " : " + t.toString(),
Resources.getText("Error"), Messages.ERROR,
JOptionPane.ERROR_MESSAGE).run(); JOptionPane.ERROR_MESSAGE).run();
} }
} }
......
...@@ -27,7 +27,6 @@ package sun.tools.jconsole.inspector; ...@@ -27,7 +27,6 @@ package sun.tools.jconsole.inspector;
import sun.tools.jconsole.Plotter; import sun.tools.jconsole.Plotter;
import javax.swing.JTable; import javax.swing.JTable;
import java.awt.Graphics;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class XPlotter extends Plotter { public class XPlotter extends Plotter {
......
...@@ -45,10 +45,7 @@ public class XPlottingViewer extends PlotterPanel implements ActionListener { ...@@ -45,10 +45,7 @@ public class XPlottingViewer extends PlotterPanel implements ActionListener {
new HashMap<String, XPlottingViewer>(); new HashMap<String, XPlottingViewer>();
private static HashMap<String, Timer> timerCache = private static HashMap<String, Timer> timerCache =
new HashMap<String, Timer>(); new HashMap<String, Timer>();
private JPanel bordered;
private Number value;
private MBeansTab tab; private MBeansTab tab;
private XMBean mbean;
private String attributeName; private String attributeName;
private String key; private String key;
private JTable table; private JTable table;
...@@ -62,7 +59,6 @@ public class XPlottingViewer extends PlotterPanel implements ActionListener { ...@@ -62,7 +59,6 @@ public class XPlottingViewer extends PlotterPanel implements ActionListener {
this.tab = tab; this.tab = tab;
this.key = key; this.key = key;
this.mbean = mbean;
this.table = table; this.table = table;
this.attributeName = attributeName; this.attributeName = attributeName;
Plotter plotter = createPlotter(mbean, attributeName, key, table); Plotter plotter = createPlotter(mbean, attributeName, key, table);
...@@ -70,9 +66,9 @@ public class XPlottingViewer extends PlotterPanel implements ActionListener { ...@@ -70,9 +66,9 @@ public class XPlottingViewer extends PlotterPanel implements ActionListener {
} }
static void dispose(MBeansTab tab) { static void dispose(MBeansTab tab) {
Iterator it = plotterCache.keySet().iterator(); Iterator<String> it = plotterCache.keySet().iterator();
while(it.hasNext()) { while(it.hasNext()) {
String key = (String) it.next(); String key = it.next();
if(key.startsWith(String.valueOf(tab.hashCode()))) { if(key.startsWith(String.valueOf(tab.hashCode()))) {
it.remove(); it.remove();
} }
...@@ -187,7 +183,7 @@ public class XPlottingViewer extends PlotterPanel implements ActionListener { ...@@ -187,7 +183,7 @@ public class XPlottingViewer extends PlotterPanel implements ActionListener {
final GridBagLayout gbl = new GridBagLayout(); final GridBagLayout gbl = new GridBagLayout();
buttonPanel.setLayout(gbl); buttonPanel.setLayout(gbl);
setLayout(new BorderLayout()); setLayout(new BorderLayout());
plotButton = new JButton(Resources.getText("Discard chart")); plotButton = new JButton(Messages.DISCARD_CHART);
plotButton.addActionListener(this); plotButton.addActionListener(this);
plotButton.setEnabled(true); plotButton.setEnabled(true);
......
...@@ -57,8 +57,6 @@ import javax.swing.tree.DefaultTreeModel; ...@@ -57,8 +57,6 @@ import javax.swing.tree.DefaultTreeModel;
import sun.tools.jconsole.*; import sun.tools.jconsole.*;
import sun.tools.jconsole.inspector.XNodeInfo.Type; import sun.tools.jconsole.inspector.XNodeInfo.Type;
import static sun.tools.jconsole.Resources.*;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class XSheet extends JPanel public class XSheet extends JPanel
implements ActionListener, NotificationListener { implements ActionListener, NotificationListener {
...@@ -106,28 +104,24 @@ public class XSheet extends JPanel ...@@ -106,28 +104,24 @@ public class XSheet extends JPanel
southPanel = new JPanel(); southPanel = new JPanel();
add(southPanel, BorderLayout.SOUTH); add(southPanel, BorderLayout.SOUTH);
// create the refresh button // create the refresh button
String refreshButtonKey = "MBeansTab.refreshAttributesButton"; refreshButton = new JButton(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON);
refreshButton = new JButton(getText(refreshButtonKey)); refreshButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON));
refreshButton.setMnemonic(getMnemonicInt(refreshButtonKey)); refreshButton.setToolTipText(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP);
refreshButton.setToolTipText(getText(refreshButtonKey + ".toolTip"));
refreshButton.addActionListener(this); refreshButton.addActionListener(this);
// create the clear button // create the clear button
String clearButtonKey = "MBeansTab.clearNotificationsButton"; clearButton = new JButton(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON);
clearButton = new JButton(getText(clearButtonKey)); clearButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON));
clearButton.setMnemonic(getMnemonicInt(clearButtonKey)); clearButton.setToolTipText(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP);
clearButton.setToolTipText(getText(clearButtonKey + ".toolTip"));
clearButton.addActionListener(this); clearButton.addActionListener(this);
// create the subscribe button // create the subscribe button
String subscribeButtonKey = "MBeansTab.subscribeNotificationsButton"; subscribeButton = new JButton(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON);
subscribeButton = new JButton(getText(subscribeButtonKey)); subscribeButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON));
subscribeButton.setMnemonic(getMnemonicInt(subscribeButtonKey)); subscribeButton.setToolTipText(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP);
subscribeButton.setToolTipText(getText(subscribeButtonKey + ".toolTip"));
subscribeButton.addActionListener(this); subscribeButton.addActionListener(this);
// create the unsubscribe button // create the unsubscribe button
String unsubscribeButtonKey = "MBeansTab.unsubscribeNotificationsButton"; unsubscribeButton = new JButton(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON);
unsubscribeButton = new JButton(getText(unsubscribeButtonKey)); unsubscribeButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON));
unsubscribeButton.setMnemonic(getMnemonicInt(unsubscribeButtonKey)); unsubscribeButton.setToolTipText(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP);
unsubscribeButton.setToolTipText(getText(unsubscribeButtonKey + ".toolTip"));
unsubscribeButton.addActionListener(this); unsubscribeButton.addActionListener(this);
// create XMBeanAttributes container // create XMBeanAttributes container
mbeanAttributes = new XMBeanAttributes(mbeansTab); mbeanAttributes = new XMBeanAttributes(mbeansTab);
...@@ -238,7 +232,7 @@ public class XSheet extends JPanel ...@@ -238,7 +232,7 @@ public class XSheet extends JPanel
t.printStackTrace(); t.printStackTrace();
} }
showErrorDialog(t.toString(), showErrorDialog(t.toString(),
Resources.getText("Problem displaying MBean")); Messages.PROBLEM_DISPLAYING_MBEAN);
} }
} }
}; };
...@@ -279,7 +273,7 @@ public class XSheet extends JPanel ...@@ -279,7 +273,7 @@ public class XSheet extends JPanel
new JPanel(new BorderLayout()); new JPanel(new BorderLayout());
attributeBorderPanel.setBorder( attributeBorderPanel.setBorder(
BorderFactory.createTitledBorder( BorderFactory.createTitledBorder(
Resources.getText("Attribute value"))); Messages.ATTRIBUTE_VALUE));
JPanel attributeValuePanel = JPanel attributeValuePanel =
new JPanel(new BorderLayout()); new JPanel(new BorderLayout());
attributeValuePanel.setBorder( attributeValuePanel.setBorder(
...@@ -314,7 +308,7 @@ public class XSheet extends JPanel ...@@ -314,7 +308,7 @@ public class XSheet extends JPanel
t.printStackTrace(); t.printStackTrace();
} }
showErrorDialog(t.toString(), showErrorDialog(t.toString(),
Resources.getText("Problem displaying MBean")); Messages.PROBLEM_DISPLAYING_MBEAN);
} }
} }
}; };
...@@ -333,7 +327,7 @@ public class XSheet extends JPanel ...@@ -333,7 +327,7 @@ public class XSheet extends JPanel
JPanel operationPanel = new JPanel(new BorderLayout()); JPanel operationPanel = new JPanel(new BorderLayout());
JPanel operationBorderPanel = new JPanel(new BorderLayout()); JPanel operationBorderPanel = new JPanel(new BorderLayout());
operationBorderPanel.setBorder(BorderFactory.createTitledBorder( operationBorderPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getText("Operation invocation"))); Messages.OPERATION_INVOCATION));
operationBorderPanel.add(new JScrollPane(mbeanOperations)); operationBorderPanel.add(new JScrollPane(mbeanOperations));
operationPanel.add(operationBorderPanel, BorderLayout.NORTH); operationPanel.add(operationBorderPanel, BorderLayout.NORTH);
mbi.addMBeanOperationInfo(mboi); mbi.addMBeanOperationInfo(mboi);
...@@ -389,7 +383,7 @@ public class XSheet extends JPanel ...@@ -389,7 +383,7 @@ public class XSheet extends JPanel
mainPanel.removeAll(); mainPanel.removeAll();
JPanel borderPanel = new JPanel(new BorderLayout()); JPanel borderPanel = new JPanel(new BorderLayout());
borderPanel.setBorder(BorderFactory.createTitledBorder( borderPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getText("Attribute values"))); Messages.ATTRIBUTE_VALUES));
borderPanel.add(new JScrollPane(mbeanAttributes)); borderPanel.add(new JScrollPane(mbeanAttributes));
mainPanel.add(borderPanel, BorderLayout.CENTER); mainPanel.add(borderPanel, BorderLayout.CENTER);
// add the refresh button to the south panel // add the refresh button to the south panel
...@@ -409,7 +403,7 @@ public class XSheet extends JPanel ...@@ -409,7 +403,7 @@ public class XSheet extends JPanel
t.printStackTrace(); t.printStackTrace();
} }
showErrorDialog(t.toString(), showErrorDialog(t.toString(),
Resources.getText("Problem displaying MBean")); Messages.PROBLEM_DISPLAYING_MBEAN);
} }
} }
}; };
...@@ -442,7 +436,7 @@ public class XSheet extends JPanel ...@@ -442,7 +436,7 @@ public class XSheet extends JPanel
mainPanel.removeAll(); mainPanel.removeAll();
JPanel borderPanel = new JPanel(new BorderLayout()); JPanel borderPanel = new JPanel(new BorderLayout());
borderPanel.setBorder(BorderFactory.createTitledBorder( borderPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getText("Operation invocation"))); Messages.OPERATION_INVOCATION));
borderPanel.add(new JScrollPane(mbeanOperations)); borderPanel.add(new JScrollPane(mbeanOperations));
mainPanel.add(borderPanel, BorderLayout.CENTER); mainPanel.add(borderPanel, BorderLayout.CENTER);
southPanel.setVisible(false); southPanel.setVisible(false);
...@@ -459,7 +453,7 @@ public class XSheet extends JPanel ...@@ -459,7 +453,7 @@ public class XSheet extends JPanel
t.printStackTrace(); t.printStackTrace();
} }
showErrorDialog(t.toString(), showErrorDialog(t.toString(),
Resources.getText("Problem displaying MBean")); Messages.PROBLEM_DISPLAYING_MBEAN);
} }
} }
}; };
...@@ -479,7 +473,7 @@ public class XSheet extends JPanel ...@@ -479,7 +473,7 @@ public class XSheet extends JPanel
mainPanel.removeAll(); mainPanel.removeAll();
JPanel borderPanel = new JPanel(new BorderLayout()); JPanel borderPanel = new JPanel(new BorderLayout());
borderPanel.setBorder(BorderFactory.createTitledBorder( borderPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getText("Notification buffer"))); Messages.NOTIFICATION_BUFFER));
borderPanel.add(new JScrollPane(mbeanNotifications)); borderPanel.add(new JScrollPane(mbeanNotifications));
mainPanel.add(borderPanel, BorderLayout.CENTER); mainPanel.add(borderPanel, BorderLayout.CENTER);
// add the subscribe/unsubscribe/clear buttons to the south panel // add the subscribe/unsubscribe/clear buttons to the south panel
...@@ -528,7 +522,7 @@ public class XSheet extends JPanel ...@@ -528,7 +522,7 @@ public class XSheet extends JPanel
t.printStackTrace(); t.printStackTrace();
} }
showErrorDialog(t.getMessage(), showErrorDialog(t.getMessage(),
Resources.getText("Problem adding listener")); Messages.PROBLEM_ADDING_LISTENER);
} }
} }
}.execute(); }.execute();
...@@ -557,7 +551,7 @@ public class XSheet extends JPanel ...@@ -557,7 +551,7 @@ public class XSheet extends JPanel
t.printStackTrace(); t.printStackTrace();
} }
showErrorDialog(t.getMessage(), showErrorDialog(t.getMessage(),
Resources.getText("Problem removing listener")); Messages.PROBLEM_REMOVING_LISTENER);
} }
} }
}.execute(); }.execute();
...@@ -586,7 +580,7 @@ public class XSheet extends JPanel ...@@ -586,7 +580,7 @@ public class XSheet extends JPanel
// Call on EDT // Call on EDT
private void updateReceivedNotifications( private void updateReceivedNotifications(
DefaultMutableTreeNode emitter, long received, boolean bold) { DefaultMutableTreeNode emitter, long received, boolean bold) {
String text = Resources.getText("Notifications") + "[" + received + "]"; String text = Messages.NOTIFICATIONS + "[" + received + "]";
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) mbeansTab.getTree().getLastSelectedPathComponent(); DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) mbeansTab.getTree().getLastSelectedPathComponent();
if (bold && emitter != selectedNode) { if (bold && emitter != selectedNode) {
text = "<html><b>" + text + "</b></html>"; text = "<html><b>" + text + "</b></html>";
...@@ -600,7 +594,7 @@ public class XSheet extends JPanel ...@@ -600,7 +594,7 @@ public class XSheet extends JPanel
// Call on EDT // Call on EDT
private void clearNotifications() { private void clearNotifications() {
updateNotificationsNodeLabel(currentNode, updateNotificationsNodeLabel(currentNode,
Resources.getText("Notifications")); Messages.NOTIFICATIONS);
} }
/** /**
...@@ -609,7 +603,7 @@ public class XSheet extends JPanel ...@@ -609,7 +603,7 @@ public class XSheet extends JPanel
// Call on EDT // Call on EDT
private void clearNotifications0() { private void clearNotifications0() {
updateNotificationsNodeLabel(currentNode, updateNotificationsNodeLabel(currentNode,
Resources.getText("Notifications") + "[0]"); Messages.NOTIFICATIONS + "[0]");
} }
/** /**
...@@ -712,7 +706,7 @@ public class XSheet extends JPanel ...@@ -712,7 +706,7 @@ public class XSheet extends JPanel
new ThreadDialog( new ThreadDialog(
(Component) e.getSource(), (Component) e.getSource(),
message, message,
Resources.getText("Operation return value"), Messages.OPERATION_RETURN_VALUE,
JOptionPane.INFORMATION_MESSAGE).run(); JOptionPane.INFORMATION_MESSAGE).run();
} // Got notification } // Got notification
else if (e.getType().equals( else if (e.getType().equals(
......
...@@ -36,7 +36,7 @@ import javax.swing.table.TableCellRenderer; ...@@ -36,7 +36,7 @@ import javax.swing.table.TableCellRenderer;
public abstract class XTable extends JTable { public abstract class XTable extends JTable {
static final int NAME_COLUMN = 0; static final int NAME_COLUMN = 0;
static final int VALUE_COLUMN = 1; static final int VALUE_COLUMN = 1;
private Color defaultColor, editableColor, droppableColor, errorColor; private Color defaultColor, editableColor, errorColor;
private Font normalFont, boldFont; private Font normalFont, boldFont;
public XTable () { public XTable () {
...@@ -139,7 +139,6 @@ public abstract class XTable extends JTable { ...@@ -139,7 +139,6 @@ public abstract class XTable extends JTable {
if (defaultColor == null) { if (defaultColor == null) {
defaultColor = tcr.getForeground(); defaultColor = tcr.getForeground();
editableColor = Color.blue; editableColor = Color.blue;
droppableColor = Color.green;
errorColor = Color.red; errorColor = Color.red;
// this sometimes happens for some reason // this sometimes happens for some reason
if (defaultColor == null) { if (defaultColor == null) {
......
...@@ -26,12 +26,7 @@ ...@@ -26,12 +26,7 @@
package sun.tools.jconsole.inspector; package sun.tools.jconsole.inspector;
import java.awt.*; import java.awt.*;
import java.awt.dnd.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.datatransfer.*;
import java.io.*;
import java.util.*;
import javax.swing.plaf.*;
import javax.swing.event.*; import javax.swing.event.*;
import javax.swing.*; import javax.swing.*;
...@@ -44,16 +39,8 @@ public class XTextField extends JPanel ...@@ -44,16 +39,8 @@ public class XTextField extends JPanel
implements DocumentListener, implements DocumentListener,
ActionListener { ActionListener {
private static final Color selF = Color.red;
private static final Color selB = Color.yellow;
private Color fore=null, back=null;
private HashMap items = null; //used for popup menu selection
private XObject selectedObject; private XObject selectedObject;
private XObject currentObject;
private Class expectedClass;
private Object value;
protected JTextField textField; protected JTextField textField;
private JButton browseObjects;
private static boolean allowNullSelection = false; private static boolean allowNullSelection = false;
...@@ -81,13 +68,12 @@ public class XTextField extends JPanel ...@@ -81,13 +68,12 @@ public class XTextField extends JPanel
} }
public XTextField(Object value, public XTextField(Object value,
Class expectedClass, Class<?> expectedClass,
int colWidth, int colWidth,
boolean isCallable, boolean isCallable,
JButton button, JButton button,
XOperations operation) { XOperations operation) {
super(new BorderLayout()); super(new BorderLayout());
this.expectedClass = expectedClass;
this.button = button; this.button = button;
this.operation = operation; this.operation = operation;
add(textField = new JTextField(value.toString(),colWidth), add(textField = new JTextField(value.toString(),colWidth),
...@@ -112,17 +98,13 @@ public class XTextField extends JPanel ...@@ -112,17 +98,13 @@ public class XTextField extends JPanel
return allowNullSelection; return allowNullSelection;
} }
protected void init(Object value, Class expectedClass) { protected void init(Object value, Class<?> expectedClass) {
this.expectedClass = expectedClass; boolean fieldEditable = Utils.isEditableType(expectedClass.getName());
this.value = value;
boolean fieldEditable = Utils.isEditableType(expectedClass.getName());
clearObject(); clearObject();
if (value != null) { if (value != null) {
currentObject = new XObject(value);
textField.setText(value.toString()); textField.setText(value.toString());
} }
else { else {
currentObject = XObject.NULL_OBJECT;
//null String value for the moment //null String value for the moment
textField.setText(""); textField.setText("");
} }
...@@ -140,35 +122,12 @@ public class XTextField extends JPanel ...@@ -140,35 +122,12 @@ public class XTextField extends JPanel
} }
} }
private synchronized void setObject(XObject object) {
clearObject();
selectedObject = object;
currentObject = object;
setSelectedColors();
textField.setText(object.getText());
textField.getDocument().addDocumentListener(this);
paintImmediately(getVisibleRect());
}
private synchronized void clearObject() { private synchronized void clearObject() {
textField.getDocument().removeDocumentListener(this); textField.getDocument().removeDocumentListener(this);
selectedObject = null; selectedObject = null;
currentObject = null;
setDefaultColors(); setDefaultColors();
} }
private synchronized void setSelectedColors() {
// fore = textField.getForeground();
// back = textField.getBackground();
//textField.setForeground(Color.red);
// textField.setBackground(Color.yellow);
}
private synchronized void setDefaultColors() { private synchronized void setDefaultColors() {
// if (fore != null) textField.setForeground(fore); // if (fore != null) textField.setForeground(fore);
// if (back != null) textField.setBackground(back); // if (back != null) textField.setBackground(back);
...@@ -194,12 +153,6 @@ public class XTextField extends JPanel ...@@ -194,12 +153,6 @@ public class XTextField extends JPanel
} }
} }
private JPopupMenu buildEditPopupMenu() {
JPopupMenu menu = new JPopupMenu();
return menu;
}
// ACTIONLISTENER IMPLEMENTATION // ACTIONLISTENER IMPLEMENTATION
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (e.getSource() instanceof JTextField) { if (e.getSource() instanceof JTextField) {
......
...@@ -32,7 +32,7 @@ import javax.swing.*; ...@@ -32,7 +32,7 @@ import javax.swing.*;
import javax.swing.tree.*; import javax.swing.tree.*;
import sun.tools.jconsole.JConsole; import sun.tools.jconsole.JConsole;
import sun.tools.jconsole.MBeansTab; import sun.tools.jconsole.MBeansTab;
import sun.tools.jconsole.Resources; import sun.tools.jconsole.Messages;
import sun.tools.jconsole.inspector.XNodeInfo; import sun.tools.jconsole.inspector.XNodeInfo;
import static sun.tools.jconsole.inspector.XNodeInfo.Type; import static sun.tools.jconsole.inspector.XNodeInfo.Type;
...@@ -182,7 +182,7 @@ public class XTree extends JTree { ...@@ -182,7 +182,7 @@ public class XTree extends JTree {
* Returns true if any of the children nodes is a non MBean metadata node. * Returns true if any of the children nodes is a non MBean metadata node.
*/ */
private boolean hasNonMetadataNodes(DefaultMutableTreeNode node) { private boolean hasNonMetadataNodes(DefaultMutableTreeNode node) {
for (Enumeration e = node.children(); e.hasMoreElements();) { for (Enumeration<?> e = node.children(); e.hasMoreElements();) {
DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement(); DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement();
Object uo = n.getUserObject(); Object uo = n.getUserObject();
if (uo instanceof XNodeInfo) { if (uo instanceof XNodeInfo) {
...@@ -205,7 +205,7 @@ public class XTree extends JTree { ...@@ -205,7 +205,7 @@ public class XTree extends JTree {
* Returns true if any of the children nodes is an MBean metadata node. * Returns true if any of the children nodes is an MBean metadata node.
*/ */
public boolean hasMetadataNodes(DefaultMutableTreeNode node) { public boolean hasMetadataNodes(DefaultMutableTreeNode node) {
for (Enumeration e = node.children(); e.hasMoreElements();) { for (Enumeration<?> e = node.children(); e.hasMoreElements();) {
DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement(); DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement();
Object uo = n.getUserObject(); Object uo = n.getUserObject();
if (uo instanceof XNodeInfo) { if (uo instanceof XNodeInfo) {
...@@ -251,7 +251,7 @@ public class XTree extends JTree { ...@@ -251,7 +251,7 @@ public class XTree extends JTree {
Set<DefaultMutableTreeNode> metadataNodes = Set<DefaultMutableTreeNode> metadataNodes =
new HashSet<DefaultMutableTreeNode>(); new HashSet<DefaultMutableTreeNode>();
DefaultTreeModel model = (DefaultTreeModel) getModel(); DefaultTreeModel model = (DefaultTreeModel) getModel();
for (Enumeration e = node.children(); e.hasMoreElements();) { for (Enumeration<?> e = node.children(); e.hasMoreElements();) {
DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement(); DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement();
Object uo = n.getUserObject(); Object uo = n.getUserObject();
if (uo instanceof XNodeInfo) { if (uo instanceof XNodeInfo) {
...@@ -596,7 +596,7 @@ public class XTree extends JTree { ...@@ -596,7 +596,7 @@ public class XTree extends JTree {
if (ai != null && ai.length > 0) { if (ai != null && ai.length > 0) {
DefaultMutableTreeNode attributes = new DefaultMutableTreeNode(); DefaultMutableTreeNode attributes = new DefaultMutableTreeNode();
XNodeInfo attributesUO = new XNodeInfo(Type.ATTRIBUTES, mbean, XNodeInfo attributesUO = new XNodeInfo(Type.ATTRIBUTES, mbean,
Resources.getText("Attributes"), null); Messages.ATTRIBUTES, null);
attributes.setUserObject(attributesUO); attributes.setUserObject(attributesUO);
node.insert(attributes, childIndex++); node.insert(attributes, childIndex++);
for (MBeanAttributeInfo mbai : ai) { for (MBeanAttributeInfo mbai : ai) {
...@@ -613,7 +613,7 @@ public class XTree extends JTree { ...@@ -613,7 +613,7 @@ public class XTree extends JTree {
if (oi != null && oi.length > 0) { if (oi != null && oi.length > 0) {
DefaultMutableTreeNode operations = new DefaultMutableTreeNode(); DefaultMutableTreeNode operations = new DefaultMutableTreeNode();
XNodeInfo operationsUO = new XNodeInfo(Type.OPERATIONS, mbean, XNodeInfo operationsUO = new XNodeInfo(Type.OPERATIONS, mbean,
Resources.getText("Operations"), null); Messages.OPERATIONS, null);
operations.setUserObject(operationsUO); operations.setUserObject(operationsUO);
node.insert(operations, childIndex++); node.insert(operations, childIndex++);
for (MBeanOperationInfo mboi : oi) { for (MBeanOperationInfo mboi : oi) {
...@@ -646,7 +646,7 @@ public class XTree extends JTree { ...@@ -646,7 +646,7 @@ public class XTree extends JTree {
if (isBroadcaster != null && isBroadcaster.booleanValue()) { if (isBroadcaster != null && isBroadcaster.booleanValue()) {
DefaultMutableTreeNode notifications = new DefaultMutableTreeNode(); DefaultMutableTreeNode notifications = new DefaultMutableTreeNode();
XNodeInfo notificationsUO = new XNodeInfo(Type.NOTIFICATIONS, mbean, XNodeInfo notificationsUO = new XNodeInfo(Type.NOTIFICATIONS, mbean,
Resources.getText("Notifications"), null); Messages.NOTIFICATIONS, null);
notifications.setUserObject(notificationsUO); notifications.setUserObject(notificationsUO);
node.insert(notifications, childIndex++); node.insert(notifications, childIndex++);
if (ni != null && ni.length > 0) { if (ni != null && ni.length > 0) {
......
...@@ -30,8 +30,6 @@ import javax.swing.ImageIcon; ...@@ -30,8 +30,6 @@ import javax.swing.ImageIcon;
import javax.swing.JTree; import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import sun.tools.jconsole.Resources;
import sun.tools.jconsole.inspector.XNodeInfo.Type;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class XTreeRenderer extends DefaultTreeCellRenderer { public class XTreeRenderer extends DefaultTreeCellRenderer {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册