![]() |
![]() |
com-sun-tools-visualvm-profiler16:33:58.984 INFO jd.cli.Main - Decompiling com-sun-tools-visualvm-profiler.jar package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.application.Application; import com.sun.tools.visualvm.profiling.presets.PresetSelector; class ApplicationProfilerView$1 extends CPUSettingsSupport { ApplicationProfilerView$1(ApplicationProfilerView paramApplicationProfilerView, Application paramApplication) {} public boolean presetValid() { return (ApplicationProfilerView.access$000(this$0).settingsValid()) && (ApplicationProfilerView.access$100(this$0).settingsValid()); } public PresetSelector createSelector(Runnable presetSynchronizer) { return ApplicationProfilerView.access$200(this$0, presetSynchronizer, val$application); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.application.Application; import com.sun.tools.visualvm.profiling.presets.PresetSelector; class ApplicationProfilerView$2 extends MemorySettingsSupport { ApplicationProfilerView$2(ApplicationProfilerView paramApplicationProfilerView, Application paramApplication) {} public boolean presetValid() { return (ApplicationProfilerView.access$000(this$0).settingsValid()) && (ApplicationProfilerView.access$100(this$0).settingsValid()); } public PresetSelector createSelector(Runnable presetSynchronizer) { return ApplicationProfilerView.access$200(this$0, presetSynchronizer, val$application); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.2 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.uisupport.HTMLLabel; import org.openide.util.NbBundle; class ApplicationProfilerView$MasterViewSupport$1 implements Runnable { ApplicationProfilerView$MasterViewSupport$1(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() { ApplicationProfilerView.MasterViewSupport.access$300(this$0); ApplicationProfilerView.MasterViewSupport.access$400(this$0); ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_application_terminated")); ApplicationProfilerView.MasterViewSupport.access$600(this$0); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; class ApplicationProfilerView$MasterViewSupport$10$1 implements Runnable { ApplicationProfilerView$MasterViewSupport$10$1(ApplicationProfilerView.MasterViewSupport.10 param10) {} public void run() { ApplicationProfilerView.MasterViewSupport.access$1100(this$1.this$0); ApplicationProfilerView.MasterViewSupport.access$600(this$1.this$0); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.10.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.application.Application; import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor; import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory; import com.sun.tools.visualvm.uisupport.HTMLLabel; import javax.swing.Timer; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; class ApplicationProfilerView$MasterViewSupport$10 implements Runnable { ApplicationProfilerView$MasterViewSupport$10(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport, Application paramApplication) {} public void run() { switch (ApplicationProfilerView.MasterViewSupport.access$1200(this$0)) { case 1: ProfilerSupport.getInstance().setProfiledApplication(null); ApplicationProfilerView.MasterViewSupport.access$1302(this$0, -1); if (!ApplicationProfilerView.MasterViewSupport.access$1400(this$0)) { ApplicationProfilerView.MasterViewSupport.access$1500(this$0).stop(); ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_inactive")); ApplicationProfilerView.MasterViewSupport.access$300(this$0); RequestProcessor.getDefault().post(new Runnable() { public void run() { ApplicationProfilerView.MasterViewSupport.access$1100(this$0); ApplicationProfilerView.MasterViewSupport.access$600(this$0); } }, 500); } break; case 2: ApplicationProfilerView.MasterViewSupport.access$1500(this$0).stop(); ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_started")); break; case 8: ApplicationProfilerView.MasterViewSupport.access$1500(this$0).stop(); ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_paused")); break; case 128: ApplicationProfilerView.MasterViewSupport.access$1500(this$0).stop(); ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_refreshing")); ApplicationProfilerView.MasterViewSupport.access$400(this$0); ApplicationProfilerView.MasterViewSupport.access$1600(this$0); break; case 4: if (ApplicationProfilerView.MasterViewSupport.access$800(this$0).equals(val$profiledApplication)) { ApplicationProfilerView.MasterViewSupport.access$1700(this$0); ApplicationProfilerView.MasterViewSupport.access$1500(this$0).start(); ApplicationProfilerView.MasterViewSupport.access$1100(this$0); ApplicationProfilerView.MasterViewSupport.access$1800(this$0); ApplicationProfilerView.MasterViewSupport.access$1600(this$0); ApplicationProfilerView.MasterViewSupport.access$2000(this$0).setProfilingResultsDisplay(ApplicationProfilerView.MasterViewSupport.access$1900()); } else { ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_of") + DataSourceDescriptorFactory.getDescriptor(val$profiledApplication).getName() + NbBundle.getMessage(ApplicationProfilerView.class, "MSG_in_progress")); ApplicationProfilerView.MasterViewSupport.access$400(this$0); ApplicationProfilerView.MasterViewSupport.access$2000(this$0).setProfilingResultsDisplay(null); } ApplicationProfilerView.MasterViewSupport.access$2000(this$0).revalidate(); ApplicationProfilerView.MasterViewSupport.access$2000(this$0).repaint(); this$0.revalidate(); this$0.repaint(); break; case 16: ApplicationProfilerView.MasterViewSupport.access$1500(this$0).stop(); ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_stopped")); } } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.10 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.core.ui.DesktopUtils; import com.sun.tools.visualvm.uisupport.HTMLTextArea; import java.net.URL; class ApplicationProfilerView$MasterViewSupport$11 extends HTMLTextArea { ApplicationProfilerView$MasterViewSupport$11(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} protected void showURL(URL url) { try { DesktopUtils.browse(url.toURI()); } catch (Exception e) {} } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.11 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; class ApplicationProfilerView$MasterViewSupport$12 implements ActionListener { ApplicationProfilerView$MasterViewSupport$12(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void actionPerformed(ActionEvent e) { ApplicationProfilerView.MasterViewSupport.access$2100(this$0); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.12 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; class ApplicationProfilerView$MasterViewSupport$13 implements ActionListener { ApplicationProfilerView$MasterViewSupport$13(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void actionPerformed(ActionEvent e) { ApplicationProfilerView.MasterViewSupport.access$2200(this$0); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.13 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; class ApplicationProfilerView$MasterViewSupport$14 implements ActionListener { ApplicationProfilerView$MasterViewSupport$14(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void actionPerformed(ActionEvent e) { ApplicationProfilerView.MasterViewSupport.access$2300(this$0); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.14 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.uisupport.HTMLLabel; import java.awt.Dimension; import java.net.URL; class ApplicationProfilerView$MasterViewSupport$15 extends HTMLLabel { ApplicationProfilerView$MasterViewSupport$15(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void setText(String text) { super.setText("<nobr>" + text + "</nobr>"); } protected void showURL(URL url) { ProfilerSupport.getInstance().selectActiveProfilerView(); } public Dimension getPreferredSize() { return new Dimension(getPreferredSizewidth, ApplicationProfilerView.MasterViewSupport.access$2400()); } public Dimension getMinimumSize() { return getPreferredSize(); } public Dimension getMaximumSize() { return getPreferredSize(); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.15 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import org.netbeans.modules.profiler.NetBeansProfiler; class ApplicationProfilerView$MasterViewSupport$2 implements Runnable { ApplicationProfilerView$MasterViewSupport$2(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() { NetBeansProfiler.getDefaultNB().modifyCurrentProfiling(ApplicationProfilerView.MasterViewSupport.access$700(this$0).getSettings()); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.2 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; class ApplicationProfilerView$MasterViewSupport$3 implements Runnable { ApplicationProfilerView$MasterViewSupport$3(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() { ApplicationProfilerView.MasterViewSupport.access$900(this$0, ApplicationProfilerView.MasterViewSupport.access$800(this$0), ApplicationProfilerView.MasterViewSupport.access$700(this$0).getSettings()); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.3 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import org.netbeans.modules.profiler.NetBeansProfiler; class ApplicationProfilerView$MasterViewSupport$4 implements Runnable { ApplicationProfilerView$MasterViewSupport$4(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() { NetBeansProfiler.getDefaultNB().modifyCurrentProfiling(ApplicationProfilerView.MasterViewSupport.access$1000(this$0).getSettings()); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.4 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; class ApplicationProfilerView$MasterViewSupport$5 implements Runnable { ApplicationProfilerView$MasterViewSupport$5(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() { ApplicationProfilerView.MasterViewSupport.access$900(this$0, ApplicationProfilerView.MasterViewSupport.access$800(this$0), ApplicationProfilerView.MasterViewSupport.access$1000(this$0).getSettings()); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.5 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.uisupport.HTMLLabel; import org.openide.util.NbBundle; class ApplicationProfilerView$MasterViewSupport$6$1 implements Runnable { ApplicationProfilerView$MasterViewSupport$6$1(ApplicationProfilerView.MasterViewSupport.6 param6) {} public void run() { ApplicationProfilerView.MasterViewSupport.access$500(this$1.this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_calibration_progress")); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.6.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.uisupport.HTMLLabel; import javax.swing.SwingUtilities; import org.openide.util.NbBundle; class ApplicationProfilerView$MasterViewSupport$6 implements Runnable { ApplicationProfilerView$MasterViewSupport$6(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_calibration_progress")); } }); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.6 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; class ApplicationProfilerView$MasterViewSupport$7 implements Runnable { ApplicationProfilerView$MasterViewSupport$7(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() {} } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.7 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.uisupport.HTMLLabel; import org.openide.util.NbBundle; class ApplicationProfilerView$MasterViewSupport$8 implements Runnable { ApplicationProfilerView$MasterViewSupport$8(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() { ProfilerSupport.getInstance().setProfiledApplication(null); ApplicationProfilerView.MasterViewSupport.access$500(this$0).setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_inactive")); ApplicationProfilerView.MasterViewSupport.access$300(this$0); ApplicationProfilerView.MasterViewSupport.access$1100(this$0); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.8 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import org.netbeans.modules.profiler.NetBeansProfiler; class ApplicationProfilerView$MasterViewSupport$9 implements Runnable { ApplicationProfilerView$MasterViewSupport$9(ApplicationProfilerView.MasterViewSupport paramMasterViewSupport) {} public void run() { ProfilerSupport.getInstance().setProfiledApplication(null); NetBeansProfiler.getDefaultNB().detachFromApp(); } } /* Location: * Qualified Name: com.sun.tools.visualvm.profiler.ApplicationProfilerView.MasterViewSupport.9 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package com.sun.tools.visualvm.profiler; import com.sun.tools.visualvm.application.Application; import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptor; import com.sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory; import com.sun.tools.visualvm.core.datasupport.DataRemovedListener; import com.sun.tools.visualvm.core.ui.DesktopUtils; import com.sun.tools.visualvm.core.ui.components.DataViewComponent.MasterView; import com.sun.tools.visualvm.uisupport.HTMLLabel; import com.sun.tools.visualvm.uisupport.HTMLTextArea; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.net.URL; import java.text.MessageFormat; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JToggleButton; import javax.swing.JToolBar; import javax.swing.SwingUtilities; import javax.swing.Timer; import org.netbeans.lib.profiler.TargetAppRunner; import org.netbeans.lib.profiler.common.AttachSettings; import org.netbeans.lib.profiler.common.ProfilingSettings; import org.netbeans.lib.profiler.common.event.ProfilingStateEvent; import org.netbeans.lib.profiler.common.event.ProfilingStateListener; import org.netbeans.lib.profiler.global.ProfilingSessionStatus; import org.netbeans.modules.profiler.LiveResultsWindow; import org.netbeans.modules.profiler.NetBeansProfiler; import org.netbeans.modules.profiler.utils.IDEUtils; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; import org.openide.util.WeakListeners; class ApplicationProfilerView$MasterViewSupport extends JPanel implements ProfilingStateListener, DataRemovedListener<Application>, ActionListener, PropertyChangeListener { private Application application; private ProfilingResultsSupport profilingResultsView; private CPUSettingsSupport cpuSettingsSupport; private MemorySettingsSupport memorySettingsSupport; private AttachSettings attachSettings; private Timer timer; private int lastInstrValue = -1; private int state = -1; private boolean internalChange = false; private boolean applicationTerminated = false; private boolean classSharingBreaksProfiling; private HTMLTextArea classShareWarningArea; private JLabel modeLabel; private JToggleButton cpuButton; private JToggleButton memoryButton; private JButton stopButton; private JLabel statusLabel; private HTMLLabel statusValueLabel; public ApplicationProfilerView$MasterViewSupport(Application application, ProfilingResultsSupport profilingResultsView, CPUSettingsSupport cpuSettingsSupport, MemorySettingsSupport memorySettingsSupport, boolean classSharingBreaksProfiling) { this.application = application; this.profilingResultsView = profilingResultsView; this.cpuSettingsSupport = cpuSettingsSupport; this.memorySettingsSupport = memorySettingsSupport; this.classSharingBreaksProfiling = classSharingBreaksProfiling; initComponents(); initSettings(); refreshStatus(); timer = new Timer(1000, this); timer.setInitialDelay(1000); NetBeansProfiler.getDefaultNB().addProfilingStateListener(this); application.notifyWhenRemoved(this); application.addPropertyChangeListener("prop_state", WeakListeners.propertyChange(this, application)); } public DataViewComponent.MasterView getMasterView() { return new DataViewComponent.MasterView(NbBundle.getMessage(ApplicationProfilerView.class, "LBL_Profiler"), null, this); } public synchronized void dataRemoved(Application application) { applicationTerminated = true; timer.stop(); timer.removeActionListener(this); NetBeansProfiler.getDefaultNB().removeProfilingStateListener(this); ProfilerSupport.getInstance().setProfiledApplication(null); lastInstrValue = -1; SwingUtilities.invokeLater(new Runnable() { public void run() { ApplicationProfilerView.MasterViewSupport.this.resetControlButtons(); ApplicationProfilerView.MasterViewSupport.this.disableControlButtons(); statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_application_terminated")); ApplicationProfilerView.MasterViewSupport.this.enableSettings(); } }); } public void propertyChange(PropertyChangeEvent evt) { dataRemoved(application); } public void viewRemoved() { timer.stop(); timer.removeActionListener(this); NetBeansProfiler.getDefaultNB().removeProfilingStateListener(this); } public void actionPerformed(ActionEvent e) { updateRunningText(); } private static JComponent getLiveResultsView() { JComponent view = LiveResultsWindow.getDefault(); Component[] components = view.getComponents(); if ((components.length > 0) && ((components[0] instanceof JToolBar))) { JToolBar toolbar = (JToolBar)components[0]; toolbar.setOpaque(false); components = toolbar.getComponents(); for (int i = 0; i < components.length; i++) { Component component = components[i]; if ((component instanceof AbstractButton)) { ((AbstractButton)component).setOpaque(false); if (i == 5) { ((AbstractButton)component).setText(NbBundle.getMessage(ApplicationProfilerView.class, "LBL_Snapshot")); } } } } view.setPreferredSize(new Dimension(1, 1)); return view; } private void handleCPUProfiling() { if (internalChange) { return; } if (cpuButton.isSelected()) { internalChange = true; memoryButton.setSelected(false); internalChange = false; if (!cpuSettingsSupport.settingsValid()) { internalChange = true; cpuButton.setSelected(false); internalChange = false; NetBeansProfiler.getDefaultNB().displayError(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_Incorrect_CPU_settings")); } else { cpuSettingsSupport.saveSettings(); if (NetBeansProfiler.getDefaultNB().getProfilingState() == 4) { IDEUtils.runInProfilerRequestProcessor(new Runnable() { public void run() { NetBeansProfiler.getDefaultNB().modifyCurrentProfiling(cpuSettingsSupport.getSettings()); } }); } else { disableControlButtons(); ProfilerSupport.getInstance().setProfiledApplication(application); IDEUtils.runInProfilerRequestProcessor(new Runnable() { public void run() { ApplicationProfilerView.MasterViewSupport.this.startProfiling(application, cpuSettingsSupport.getSettings()); } }); } } } } private void handleMemoryProfiling() { if (internalChange) { return; } if (memoryButton.isSelected()) { internalChange = true; cpuButton.setSelected(false); internalChange = false; memorySettingsSupport.saveSettings(); if (NetBeansProfiler.getDefaultNB().getProfilingState() == 4) { IDEUtils.runInProfilerRequestProcessor(new Runnable() { public void run() { NetBeansProfiler.getDefaultNB().modifyCurrentProfiling(memorySettingsSupport.getSettings()); } }); } else { disableControlButtons(); ProfilerSupport.getInstance().setProfiledApplication(application); IDEUtils.runInProfilerRequestProcessor(new Runnable() { public void run() { ApplicationProfilerView.MasterViewSupport.this.startProfiling(application, memorySettingsSupport.getSettings()); } }); } } } private void startProfiling(Application application, ProfilingSettings pSettings) { Runnable calibrationStartUpdater = new Runnable() { public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_calibration_progress")); } }); } }; Runnable calibrationEndUpdater = new Runnable() { public void run() {} }; if (ProfilerSupport.getInstance().checkJDKCalibration(application, calibrationStartUpdater, calibrationEndUpdater)) { NetBeansProfiler.getDefaultNB().attachToApp(pSettings, attachSettings); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { ProfilerSupport.getInstance().setProfiledApplication(null); statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_inactive")); ApplicationProfilerView.MasterViewSupport.this.resetControlButtons(); ApplicationProfilerView.MasterViewSupport.this.enableControlButtons(); } }); } } private void handleStopProfiling() { if (internalChange) { return; } disableControlButtons(); IDEUtils.runInProfilerRequestProcessor(new Runnable() { public void run() { ProfilerSupport.getInstance().setProfiledApplication(null); NetBeansProfiler.getDefaultNB().detachFromApp(); } }); } public void profilingStateChanged(ProfilingStateEvent e) { refreshStatus(); } public void threadsMonitoringChanged() { refreshStatus(); } public void instrumentationChanged(int oldInstrType, int currentInstrType) { refreshStatus(); } private synchronized void refreshStatus() { int newState = NetBeansProfiler.getDefaultNB().getProfilingState(); final Application profiledApplication = ProfilerSupport.getInstance().getProfiledApplication(); if (state != newState) { state = newState; SwingUtilities.invokeLater(new Runnable() { public void run() { switch (state) { case 1: ProfilerSupport.getInstance().setProfiledApplication(null); lastInstrValue = -1; if (!applicationTerminated) { timer.stop(); statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_inactive")); ApplicationProfilerView.MasterViewSupport.this.resetControlButtons(); RequestProcessor.getDefault().post(new Runnable() { public void run() { ApplicationProfilerView.MasterViewSupport.this.enableControlButtons(); ApplicationProfilerView.MasterViewSupport.this.enableSettings(); } }, 500); } break; case 2: timer.stop(); statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_started")); break; case 8: timer.stop(); statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_paused")); break; case 128: timer.stop(); statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_refreshing")); ApplicationProfilerView.MasterViewSupport.this.disableControlButtons(); ApplicationProfilerView.MasterViewSupport.this.disableSettings(); break; case 4: if (application.equals(profiledApplication)) { ApplicationProfilerView.MasterViewSupport.this.updateRunningText(); timer.start(); ApplicationProfilerView.MasterViewSupport.this.enableControlButtons(); ApplicationProfilerView.MasterViewSupport.this.updateControlButtons(); ApplicationProfilerView.MasterViewSupport.this.disableSettings(); profilingResultsView.setProfilingResultsDisplay(ApplicationProfilerView.MasterViewSupport.access$1900()); } else { statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_of") + DataSourceDescriptorFactory.getDescriptor(profiledApplication).getName() + NbBundle.getMessage(ApplicationProfilerView.class, "MSG_in_progress")); ApplicationProfilerView.MasterViewSupport.this.disableControlButtons(); profilingResultsView.setProfilingResultsDisplay(null); } profilingResultsView.revalidate(); profilingResultsView.repaint(); revalidate(); repaint(); break; case 16: timer.stop(); statusValueLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_stopped")); } } }); } } private void updateRunningText() { ProfilingSettings currentSettings = NetBeansProfiler.getDefaultNB().getLastProfilingSettings(); int currentProfilingType = currentSettings != null ? currentSettings.getProfilingType() : Integer.MIN_VALUE; if (cpuSettingsSupport.getSettings().getProfilingType() == currentProfilingType) { int instrValue = TargetAppRunner.getDefault().getProfilingSessionStatus().getNInstrMethods(); if (lastInstrValue != instrValue) { statusValueLabel.setText(MessageFormat.format(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_running_methods"), new Object[] { Integer.valueOf(instrValue) })); } lastInstrValue = instrValue; } else if (memorySettingsSupport.getSettings().getProfilingType() == currentProfilingType) { int instrValue = TargetAppRunner.getDefault().getProfilingSessionStatus().getNInstrClasses(); if (lastInstrValue != instrValue) { int allocEvery = currentSettings.getAllocTrackEvery(); switch (allocEvery) { case 1: statusValueLabel.setText(MessageFormat.format(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_running_classes_1"), new Object[] { Integer.valueOf(instrValue), Integer.valueOf(allocEvery) })); break; case 2: statusValueLabel.setText(MessageFormat.format(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_running_classes_2"), new Object[] { Integer.valueOf(instrValue), Integer.valueOf(allocEvery) })); break; case 3: statusValueLabel.setText(MessageFormat.format(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_running_classes_3"), new Object[] { Integer.valueOf(instrValue), Integer.valueOf(allocEvery) })); break; default: statusValueLabel.setText(MessageFormat.format(NbBundle.getMessage(ApplicationProfilerView.class, "MSG_profiling_running_classes_N"), new Object[] { Integer.valueOf(instrValue), Integer.valueOf(allocEvery) })); } } lastInstrValue = instrValue; } } private void enableSettings() { cpuSettingsSupport.setEnabled(true); memorySettingsSupport.setEnabled(true); } private void disableSettings() { cpuSettingsSupport.setEnabled(false); memorySettingsSupport.setEnabled(false); } private void resetControlButtons() { internalChange = true; cpuButton.setSelected(false); memoryButton.setSelected(false); internalChange = false; } private void updateControlButtons() { ProfilingSettings currentSettings = NetBeansProfiler.getDefaultNB().getLastProfilingSettings(); int currentProfilingType = currentSettings != null ? currentSettings.getProfilingType() : Integer.MIN_VALUE; if ((cpuSettingsSupport.getSettings().getProfilingType() == currentProfilingType) && (!cpuButton.isSelected())) { internalChange = true; cpuButton.setSelected(true); memoryButton.setSelected(false); internalChange = false; } else if ((memorySettingsSupport.getSettings().getProfilingType() == currentProfilingType) && (!memoryButton.isSelected())) { internalChange = true; cpuButton.setSelected(false); memoryButton.setSelected(true); internalChange = false; } } private void enableControlButtons() { boolean enabled = application.getState() == 1; cpuButton.setEnabled(enabled); memoryButton.setEnabled(enabled); stopButton.setEnabled(NetBeansProfiler.getDefaultNB().getTargetAppRunner().targetAppIsRunning()); } private void disableControlButtons() { cpuButton.setEnabled(false); memoryButton.setEnabled(false); stopButton.setEnabled(false); } private void initSettings() { attachSettings = new AttachSettings(); attachSettings.setDirect(false); attachSettings.setDynamic16(true); attachSettings.setPid(application.getPid()); } private void initComponents() { setLayout(new BorderLayout()); JPanel controlPanel = new JPanel(); controlPanel.setOpaque(false); controlPanel.setLayout(new GridBagLayout()); controlPanel.setBorder(BorderFactory.createEmptyBorder(6, 0, 3, 0)); classShareWarningArea = new HTMLTextArea() { protected void showURL(URL url) { try { DesktopUtils.browse(url.toURI()); } catch (Exception e) {} } }; classShareWarningArea.setOpaque(true); classShareWarningArea.setBackground(new Color(255, 180, 180)); classShareWarningArea.setForeground(new Color(0, 0, 0)); classShareWarningArea.setBorder(BorderFactory.createLineBorder(new Color(180, 180, 180))); classShareWarningArea.setBorder(BorderFactory.createCompoundBorder(classShareWarningArea.getBorder(), BorderFactory.createMatteBorder(5, 5, 5, 5, classShareWarningArea.getBackground()))); classShareWarningArea.setVisible(classSharingBreaksProfiling); if (classSharingBreaksProfiling) { String link; String link; if (DesktopUtils.isBrowseAvailable()) { link = NbBundle.getMessage(ApplicationProfilerView.class, "MSG_Class_Sharing_Link"); } else { link = NbBundle.getMessage(ApplicationProfilerView.class, "MSG_Class_Sharing_Nolink"); } String message = NbBundle.getMessage(ApplicationProfilerView.class, "MSG_Class_Sharing", link); classShareWarningArea.setText(message); } GridBagConstraints constraints = new GridBagConstraints(); gridx = 0; gridy = 1; gridwidth = 0; fill = 2; anchor = 17; insets = new Insets(4, 8, 10, 8); controlPanel.add(classShareWarningArea, constraints); modeLabel = new JLabel(NbBundle.getMessage(ApplicationProfilerView.class, "LBL_Sample")); modeLabel.setFont(modeLabel.getFont().deriveFont(1)); Dimension d = modeLabel.getPreferredSize(); modeLabel.setText(NbBundle.getMessage(ApplicationProfilerView.class, "LBL_Profile")); width = Math.max(width, modeLabel.getPreferredSize().width); modeLabel.setPreferredSize(d); modeLabel.setOpaque(false); constraints = new GridBagConstraints(); gridx = 0; gridy = 2; gridwidth = 1; fill = 0; anchor = 17; insets = new Insets(4, 8, 0, 0); controlPanel.add(modeLabel, constraints); cpuButton = new ApplicationProfilerView.OneWayToggleButton(NbBundle.getMessage(ApplicationProfilerView.class, "LBL_Cpu")); cpuButton.setIcon(new ImageIcon(ImageUtilities.loadImage("com/sun/tools/visualvm/profiler/resources/cpu.png", true))); cpuButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ApplicationProfilerView.MasterViewSupport.this.handleCPUProfiling(); } }); constraints = new GridBagConstraints(); gridx = 2; gridy = 2; gridwidth = 1; fill = 0; anchor = 17; insets = new Insets(4, 8, 0, 0); controlPanel.add(cpuButton, constraints); memoryButton = new ApplicationProfilerView.OneWayToggleButton(NbBundle.getMessage(ApplicationProfilerView.class, "LBL_Memory")); memoryButton.setIcon(new ImageIcon(ImageUtilities.loadImage("com/sun/tools/visualvm/profiler/resources/memory.png", true))); memoryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ApplicationProfilerView.MasterViewSupport.this.handleMemoryProfiling(); } }); constraints = new GridBagConstraints(); gridx = 3; gridy = 2; gridwidth = 1; fill = 0; anchor = 17; insets = new Insets(4, 8, 0, 0); controlPanel.add(memoryButton, constraints); stopButton = new JButton(NbBundle.getMessage(ApplicationProfilerView.class, "LBL_Stop")); stopButton.setIcon(new ImageIcon(ImageUtilities.loadImage("com/sun/tools/visualvm/profiler/resources/stop.png", true))); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ApplicationProfilerView.MasterViewSupport.this.handleStopProfiling(); } }); stopButton.setEnabled(false); stopButton.setDefaultCapable(false); constraints = new GridBagConstraints(); gridx = 4; gridy = 2; gridwidth = 1; fill = 0; anchor = 17; insets = new Insets(4, 8, 0, 0); controlPanel.add(stopButton, constraints); JPanel filler1 = new JPanel(new BorderLayout()); filler1.setOpaque(false); constraints = new GridBagConstraints(); gridx = 5; gridy = 2; weightx = 1.0D; weighty = 1.0D; gridwidth = 0; fill = 1; anchor = 18; insets = new Insets(0, 0, 0, 0); controlPanel.add(filler1, constraints); statusLabel = new JLabel(NbBundle.getMessage(ApplicationProfilerView.class, "LBL_Status")); statusLabel.setFont(statusLabel.getFont().deriveFont(1)); statusLabel.setOpaque(false); constraints = new GridBagConstraints(); gridx = 0; gridy = 3; gridwidth = 1; fill = 0; anchor = 17; insets = new Insets(6, 8, 4, 0); controlPanel.add(statusLabel, constraints); statusValueLabel = new HTMLLabel() { public void setText(String text) { super.setText("<nobr>" + text + "</nobr>"); } protected voi 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
|