< prev index next >

src/share/classes/sun/tools/jconsole/VMPanel.java

Print this page
rev 1501 : 7017818: NLS: JConsoleResources.java cannot be handled by translation team
Reviewed-by: mchung, mfang
rev 1505 : 8030878: JConsole issues meaningless message if SSL connection fails
Reviewed-by: mchung, sla

*** 26,58 **** package sun.tools.jconsole; 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 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.*; @SuppressWarnings("serial") public class VMPanel extends JTabbedPane implements PropertyChangeListener { private ProxyClient proxyClient; private Timer timer; 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; --- 26,55 ---- package sun.tools.jconsole; import java.awt.*; import java.awt.event.*; import java.beans.*; import java.lang.reflect.*; import java.util.*; import java.util.List; import java.util.Timer; import javax.swing.*; import javax.swing.plaf.*; + import com.sun.tools.jconsole.JConsolePlugin; import com.sun.tools.jconsole.JConsoleContext; import static sun.tools.jconsole.ProxyClient.*; @SuppressWarnings("serial") public class VMPanel extends JTabbedPane implements PropertyChangeListener { private ProxyClient proxyClient; private Timer timer; private int updateInterval; private String hostName; private int port; private String userName; private String password; private String url; private VMInternalFrame vmIF = null;
*** 101,111 **** VMPanel(ProxyClient proxyClient, int updateInterval) { this.proxyClient = proxyClient; 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(); for (TabInfo tabInfo : tabInfos) { --- 98,107 ----
*** 190,202 **** } public String getToolTipText(MouseEvent event) { if (connectedIconBounds.contains(event.getPoint())) { if (isConnected()) { ! return getText("Connected. Click to disconnect."); } else { ! return getText("Disconnected. Click to connect."); } } else { return super.getToolTipText(event); } } --- 186,198 ---- } public String getToolTipText(MouseEvent event) { if (connectedIconBounds.contains(event.getPoint())) { if (isConnected()) { ! return Messages.CONNECTED_PUNCTUATION_CLICK_TO_DISCONNECT_; } else { ! return Messages.DISCONNECTED_PUNCTUATION_CLICK_TO_CONNECT_; } } else { return super.getToolTipText(event); } }
*** 223,233 **** super.removeTabAt(index); } private Tab instantiate(TabInfo tabInfo) { try { ! Constructor con = tabInfo.tabClass.getConstructor(VMPanel.class); return (Tab)con.newInstance(this); } catch (Exception ex) { System.err.println(ex); return null; } --- 219,229 ---- super.removeTabAt(index); } private Tab instantiate(TabInfo tabInfo) { try { ! Constructor<?> con = tabInfo.tabClass.getConstructor(VMPanel.class); return (Tab)con.newInstance(this); } catch (Exception ex) { System.err.println(ex); return null; }
*** 361,391 **** // Called on EDT private void onConnecting() { time0 = System.currentTimeMillis(); ! final JConsole jc = (JConsole)SwingUtilities.getWindowAncestor(this); String connectionName = getConnectionName(); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); JPanel progressPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); progressPanel.add(progressBar); Object[] message = { ! "<html><h3>" + getText("connectingTo1", connectionName) + "</h3></html>", progressPanel, ! "<html><b>" + getText("connectingTo2", connectionName) + "</b></html>" }; optionPane = SheetDialog.showOptionDialog(this, message, JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, ! new String[] { getText("Cancel") }, 0); } --- 357,387 ---- // Called on EDT private void onConnecting() { time0 = System.currentTimeMillis(); ! SwingUtilities.getWindowAncestor(this); String connectionName = getConnectionName(); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); JPanel progressPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); progressPanel.add(progressBar); Object[] message = { ! "<html><h3>" + Resources.format(Messages.CONNECTING_TO1, connectionName) + "</h3></html>", progressPanel, ! "<html><b>" + Resources.format(Messages.CONNECTING_TO2, connectionName) + "</b></html>" }; optionPane = SheetDialog.showOptionDialog(this, message, JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, ! new String[]{Messages.CANCEL}, 0); }
*** 416,426 **** void updateFrameTitle() { VMInternalFrame vmIF = getFrame(); if (vmIF != null) { String displayName = getDisplayName(); if (!proxyClient.isConnected()) { ! displayName = getText("ConnectionName (disconnected)", displayName); } vmIF.setTitle(displayName); } } --- 412,422 ---- void updateFrameTitle() { VMInternalFrame vmIF = getFrame(); if (vmIF != null) { String displayName = getDisplayName(); if (!proxyClient.isConnected()) { ! displayName = Resources.format(Messages.CONNECTION_NAME__DISCONNECTED_, displayName); } vmIF.setTitle(displayName); } }
*** 465,517 **** // Call on EDT 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 insecureStr = getText("Insecure"); - final String cancelStr = getText("Cancel"); - String msgTitle, msgExplanation, buttonStr; if (wasConnected) { wasConnected = false; ! msgTitle = getText("connectionLost1"); ! msgExplanation = getText("connectionLost2", getConnectionName()); ! buttonStr = reconnectStr; } else if (shouldUseSSL) { ! msgTitle = getText("connectionFailedSSL1"); ! msgExplanation = getText("connectionFailedSSL2", getConnectionName()); ! buttonStr = insecureStr; } else { ! msgTitle = getText("connectionFailed1"); ! msgExplanation = getText("connectionFailed2", getConnectionName()); ! buttonStr = connectStr; } optionPane = SheetDialog.showOptionDialog(this, "<html><h3>" + msgTitle + "</h3>" + "<b>" + msgExplanation + "</b>", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, ! new String[] { buttonStr, cancelStr }, 0); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) { Object value = event.getNewValue(); ! if (value == reconnectStr || value == connectStr) { connect(); ! } else if (value == insecureStr) { shouldUseSSL = false; connect(); } else if (!everConnected) { try { getFrame().setClosed(true); --- 461,505 ---- // Call on EDT private void vmPanelDied() { disconnect(); JOptionPane optionPane; String msgTitle, msgExplanation, buttonStr; if (wasConnected) { wasConnected = false; ! msgTitle = Messages.CONNECTION_LOST1; ! msgExplanation = Resources.format(Messages.CONNECTING_TO2, getConnectionName()); ! buttonStr = Messages.RECONNECT; } else if (shouldUseSSL) { ! msgTitle = Messages.CONNECTION_FAILED_SSL1; ! msgExplanation = Resources.format(Messages.CONNECTION_FAILED_SSL2, getConnectionName()); ! buttonStr = Messages.INSECURE; } else { ! msgTitle = Messages.CONNECTION_FAILED1; ! msgExplanation = Resources.format(Messages.CONNECTION_FAILED2, getConnectionName()); ! buttonStr = Messages.CONNECT; } optionPane = SheetDialog.showOptionDialog(this, "<html><h3>" + msgTitle + "</h3>" + "<b>" + msgExplanation + "</b>", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, ! new String[]{buttonStr, Messages.CANCEL}, 0); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals(JOptionPane.VALUE_PROPERTY)) { Object value = event.getNewValue(); ! if (value == Messages.RECONNECT || value == Messages.CONNECT) { connect(); ! } else if (value == Messages.INSECURE) { shouldUseSSL = false; connect(); } else if (!everConnected) { try { getFrame().setClosed(true);
*** 654,668 **** this.name = name; this.tabVisible = tabVisible; } } - // 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) { for (JConsolePlugin p : plugins.keySet()) { Map<String, JPanel> tabs = p.getTabs(); --- 642,651 ----
< prev index next >