![]() |
![]() |
com-sun-tools-visualvm-modules-startup16:33:58.000 INFO jd.cli.Main - Decompiling com-sun-tools-visualvm-modules-startup.jar package com.sun.tools.visualvm.modules.startup; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JDialog; final class AcceptLicense$1 implements ActionListener { public void actionPerformed(ActionEvent e) { AcceptLicense.access$002(e.getActionCommand()); AcceptLicense.access$100().setVisible(false); AcceptLicense.access$100().dispose(); AcceptLicense.access$102(null); } } /* Location: * Qualified Name: com.sun.tools.visualvm.modules.startup.AcceptLicense.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.modules.startup; import java.awt.Container; import java.awt.Dialog.ModalityType; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; import javax.accessibility.AccessibleContext; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import org.openide.util.NbBundle; import org.openide.util.UserCancelException; public final class AcceptLicense { private static final String YES_AC = "yes"; private static final String NO_AC = "no"; private static JDialog d; private static String command; public static void showLicensePanel() throws Exception { if (!VisualVMStartup.checkEnv()) { throw new UserCancelException(); } URL url = AcceptLicense.class.getResource("LICENSE.txt"); LicensePanel licensePanel = new LicensePanel(url); ResourceBundle bundle = NbBundle.getBundle(AcceptLicense.class); String yesLabel = bundle.getString("MSG_LicenseYesButton"); String noLabel = bundle.getString("MSG_LicenseNoButton"); JButton yesButton = new JButton(); JButton noButton = new JButton(); Utils.setLocalizedText(yesButton, yesLabel); Utils.setLocalizedText(noButton, noLabel); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { AcceptLicense.access$002(e.getActionCommand()); AcceptLicense.d.setVisible(false); AcceptLicense.d.dispose(); AcceptLicense.access$102(null); } }; yesButton.addActionListener(listener); noButton.addActionListener(listener); yesButton.setActionCommand("yes"); noButton.setActionCommand("no"); yesButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_AcceptButton")); yesButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSD_AcceptButton")); noButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_RejectButton")); noButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSD_RejectButton")); Dimension yesPF = yesButton.getPreferredSize(); Dimension noPF = noButton.getPreferredSize(); int maxWidth = Math.max(width, width); int maxHeight = Math.max(height, height); yesButton.setPreferredSize(new Dimension(maxWidth, maxHeight)); noButton.setPreferredSize(new Dimension(maxWidth, maxHeight)); d = new JDialog(null, bundle.getString("MSG_LicenseDlgTitle"), Dialog.ModalityType.APPLICATION_MODAL); Toolkit toolkit = Toolkit.getDefaultToolkit(); List<Image> icons = new ArrayList(); icons.add(toolkit.createImage(AcceptLicense.class.getResource("/com/sun/tools/visualvm/modules/startup/resources/icon16.png"))); icons.add(toolkit.createImage(AcceptLicense.class.getResource("/com/sun/tools/visualvm/modules/startup/resources/icon24.png"))); icons.add(toolkit.createImage(AcceptLicense.class.getResource("/com/sun/tools/visualvm/modules/startup/resources/icon32.png"))); icons.add(toolkit.createImage(AcceptLicense.class.getResource("/com/sun/tools/visualvm/modules/startup/resources/icon48.png"))); d.setIconImages(icons); d.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_LicenseDlg")); d.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_LicenseDlg")); d.getContentPane().add(licensePanel, "Center"); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(2)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(17, 12, 11, 11)); buttonPanel.add(yesButton); buttonPanel.add(noButton); d.getContentPane().add(buttonPanel, "South"); d.setSize(new Dimension(600, 600)); d.setDefaultCloseOperation(2); d.setResizable(true); d.setLocationRelativeTo(null); Utils.makeAssertive(d); d.setVisible(true); if ("yes".equals(command)) { return; } throw new UserCancelException(); } } /* Location: * Qualified Name: com.sun.tools.visualvm.modules.startup.AcceptLicense * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.modules.startup; import java.awt.Dimension; import java.awt.Font; import java.awt.Insets; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.logging.Logger; import javax.accessibility.AccessibleContext; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.UIDefaults; import javax.swing.UIManager; import org.openide.util.NbBundle; final class LicensePanel extends JPanel { private static final Logger LOGGER = Logger.getLogger(LicensePanel.class.getName()); private JEditorPane jEditorPane1; private JScrollPane jScrollPane1; private JTextArea jTextAreaBottom; private JTextArea jTextAreaTop; private URL url; public LicensePanel(URL url) { this.url = url; initComponents(); initAccessibility(); try { jEditorPane1.setPage(url); } catch (IOException exc) { LOGGER.throwing(LicensePanel.class.getName(), "<init>", exc); } } private void initAccessibility() { getAccessibleContext().setAccessibleName(bundle.getString("ACSN_LicensePanel")); getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_LicensePanel")); jEditorPane1.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_EditorPane")); jEditorPane1.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_EditorPane")); } private void initComponents() { jTextAreaTop = new JTextArea(); jScrollPane1 = new JScrollPane(); jEditorPane1 = new JEditorPane(); jTextAreaBottom = new JTextArea(); setBorder(BorderFactory.createEmptyBorder(12, 12, 0, 11)); setLayout(new BoxLayout(this, 1)); jTextAreaTop.setBackground(getBackground()); jTextAreaTop.setColumns(20); jTextAreaTop.setEditable(false); jTextAreaTop.setFont(UIManager.getFont("Label.font").deriveFont(1)); jTextAreaTop.setLineWrap(true); jTextAreaTop.setRows(1); jTextAreaTop.setText(bundle.getString("MSG_LicenseDlgLabelTop")); jTextAreaTop.setWrapStyleWord(true); jTextAreaTop.setBorder(BorderFactory.createEmptyBorder(0, 0, 3, 0)); jTextAreaTop.setFocusable(false); jTextAreaTop.setMargin(new Insets(0, 0, 2, 0)); jTextAreaTop.setOpaque(false); jTextAreaTop.setRequestFocusEnabled(false); add(jTextAreaTop); jEditorPane1.setBackground(UIManager.getDefaults().getColor("Tree.textBackground")); jEditorPane1.setEditable(false); jEditorPane1.setForeground(UIManager.getDefaults().getColor("Tree.textForeground")); jEditorPane1.setPreferredSize(new Dimension(500, 500)); jScrollPane1.setViewportView(jEditorPane1); add(jScrollPane1); jTextAreaBottom.setBackground(getBackground()); jTextAreaBottom.setColumns(20); jTextAreaBottom.setEditable(false); jTextAreaBottom.setFont(UIManager.getFont("Label.font").deriveFont(1)); jTextAreaBottom.setLineWrap(true); jTextAreaBottom.setRows(2); jTextAreaBottom.setText(bundle.getString("MSG_LicenseDlgLabelBottom")); jTextAreaBottom.setWrapStyleWord(true); jTextAreaBottom.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); jTextAreaBottom.setFocusable(false); jTextAreaBottom.setOpaque(false); jTextAreaBottom.setRequestFocusEnabled(false); add(jTextAreaBottom); } private static final ResourceBundle bundle = NbBundle.getBundle(LicensePanel.class); } /* Location: * Qualified Name: com.sun.tools.visualvm.modules.startup.LicensePanel * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.modules.startup; import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; import java.awt.peer.ComponentPeer; import javax.swing.JDialog; final class Utils$1 implements HierarchyListener { Utils$1(JDialog paramJDialog) {} public void hierarchyChanged(HierarchyEvent e) { if (((e.getChangeFlags() & 0x4) != 0L) && (val$d.isShowing())) { ComponentPeer peer = val$d.getPeer(); if (peer != null) { peer.setVisible(true); } val$d.removeHierarchyListener(this); val$d.setAlwaysOnTop(true); val$d.toFront(); val$d.setAlwaysOnTop(false); } } } /* Location: * Qualified Name: com.sun.tools.visualvm.modules.startup.Utils.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.modules.startup; import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; import java.awt.peer.ComponentPeer; import javax.swing.AbstractButton; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.UIManager; import org.openide.util.Utilities; final class Utils { static void setSystemLaF() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable t) {} } static void makeAssertive(JDialog d) { d.addHierarchyListener(new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { if (((e.getChangeFlags() & 0x4) != 0L) && (val$d.isShowing())) { ComponentPeer peer = val$d.getPeer(); if (peer != null) { peer.setVisible(true); } val$d.removeHierarchyListener(this); val$d.setAlwaysOnTop(true); val$d.toFront(); val$d.setAlwaysOnTop(false); } } }); } static JDialog assertiveErrorDialog(String caption, String message) { JOptionPane p = new JOptionPane(message, 0); JDialog d = p.createDialog(null, caption); makeAssertive(d); return d; } static void setLocalizedText(AbstractButton button, String text) { if (text == null) { button.setText(null); return; } int i = findMnemonicAmpersand(text); if (i < 0) { button.setText(text); button.setMnemonic(0); } else { button.setText(text.substring(0, i) + text.substring(i + 1)); if (Utilities.isMac()) { return; } char ch = text.charAt(i + 1); button.setMnemonic(ch); button.setDisplayedMnemonicIndex(i); } } private static int findMnemonicAmpersand(String text) { int i = -1; do { i = text.indexOf('&', i + 1); if ((i >= 0) && (i + 1 < text.length())) { if (text.charAt(i + 1) != ' ') { if ((text.charAt(i + 1) != '\'') || (i <= 0) || (text.charAt(i - 1) != '\'')) { return i; } } } } while (i >= 0); return -1; } } /* Location: * Qualified Name: com.sun.tools.visualvm.modules.startup.Utils * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.modules.startup; import java.io.PrintStream; import java.text.MessageFormat; import java.util.Properties; import java.util.ResourceBundle; import javax.swing.JDialog; import org.openide.LifecycleManager; import org.openide.modules.ModuleInstall; import org.openide.util.NbBundle; final class VisualVMStartup extends ModuleInstall { private static final boolean DISABLE_STARTUP_CHECK = Boolean.getBoolean("com.sun.tools.visualvm.modules.startup.DisableStartupCheck"); private static final ResourceBundle bundle = NbBundle.getBundle(VisualVMStartup.class); private static final String ERROR_STARTUP_CAPTION = bundle.getString("VisualVMStartup_ErrorStartupCaption"); private static final String INCORRECT_VERSION_MSG = bundle.getString("VisualVMStartup_IncorrectVersionMsg"); private static final String JRE_MSG = bundle.getString("VisualVMStartup_JreMsg"); private static boolean envChecked = false; public void validate() { if (!checkEnv()) { LifecycleManager.getDefault().exit(); } } static synchronized boolean checkEnv() { if (envChecked) { return true; } envChecked = true; if (DISABLE_STARTUP_CHECK) { System.err.println("Starting with com.sun.tools.visualvm.modules.startup.DisableStartupCheck=true"); } else { if (!isJava6or7()) { displayError6or7(); return false; } if (!isJDK()) { displayErrorJRE(); return false; } } return true; } private static void displayError6or7() { Utils.setSystemLaF(); JDialog d = Utils.assertiveErrorDialog(ERROR_STARTUP_CAPTION, MessageFormat.format(INCORRECT_VERSION_MSG, new Object[] { System.getProperty("java.specification.version"), getJavaInfo(), getJvmInfo(), System.getProperties().getProperty("java.home", "unknown location") })); d.setVisible(true); } private static void displayErrorJRE() { Utils.setSystemLaF(); JDialog d = Utils.assertiveErrorDialog(ERROR_STARTUP_CAPTION, MessageFormat.format(JRE_MSG, new Object[] { getJavaInfo(), getJvmInfo(), System.getProperties().getProperty("java.home", "unknown location") })); d.setVisible(true); } private static boolean isJava6or7() { String javaVersion = System.getProperty("java.specification.version"); if (javaVersion == null) { return false; } return (javaVersion.startsWith("1.6")) || (javaVersion.startsWith("1.7")); } private static boolean isJDK() { Class vmClass = null; try { vmClass = Class.forName("com.sun.tools.attach.VirtualMachine"); } catch (ClassNotFoundException ex) {} return vmClass != null; } private static String getJavaInfo() { Properties systemProperties = System.getProperties(); String javaVersion = systemProperties.getProperty("java.version", "unknown version"); String vendorInfo = systemProperties.getProperty("java.vendor", "unknown vendor"); return javaVersion + "; " + vendorInfo; } private static String getJvmInfo() { Properties systemProperties = System.getProperties(); String vmName = systemProperties.getProperty("java.vm.name", "unknown name"); String vmVerison = systemProperties.getProperty("java.vm.version", ""); String vmInfo = systemProperties.getProperty("java.vm.info", ""); return vmName + " (" + vmVerison + ", " + vmInfo + ")"; } } /* Location: * Qualified Name: com.sun.tools.visualvm.modules.startup.VisualVMStartup * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|