--- old/src/share/classes/sun/tools/jconsole/VMPanel.java 2012-05-21 01:33:11.925502643 +0200 +++ new/src/share/classes/sun/tools/jconsole/VMPanel.java 2012-05-21 01:33:11.065470042 +0200 @@ -28,18 +28,17 @@ import java.awt.*; import java.awt.event.*; import java.beans.*; -import java.io.*; import java.lang.reflect.*; import java.util.*; import java.util.List; import java.util.Timer; - import javax.swing.*; import javax.swing.plaf.*; +import sun.tools.jconsole.resources.Messages; + import com.sun.tools.jconsole.JConsolePlugin; import com.sun.tools.jconsole.JConsoleContext; -import static com.sun.tools.jconsole.JConsoleContext.ConnectionState.*; import static sun.tools.jconsole.ProxyClient.*; @@ -51,13 +50,10 @@ private int updateInterval; private String hostName; private int port; - private int vmid; private String userName; private String password; private String url; private VMInternalFrame vmIF = null; - private static final String windowsLaF = - "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; private static ArrayList tabInfos = new ArrayList(); private boolean wasConnected = false; @@ -100,7 +96,6 @@ this.updateInterval = updateInterval; this.hostName = proxyClient.getHostName(); this.port = proxyClient.getPort(); - this.vmid = proxyClient.getVmid(); this.userName = proxyClient.getUserName(); this.password = proxyClient.getPassword(); this.url = proxyClient.getUrl(); @@ -186,9 +181,9 @@ public String getToolTipText(MouseEvent event) { if (connectedIconBounds.contains(event.getPoint())) { if (isConnected()) { - return getText("Connected. Click to disconnect."); + return Messages.CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_; } else { - return getText("Disconnected. Click to connect."); + return Messages.DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_; } } else { return super.getToolTipText(event); @@ -219,7 +214,7 @@ private Tab instantiate(TabInfo tabInfo) { try { - Constructor con = tabInfo.tabClass.getConstructor(VMPanel.class); + Constructor con = tabInfo.tabClass.getConstructor(VMPanel.class); return (Tab) con.newInstance(this); } catch (Exception ex) { System.err.println(ex); @@ -354,7 +349,7 @@ private void onConnecting() { time0 = System.currentTimeMillis(); - final JConsole jc = (JConsole) SwingUtilities.getWindowAncestor(this); + SwingUtilities.getWindowAncestor(this); String connectionName = getConnectionName(); progressBar = new JProgressBar(); @@ -363,9 +358,9 @@ progressPanel.add(progressBar); Object[] message = { - "

" + getText("connectingTo1", connectionName) + "

", + "

" + Resources.format(Messages.CONNECTING_TO1, connectionName) + "

", progressPanel, - "" + getText("connectingTo2", connectionName) + "" + "" + Resources.format(Messages.CONNECTING_TO2, connectionName) + "" }; optionPane = @@ -373,7 +368,7 @@ message, JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, - new String[]{getText("Cancel")}, + new String[]{Messages.CANCEL}, 0); @@ -409,7 +404,7 @@ if (vmIF != null) { String displayName = getDisplayName(); if (!proxyClient.isConnected()) { - displayName = getText("ConnectionName (disconnected)", displayName); + displayName = Resources.format(Messages.CONNECTION_NAME__DISCONNECTED_, displayName); } vmIF.setTitle(displayName); } @@ -458,25 +453,18 @@ private void vmPanelDied() { disconnect(); - final JConsole jc = (JConsole) SwingUtilities.getWindowAncestor(this); - JOptionPane optionPane; - - final String connectStr = getText("Connect"); - final String reconnectStr = getText("Reconnect"); - final String cancelStr = getText("Cancel"); - String msgTitle, msgExplanation, buttonStr; if (wasConnected) { wasConnected = false; - msgTitle = getText("connectionLost1"); - msgExplanation = getText("connectionLost2", getConnectionName()); - buttonStr = reconnectStr; + msgTitle = Messages.CONNECTION_LOST; + msgExplanation = Resources.format(Messages.CONNECTING_TO2, getConnectionName()); + buttonStr = Messages.RECONNECT; } else { - msgTitle = getText("connectionFailed1"); - msgExplanation = getText("connectionFailed2", getConnectionName()); - buttonStr = connectStr; + msgTitle =Messages.CONNECTION_FAILED1; + msgExplanation = Resources.format(Messages.CONNECTION_FAILED2, getConnectionName()); + buttonStr = Messages.CONNECT; } optionPane = @@ -485,7 +473,7 @@ "" + msgExplanation + "", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, - new String[]{buttonStr, cancelStr}, + new String[]{buttonStr, Messages.CANCEL}, 0); optionPane.addPropertyChangeListener(new PropertyChangeListener() { @@ -494,7 +482,7 @@ if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) { Object value = event.getNewValue(); - if (value == reconnectStr || value == connectStr) { + if (value == Messages.RECONNECT || value == Messages.CONNECT) { connect(); } else if (!everConnected) { try { @@ -643,11 +631,6 @@ } } - // Convenience methods - private static String getText(String key, Object... args) { - return Resources.getText(key, args); - } - private void createPluginTabs() { // add plugin tabs if not done if (!pluginTabsAdded) {