src/share/classes/sun/tools/jconsole/inspector/XSheet.java

Print this page
rev 5340 : 7017818: NLS: JConsoleResources.java cannot be handled by translation team
Reviewed-by: duke

@@ -54,12 +54,11 @@
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 
 import sun.tools.jconsole.*;
 import sun.tools.jconsole.inspector.XNodeInfo.Type;
-
-import static sun.tools.jconsole.Resources.*;
+import sun.tools.jconsole.resources.Messages;
 
 @SuppressWarnings("serial")
 public class XSheet extends JPanel
         implements ActionListener, NotificationListener {
 

@@ -104,32 +103,28 @@
         add(mainPanel, BorderLayout.CENTER);
         // add south panel to XSheet
         southPanel = new JPanel();
         add(southPanel, BorderLayout.SOUTH);
         // create the refresh button
-        String refreshButtonKey = "MBeansTab.refreshAttributesButton";
-        refreshButton = new JButton(getText(refreshButtonKey));
-        refreshButton.setMnemonic(getMnemonicInt(refreshButtonKey));
-        refreshButton.setToolTipText(getText(refreshButtonKey + ".toolTip"));
+        refreshButton = new JButton(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON);
+        refreshButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON));
+        refreshButton.setToolTipText(Messages.MBEANS_TAB_REFRESH_ATTRIBUTES_BUTTON_TOOLTIP);
         refreshButton.addActionListener(this);
         // create the clear button
-        String clearButtonKey = "MBeansTab.clearNotificationsButton";
-        clearButton = new JButton(getText(clearButtonKey));
-        clearButton.setMnemonic(getMnemonicInt(clearButtonKey));
-        clearButton.setToolTipText(getText(clearButtonKey + ".toolTip"));
+        clearButton = new JButton(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON);
+        clearButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON));
+        clearButton.setToolTipText(Messages.MBEANS_TAB_CLEAR_NOTIFICATIONS_BUTTON_TOOLTIP);
         clearButton.addActionListener(this);
         // create the subscribe button
-        String subscribeButtonKey = "MBeansTab.subscribeNotificationsButton";
-        subscribeButton = new JButton(getText(subscribeButtonKey));
-        subscribeButton.setMnemonic(getMnemonicInt(subscribeButtonKey));
-        subscribeButton.setToolTipText(getText(subscribeButtonKey + ".toolTip"));
+        subscribeButton = new JButton(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON);
+        subscribeButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON));
+        subscribeButton.setToolTipText(Messages.MBEANS_TAB_SUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP);
         subscribeButton.addActionListener(this);
         // create the unsubscribe button
-        String unsubscribeButtonKey = "MBeansTab.unsubscribeNotificationsButton";
-        unsubscribeButton = new JButton(getText(unsubscribeButtonKey));
-        unsubscribeButton.setMnemonic(getMnemonicInt(unsubscribeButtonKey));
-        unsubscribeButton.setToolTipText(getText(unsubscribeButtonKey + ".toolTip"));
+       unsubscribeButton = new JButton(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON);
+        unsubscribeButton.setMnemonic(Resources.getMnemonicInt(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON));
+        unsubscribeButton.setToolTipText(Messages.MBEANS_TAB_UNSUBSCRIBE_NOTIFICATIONS_BUTTON_TOOLTIP);
         unsubscribeButton.addActionListener(this);
         // create XMBeanAttributes container
         mbeanAttributes = new XMBeanAttributes(mbeansTab);
         // create XMBeanOperations container
         mbeanOperations = new XMBeanOperations(mbeansTab);

@@ -236,11 +231,11 @@
                         System.err.println("Couldn't get MBeanInfo for MBean [" +
                                 mbean.getObjectName() + "]");
                         t.printStackTrace();
                     }
                     showErrorDialog(t.toString(),
-                            Resources.getText("Problem displaying MBean"));
+                            Messages.PROBLEM_DISPLAYING_MBEAN);
                 }
             }
         };
         sw.execute();
     }

@@ -277,11 +272,11 @@
                                             new JPanel(new BorderLayout());
                                     JPanel attributeBorderPanel =
                                             new JPanel(new BorderLayout());
                                     attributeBorderPanel.setBorder(
                                             BorderFactory.createTitledBorder(
-                                            Resources.getText("Attribute value")));
+                                            Messages.ATTRIBUTE_VALUE));
                                     JPanel attributeValuePanel =
                                             new JPanel(new BorderLayout());
                                     attributeValuePanel.setBorder(
                                             LineBorder.createGrayLineBorder());
                                     attributeValuePanel.add(mbeanAttributes.getTableHeader(),

@@ -312,11 +307,11 @@
                                                 "attribute for MBean [" +
                                                 mbean.getObjectName() + "]");
                                         t.printStackTrace();
                                     }
                                     showErrorDialog(t.toString(),
-                                            Resources.getText("Problem displaying MBean"));
+                                            Messages.PROBLEM_DISPLAYING_MBEAN);
                                 }
                             }
                         };
                 sw.execute();
                 break;

@@ -331,11 +326,11 @@
                 invalidate();
                 mainPanel.removeAll();
                 JPanel operationPanel = new JPanel(new BorderLayout());
                 JPanel operationBorderPanel = new JPanel(new BorderLayout());
                 operationBorderPanel.setBorder(BorderFactory.createTitledBorder(
-                        Resources.getText("Operation invocation")));
+                        Messages.OPERATION_INVOCATION));
                 operationBorderPanel.add(new JScrollPane(mbeanOperations));
                 operationPanel.add(operationBorderPanel, BorderLayout.NORTH);
                 mbi.addMBeanOperationInfo(mboi);
                 operationPanel.add(mbi, BorderLayout.CENTER);
                 mainPanel.add(operationPanel, BorderLayout.CENTER);

@@ -387,11 +382,11 @@
                         }
                         invalidate();
                         mainPanel.removeAll();
                         JPanel borderPanel = new JPanel(new BorderLayout());
                         borderPanel.setBorder(BorderFactory.createTitledBorder(
-                                Resources.getText("Attribute values")));
+                                Messages.ATTRIBUTE_VALUES));
                         borderPanel.add(new JScrollPane(mbeanAttributes));
                         mainPanel.add(borderPanel, BorderLayout.CENTER);
                         // add the refresh button to the south panel
                         southPanel.removeAll();
                         southPanel.add(refreshButton, BorderLayout.SOUTH);

@@ -407,11 +402,11 @@
                                 "attributes for MBean [" +
                                 mbean.getObjectName() + "]");
                         t.printStackTrace();
                     }
                     showErrorDialog(t.toString(),
-                            Resources.getText("Problem displaying MBean"));
+                            Messages.PROBLEM_DISPLAYING_MBEAN);
                 }
             }
         };
         sw.execute();
     }

@@ -440,11 +435,11 @@
                         mbeanOperations.loadOperations(mbean, mbi);
                         invalidate();
                         mainPanel.removeAll();
                         JPanel borderPanel = new JPanel(new BorderLayout());
                         borderPanel.setBorder(BorderFactory.createTitledBorder(
-                                Resources.getText("Operation invocation")));
+                                Messages.OPERATION_INVOCATION));
                         borderPanel.add(new JScrollPane(mbeanOperations));
                         mainPanel.add(borderPanel, BorderLayout.CENTER);
                         southPanel.setVisible(false);
                         southPanel.removeAll();
                         validate();

@@ -457,11 +452,11 @@
                                 "operations for MBean [" +
                                 mbean.getObjectName() + "]");
                         t.printStackTrace();
                     }
                     showErrorDialog(t.toString(),
-                            Resources.getText("Problem displaying MBean"));
+                            Messages.PROBLEM_DISPLAYING_MBEAN);
                 }
             }
         };
         sw.execute();
     }

@@ -477,11 +472,11 @@
         updateNotifications();
         invalidate();
         mainPanel.removeAll();
         JPanel borderPanel = new JPanel(new BorderLayout());
         borderPanel.setBorder(BorderFactory.createTitledBorder(
-                Resources.getText("Notification buffer")));
+                Messages.NOTIFICATION_BUFFER));
         borderPanel.add(new JScrollPane(mbeanNotifications));
         mainPanel.add(borderPanel, BorderLayout.CENTER);
         // add the subscribe/unsubscribe/clear buttons to the south panel
         southPanel.removeAll();
         southPanel.add(subscribeButton, BorderLayout.WEST);

@@ -526,11 +521,11 @@
                     if (JConsole.isDebug()) {
                         System.err.println("Problem adding listener");
                         t.printStackTrace();
                     }
                     showErrorDialog(t.getMessage(),
-                            Resources.getText("Problem adding listener"));
+                            Messages.PROBLEM_ADDING_LISTENER);
                 }
             }
         }.execute();
     }
 

@@ -555,11 +550,11 @@
                     if (JConsole.isDebug()) {
                         System.err.println("Problem removing listener");
                         t.printStackTrace();
                     }
                     showErrorDialog(t.getMessage(),
-                            Resources.getText("Problem removing listener"));
+                            Messages.PROBLEM_REMOVING_LISTENER);
                 }
             }
         }.execute();
     }
 

@@ -584,11 +579,11 @@
      * Update notification node label in MBean tree: "Notifications[received]".
      */
     // Call on EDT
     private void updateReceivedNotifications(
             DefaultMutableTreeNode emitter, long received, boolean bold) {
-        String text = Resources.getText("Notifications") + "[" + received + "]";
+        String text = Messages.NOTIFICATIONS + "[" + received + "]";
         DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) mbeansTab.getTree().getLastSelectedPathComponent();
         if (bold && emitter != selectedNode) {
             text = "<html><b>" + text + "</b></html>";
         }
         updateNotificationsNodeLabel(emitter, text);

@@ -598,20 +593,20 @@
      * Update notification node label in MBean tree: "Notifications".
      */
     // Call on EDT
     private void clearNotifications() {
         updateNotificationsNodeLabel(currentNode,
-                Resources.getText("Notifications"));
+                Messages.NOTIFICATIONS);
     }
 
     /**
      * Update notification node label in MBean tree: "Notifications[0]".
      */
     // Call on EDT
     private void clearNotifications0() {
         updateNotificationsNodeLabel(currentNode,
-                Resources.getText("Notifications") + "[0]");
+                Messages.NOTIFICATIONS + "[0]");
     }
 
     /**
      * Update the label of the supplied MBean tree node.
      */

@@ -710,11 +705,11 @@
                 }
             }
             new ThreadDialog(
                     (Component) e.getSource(),
                     message,
-                    Resources.getText("Operation return value"),
+                    Messages.OPERATION_RETURN_VALUE,
                     JOptionPane.INFORMATION_MESSAGE).run();
         } // Got notification
         else if (e.getType().equals(
                 XMBeanNotifications.NOTIFICATION_RECEIVED_EVENT)) {
             DefaultMutableTreeNode emitter = (DefaultMutableTreeNode) handback;