Source Code Cross Referenced for ProfilerOptionsPanel.java in  » IDE-Netbeans » profiler » org » netbeans » modules » profiler » ui » panels » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » profiler » org.netbeans.modules.profiler.ui.panels 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         * The Original Software is NetBeans. The Initial Developer of the Original
0026:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
0027:         * Microsystems, Inc. All Rights Reserved.
0028:         *
0029:         * If you wish your version of this file to be governed by only the CDDL
0030:         * or only the GPL Version 2, indicate your decision by adding
0031:         * "[Contributor] elects to include this software in this distribution
0032:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0033:         * single choice of license, a recipient has the option to distribute
0034:         * your version of this file under either the CDDL, the GPL Version 2 or
0035:         * to extend the choice of license to its licensees as provided above.
0036:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0037:         * Version 2 license, then the option applies only if the new code is
0038:         * made subject to such option by the copyright holder.
0039:         */
0040:
0041:        package org.netbeans.modules.profiler.ui.panels;
0042:
0043:        import org.netbeans.api.java.platform.JavaPlatform;
0044:        import org.netbeans.api.java.platform.PlatformsCustomizer;
0045:        import org.netbeans.lib.profiler.ui.components.JExtendedSpinner;
0046:        import org.netbeans.modules.profiler.ProfilerIDESettings;
0047:        import org.netbeans.modules.profiler.actions.JavaPlatformSelector;
0048:        import org.openide.util.NbBundle;
0049:        import java.awt.*;
0050:        import java.awt.event.ActionEvent;
0051:        import java.awt.event.ActionListener;
0052:        import java.awt.event.ItemEvent;
0053:        import java.awt.event.ItemListener;
0054:        import java.awt.event.MouseAdapter;
0055:        import java.awt.event.MouseEvent;
0056:        import java.util.ArrayList;
0057:        import java.util.Iterator;
0058:        import javax.swing.*;
0059:
0060:        /**
0061:         * A panel used to edit the global settings of the profiler.
0062:         *
0063:         * @author Ian Formanek
0064:         * @author Jiri Sedlacek
0065:         */
0066:        public final class ProfilerOptionsPanel extends JPanel implements 
0067:                ActionListener, Scrollable {
0068:            //~ Inner Classes ------------------------------------------------------------------------------------------------------------
0069:
0070:            private static class CategorySeparator extends JPanel {
0071:                //~ Instance fields ------------------------------------------------------------------------------------------------------
0072:
0073:                private JLabel captionLabel;
0074:                private JSeparator captionSeparator;
0075:
0076:                //~ Constructors ---------------------------------------------------------------------------------------------------------
0077:
0078:                public CategorySeparator(String caption) {
0079:                    initComponents();
0080:                    captionLabel.setText(caption);
0081:                }
0082:
0083:                //~ Methods --------------------------------------------------------------------------------------------------------------
0084:
0085:                private void initComponents() {
0086:                    setLayout(new GridBagLayout());
0087:
0088:                    GridBagConstraints constraints;
0089:
0090:                    // captionLabel
0091:                    captionLabel = new JLabel();
0092:                    constraints = new GridBagConstraints();
0093:                    constraints.gridx = 0;
0094:                    constraints.gridy = 0;
0095:                    constraints.anchor = GridBagConstraints.WEST;
0096:                    constraints.fill = GridBagConstraints.NONE;
0097:                    constraints.insets = new Insets(0, 0, 0, 0);
0098:                    add(captionLabel, constraints);
0099:
0100:                    // captionSeparator
0101:                    captionSeparator = new JSeparator();
0102:                    constraints = new GridBagConstraints();
0103:                    constraints.gridx = 1;
0104:                    constraints.gridy = 0;
0105:                    constraints.weightx = 1;
0106:                    constraints.weighty = 1;
0107:                    constraints.anchor = GridBagConstraints.CENTER;
0108:                    constraints.fill = GridBagConstraints.HORIZONTAL;
0109:                    constraints.insets = new Insets(0, 4, 0, 0);
0110:                    add(captionSeparator, constraints);
0111:                }
0112:            }
0113:
0114:            //~ Static fields/initializers -----------------------------------------------------------------------------------------------
0115:
0116:            // -----
0117:            // I18N String constants
0118:            private static final String USE_PROJECT_JVM_TEXT = NbBundle
0119:                    .getMessage(ProfilerOptionsPanel.class,
0120:                            "ProfilerOptionsPanel_UseProjectJvmText"); //NOI18N
0121:            private static final String KEY_OPEN_ALWAYS = NbBundle.getMessage(
0122:                    ProfilerOptionsPanel.class,
0123:                    "ProfilerOptionsPanel_KeyOpenAlways"); //NOI18N
0124:            private static final String KEY_OPEN_MONITORING = NbBundle
0125:                    .getMessage(ProfilerOptionsPanel.class,
0126:                            "ProfilerOptionsPanel_KeyOpenMonitoring"); //NOI18N
0127:            private static final String KEY_OPEN_NEVER = NbBundle.getMessage(
0128:                    ProfilerOptionsPanel.class,
0129:                    "ProfilerOptionsPanel_KeyOpenNever"); //NOI18N
0130:            private static final String ENGINE_SETTINGS_BORDER_TEXT = NbBundle
0131:                    .getMessage(ProfilerOptionsPanel.class,
0132:                            "ProfilerOptionsPanel_EngineSettingsBorderText"); //NOI18N
0133:            private static final String JAVA_PLATFORM_LABEL_TEXT = NbBundle
0134:                    .getMessage(ProfilerOptionsPanel.class,
0135:                            "ProfilerOptionsPanel_JavaPlatformLabelText"); //NOI18N
0136:            private static final String MANAGE_PLATFORMS_BUTTON_NAME = NbBundle
0137:                    .getMessage(ProfilerOptionsPanel.class,
0138:                            "ProfilerOptionsPanel_ManagePlatformsButtonName"); //NOI18N
0139:            private static final String COMM_PORT_LABEL_TEXT = NbBundle
0140:                    .getMessage(ProfilerOptionsPanel.class,
0141:                            "ProfilerOptionsPanel_CommPortLabelText"); //NOI18N
0142:            private static final String WINDOWS_SETTINGS_BORDER_TEXT = NbBundle
0143:                    .getMessage(ProfilerOptionsPanel.class,
0144:                            "ProfilerOptionsPanel_WindowsSettingsBorderText"); //NOI18N
0145:            private static final String TELEMETRY_OVERVIEW_LABEL_TEXT = NbBundle
0146:                    .getMessage(ProfilerOptionsPanel.class,
0147:                            "ProfilerOptionsPanel_TelemetryOverviewLabelText"); //NOI18N
0148:            private static final String THREADS_VIEW_LABEL_TEXT = NbBundle
0149:                    .getMessage(ProfilerOptionsPanel.class,
0150:                            "ProfilerOptionsPanel_ThreadsViewLabelText"); //NOI18N
0151:            private static final String THREADS_VIEW_HINT_TEXT = NbBundle
0152:                    .getMessage(ProfilerOptionsPanel.class,
0153:                            "ProfilerOptionsPanel_ThreadsViewHintText"); //NOI18N
0154:            private static final String LIVE_RESULTS_LABEL_TEXT = NbBundle
0155:                    .getMessage(ProfilerOptionsPanel.class,
0156:                            "ProfilerOptionsPanel_LiveResultsLabelText"); //NOI18N
0157:            private static final String CPU_CHCKBOX_TEXT = NbBundle.getMessage(
0158:                    ProfilerOptionsPanel.class,
0159:                    "ProfilerOptionsPanel_CpuChckBoxText"); //NOI18N
0160:            private static final String MEMORY_CHCKBOX_TEXT = NbBundle
0161:                    .getMessage(ProfilerOptionsPanel.class,
0162:                            "ProfilerOptionsPanel_MemoryChckBoxText"); //NOI18N
0163:            private static final String SNAPSHOTS_SETTINGS_BORDER_TEXT = NbBundle
0164:                    .getMessage(ProfilerOptionsPanel.class,
0165:                            "ProfilerOptionsPanel_SnapshotsSettingsBorderText"); //NOI18N
0166:            private static final String OPEN_SNAPSHOT_RADIO_TEXT = NbBundle
0167:                    .getMessage(ProfilerOptionsPanel.class,
0168:                            "ProfilerOptionsPanel_OpenSnapshotRadioText"); //NOI18N
0169:            private static final String SAVE_SNAPSHOT_RADIO_TEXT = NbBundle
0170:                    .getMessage(ProfilerOptionsPanel.class,
0171:                            "ProfilerOptionsPanel_SaveSnapshotRadioText"); //NOI18N
0172:            private static final String OPEN_SAVE_SNAPSHOT_RADIO_TEXT = NbBundle
0173:                    .getMessage(ProfilerOptionsPanel.class,
0174:                            "ProfilerOptionsPanel_OpenSaveSnapshotRadioText"); //NOI18N
0175:            private static final String RESET_HINT_TEXT = NbBundle.getMessage(
0176:                    ProfilerOptionsPanel.class,
0177:                    "ProfilerOptionsPanel_ResetHintText"); //NOI18N
0178:            private static final String RESET_BUTTON_NAME = NbBundle
0179:                    .getMessage(ProfilerOptionsPanel.class,
0180:                            "ProfilerOptionsPanel_ResetButtonName"); //NOI18N
0181:            private static final String PORT_NO_SPINNER_ACCESS_DESCR = NbBundle
0182:                    .getMessage(ProfilerOptionsPanel.class,
0183:                            "ProfilerOptionsPanel_PortNoSpinnerAccessDescr"); //NOI18N
0184:            private static final String CPU_LIVE_RESULTS_CHECKBOX_ACCESS_DESCR = NbBundle
0185:                    .getMessage(ProfilerOptionsPanel.class,
0186:                            "ProfilerOptionsPanel_CpuLiveResultsCheckboxAccessDescr"); //NOI18N
0187:            private static final String MEMORY_LIVE_RESULTS_CHECKBOX_ACCESS_DESCR = NbBundle
0188:                    .getMessage(ProfilerOptionsPanel.class,
0189:                            "ProfilerOptionsPanel_MemoryLiveResultsCheckboxAccessDescr"); //NOI18N
0190:            private static final String TELEMETRY_OVERVIEW_COMBO_ACCESS_DESCR = NbBundle
0191:                    .getMessage(ProfilerOptionsPanel.class,
0192:                            "ProfilerOptionsPanel_TelemetryOverviewComboAccessDescr"); //NOI18N
0193:            private static final String THREADS_VIEW_COMBO_ACCESS_DESCR = NbBundle
0194:                    .getMessage(ProfilerOptionsPanel.class,
0195:                            "ProfilerOptionsPanel_ThreadsViewComboAccessDescr"); //NOI18N  
0196:            private static final String OOME_BORDER_TEXT = NbBundle.getMessage(
0197:                    ProfilerOptionsPanel.class,
0198:                    "ProfilerOptionsPanel_OomeBorderText"); //NOI18N  
0199:            private static final String OOME_NOTHING_TEXT = NbBundle
0200:                    .getMessage(ProfilerOptionsPanel.class,
0201:                            "ProfilerOptionsPanel_OomeNothingText"); //NOI18N  
0202:            private static final String OOME_PROJECT_TEXT = NbBundle
0203:                    .getMessage(ProfilerOptionsPanel.class,
0204:                            "ProfilerOptionsPanel_OomeProjectText"); //NOI18N  
0205:            private static final String OOME_CUSTOM_TEXT = NbBundle.getMessage(
0206:                    ProfilerOptionsPanel.class,
0207:                    "ProfilerOptionsPanel_OomeCustomText"); //NOI18N  
0208:            private static final String OOME_TEMP_TEXT = NbBundle.getMessage(
0209:                    ProfilerOptionsPanel.class,
0210:                    "ProfilerOptionsPanel_OomeTempText"); //NOI18N  
0211:            private static final String OOME_CUSTOM_ACCESS_DESCR = NbBundle
0212:                    .getMessage(ProfilerOptionsPanel.class,
0213:                            "ProfilerOptionsPanel_OomeCustomAccessDescr"); //NOI18N 
0214:            private static final String OOME_CUSTOM_TEXTFIELD_ACCESS_DESCR = NbBundle
0215:                    .getMessage(ProfilerOptionsPanel.class,
0216:                            "ProfilerOptionsPanel_OomeCustomTextfieldAccessDescr"); //NOI18N 
0217:            private static final String OOME_CUSTOM_BUTTON_ACCESS_NAME = NbBundle
0218:                    .getMessage(ProfilerOptionsPanel.class,
0219:                            "ProfilerOptionsPanel_OomeCustomButtonAccessName"); //NOI18N 
0220:            private static final String CHOOSE_DUMPDIR_CAPTION = NbBundle
0221:                    .getMessage(ProfilerOptionsPanel.class,
0222:                            "ProfilerOptionsPanel_ChooseDumpDirCaption"); //NOI18N 
0223:            private static final String ENABLE_ANALYSIS_CHECKBOX = NbBundle
0224:                    .getMessage(ProfilerOptionsPanel.class,
0225:                            "ProfilerOptionsPanel_EnableAnalysisCheckbox"); //NOI18N 
0226:            private static final String TAKING_SNAPSHOT_LABEL_TEXT = NbBundle
0227:                    .getMessage(ProfilerOptionsPanel.class,
0228:                            "ProfilerOptionsPanel_TakingSnapshotLabelText"); //NOI18N 
0229:            private static final String TAKING_SNAPSHOT_COMBO_ACCESS_DESCR = NbBundle
0230:                    .getMessage(ProfilerOptionsPanel.class,
0231:                            "ProfilerOptionsPanel_TakingSnapshotComboAccessDescr"); //NOI18N 
0232:            private static final String OOME_COMBO_ACCESS_DESCR = NbBundle
0233:                    .getMessage(ProfilerOptionsPanel.class,
0234:                            "ProfilerOptionsPanel_OomeComboAccessDescr"); //NOI18N 
0235:            private static final String HEAPWALKER_LABEL_TEXT = NbBundle
0236:                    .getMessage(ProfilerOptionsPanel.class,
0237:                            "ProfilerOptionsPanel_HeapWalkerLabelText"); //NOI18N 
0238:            private static final String JAVA_PLAFORM_COMBO_ACCESS_DESCR = NbBundle
0239:                    .getMessage(ProfilerOptionsPanel.class,
0240:                            "ProfilerOptionsPanel_JavaPlatformComboAccessDescr"); //NOI18N 
0241:            // -----
0242:
0243:            //~ Instance fields ----------------------------------------------------------------------------------------------------------
0244:
0245:            private ArrayList supportedJavaPlatforms = new ArrayList();
0246:            private ArrayList supportedJavaPlatformsNames = new ArrayList();
0247:            private JButton managePlatformsButton;
0248:            private JButton oomeDetectionChooseDirButton;
0249:            private JButton resetConfirmationsButton;
0250:            private JCheckBox cpuLiveResultsCheckbox;
0251:            private JCheckBox enableHeapWalkerAnalysisCheckbox;
0252:            private JCheckBox memoryLiveResultsCheckbox;
0253:            private JComboBox javaPlatformCombo;
0254:            private JComboBox oomeCombo;
0255:            private JComboBox openThreadsViewCombo;
0256:            private JComboBox takingSnapshotCombo;
0257:            private JComboBox telemetryOverviewCombo;
0258:            private JExtendedSpinner portNoSpinner;
0259:            private JTextField oomeDetectionDirTextField;
0260:
0261:            //~ Constructors -------------------------------------------------------------------------------------------------------------
0262:
0263:            public ProfilerOptionsPanel() {
0264:                initComponents();
0265:            }
0266:
0267:            //~ Methods ------------------------------------------------------------------------------------------------------------------
0268:
0269:            public Dimension getPreferredScrollableViewportSize() {
0270:                return null;
0271:            }
0272:
0273:            public int getScrollableBlockIncrement(Rectangle visibleRect,
0274:                    int orientation, int direction) {
0275:                // Scroll almost one screen
0276:                Container parent = getParent();
0277:
0278:                if ((parent == null) || !(parent instanceof  JViewport)) {
0279:                    return 50;
0280:                }
0281:
0282:                return (int) (((JViewport) parent).getHeight() * 0.95f);
0283:            }
0284:
0285:            public boolean getScrollableTracksViewportHeight() {
0286:                return false;
0287:            }
0288:
0289:            public boolean getScrollableTracksViewportWidth() {
0290:                return true;
0291:            }
0292:
0293:            public int getScrollableUnitIncrement(Rectangle visibleRect,
0294:                    int orientation, int direction) {
0295:                return 20;
0296:            }
0297:
0298:            public JavaPlatform getSelectedJavaPlatform() {
0299:                int selectedJavaPlatformIndex = javaPlatformCombo
0300:                        .getSelectedIndex();
0301:
0302:                if ((selectedJavaPlatformIndex == -1)
0303:                        || (selectedJavaPlatformIndex == 0)) {
0304:                    return null; // not selected, or <use project> selected
0305:                }
0306:
0307:                selectedJavaPlatformIndex--;
0308:
0309:                return (JavaPlatform) supportedJavaPlatforms
0310:                        .get(selectedJavaPlatformIndex);
0311:            }
0312:
0313:            /**
0314:             * Invoked when an action occurs.
0315:             */
0316:            public void actionPerformed(final ActionEvent e) {
0317:                if (e.getSource() == resetConfirmationsButton) {
0318:                    ProfilerIDESettings.getInstance().clearDoNotShowAgainMap();
0319:                    resetConfirmationsButton.setEnabled(false);
0320:                } else if (e.getSource() == managePlatformsButton) {
0321:                    JavaPlatform platform = getSelectedJavaPlatform();
0322:                    PlatformsCustomizer.showCustomizer(platform);
0323:                    updateJavaPlatformComboItems();
0324:                } else if (e.getSource() == oomeDetectionChooseDirButton) {
0325:                    JFileChooser chooser = new JFileChooser();
0326:                    chooser.setCurrentDirectory(new java.io.File(
0327:                            oomeDetectionDirTextField.getText()));
0328:                    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
0329:                    chooser.setMultiSelectionEnabled(false);
0330:                    chooser.setDialogType(JFileChooser.OPEN_DIALOG);
0331:                    chooser.setDialogTitle(CHOOSE_DUMPDIR_CAPTION);
0332:
0333:                    if (chooser.showOpenDialog(SwingUtilities.getRoot(this )) == JFileChooser.APPROVE_OPTION) {
0334:                        oomeDetectionDirTextField.setText(chooser
0335:                                .getSelectedFile().getAbsolutePath());
0336:                    }
0337:                }
0338:            }
0339:
0340:            public void applySettings(ProfilerIDESettings pis) {
0341:                // GlobalProfilingSettings
0342:                pis.setPortNo(((Number) portNoSpinner.getValue()).intValue());
0343:
0344:                JavaPlatform sel = getSelectedJavaPlatform();
0345:
0346:                pis.setJavaPlatformForProfiling((sel == null) ? null : sel
0347:                        .getDisplayName());
0348:
0349:                // ProfilerIDESettings
0350:                pis.setDisplayLiveResultsCPU(cpuLiveResultsCheckbox
0351:                        .isSelected());
0352:                pis.setDisplayLiveResultsMemory(memoryLiveResultsCheckbox
0353:                        .isSelected());
0354:
0355:                Object takingSnapshotSelected = takingSnapshotCombo
0356:                        .getSelectedItem();
0357:                pis
0358:                        .setAutoOpenSnapshot((takingSnapshotSelected == OPEN_SNAPSHOT_RADIO_TEXT)
0359:                                || (takingSnapshotSelected == OPEN_SAVE_SNAPSHOT_RADIO_TEXT));
0360:                pis
0361:                        .setAutoSaveSnapshot((takingSnapshotSelected == SAVE_SNAPSHOT_RADIO_TEXT)
0362:                                || (takingSnapshotSelected == OPEN_SAVE_SNAPSHOT_RADIO_TEXT));
0363:
0364:                Object oomeSelected = oomeCombo.getSelectedItem();
0365:
0366:                if (oomeSelected == OOME_NOTHING_TEXT) {
0367:                    pis.setOOMDetectionMode(pis.OOME_DETECTION_NONE);
0368:                } else if (oomeSelected == OOME_PROJECT_TEXT) {
0369:                    pis.setOOMDetectionMode(pis.OOME_DETECTION_PROJECTDIR);
0370:                } else if (oomeSelected == OOME_TEMP_TEXT) {
0371:                    pis.setOOMDetectionMode(pis.OOME_DETECTION_TEMPDIR);
0372:                } else if (oomeSelected == OOME_CUSTOM_TEXT) {
0373:                    pis.setOOMDetectionMode(pis.OOME_DETECTION_CUSTOMDIR);
0374:                }
0375:
0376:                pis.setCustomHeapdumpPath(oomeDetectionDirTextField.getText());
0377:
0378:                pis
0379:                        .setHeapWalkerAnalysisEnabled(enableHeapWalkerAnalysisCheckbox
0380:                                .isSelected());
0381:
0382:                if (telemetryOverviewCombo.getSelectedItem() == KEY_OPEN_ALWAYS) {
0383:                    pis
0384:                            .setTelemetryOverviewBehavior(ProfilerIDESettings.OPEN_ALWAYS);
0385:                } else if (telemetryOverviewCombo.getSelectedItem() == KEY_OPEN_MONITORING) {
0386:                    pis
0387:                            .setTelemetryOverviewBehavior(ProfilerIDESettings.OPEN_MONITORING);
0388:                } else {
0389:                    pis
0390:                            .setTelemetryOverviewBehavior(ProfilerIDESettings.OPEN_NEVER);
0391:                }
0392:
0393:                if (openThreadsViewCombo.getSelectedItem() == KEY_OPEN_ALWAYS) {
0394:                    pis.setThreadsViewBehavior(ProfilerIDESettings.OPEN_ALWAYS);
0395:                } else if (openThreadsViewCombo.getSelectedItem() == KEY_OPEN_MONITORING) {
0396:                    pis
0397:                            .setThreadsViewBehavior(ProfilerIDESettings.OPEN_MONITORING);
0398:                } else {
0399:                    pis.setThreadsViewBehavior(ProfilerIDESettings.OPEN_NEVER);
0400:                }
0401:            }
0402:
0403:            public boolean currentSettingsEquals(ProfilerIDESettings settings) {
0404:                if (((Number) portNoSpinner.getValue()).intValue() != settings
0405:                        .getPortNo()) {
0406:                    return false;
0407:                }
0408:
0409:                if (cpuLiveResultsCheckbox.isSelected() != settings
0410:                        .getDisplayLiveResultsCPU()) {
0411:                    return false;
0412:                }
0413:
0414:                if (memoryLiveResultsCheckbox.isSelected() != settings
0415:                        .getDisplayLiveResultsMemory()) {
0416:                    return false;
0417:                }
0418:
0419:                if (settings.getAutoOpenSnapshot()
0420:                        && settings.getAutoSaveSnapshot()
0421:                        && (takingSnapshotCombo.getSelectedItem() != OPEN_SAVE_SNAPSHOT_RADIO_TEXT)) {
0422:                    return false;
0423:                }
0424:
0425:                if (settings.getAutoOpenSnapshot()
0426:                        && (takingSnapshotCombo.getSelectedItem() != OPEN_SNAPSHOT_RADIO_TEXT)) {
0427:                    return false;
0428:                }
0429:
0430:                if (settings.getAutoSaveSnapshot()
0431:                        && (takingSnapshotCombo.getSelectedItem() != SAVE_SNAPSHOT_RADIO_TEXT)) {
0432:                    return false;
0433:                }
0434:
0435:                if ((settings.getOOMDetectionMode() == settings.OOME_DETECTION_NONE)
0436:                        && (oomeCombo.getSelectedItem() != OOME_NOTHING_TEXT)) {
0437:                    return false;
0438:                }
0439:
0440:                if ((settings.getOOMDetectionMode() == settings.OOME_DETECTION_PROJECTDIR)
0441:                        && (oomeCombo.getSelectedItem() != OOME_PROJECT_TEXT)) {
0442:                    return false;
0443:                }
0444:
0445:                if ((settings.getOOMDetectionMode() == settings.OOME_DETECTION_TEMPDIR)
0446:                        && (oomeCombo.getSelectedItem() != OOME_TEMP_TEXT)) {
0447:                    return false;
0448:                }
0449:
0450:                if ((settings.getOOMDetectionMode() == settings.OOME_DETECTION_CUSTOMDIR)
0451:                        && (oomeCombo.getSelectedItem() != OOME_CUSTOM_TEXT)) {
0452:                    return false;
0453:                }
0454:
0455:                if (!oomeDetectionDirTextField.getText().equals(
0456:                        settings.getCustomHeapdumpPath())) {
0457:                    return false;
0458:                }
0459:
0460:                if (telemetryOverviewCombo.getSelectedItem() == KEY_OPEN_ALWAYS) {
0461:                    if (settings.getTelemetryOverviewBehavior() != ProfilerIDESettings.OPEN_ALWAYS) {
0462:                        return false;
0463:                    }
0464:                } else if (telemetryOverviewCombo.getSelectedItem() == KEY_OPEN_MONITORING) {
0465:                    if (settings.getTelemetryOverviewBehavior() != ProfilerIDESettings.OPEN_MONITORING) {
0466:                        return false;
0467:                    }
0468:                } else if (telemetryOverviewCombo.getSelectedItem() == KEY_OPEN_NEVER) {
0469:                    if (settings.getTelemetryOverviewBehavior() != ProfilerIDESettings.OPEN_NEVER) {
0470:                        return false;
0471:                    }
0472:                }
0473:
0474:                if (openThreadsViewCombo.getSelectedItem() == KEY_OPEN_ALWAYS) {
0475:                    if (settings.getThreadsViewBehavior() != ProfilerIDESettings.OPEN_ALWAYS) {
0476:                        return false;
0477:                    }
0478:                } else if (openThreadsViewCombo.getSelectedItem() == KEY_OPEN_MONITORING) {
0479:                    if (settings.getThreadsViewBehavior() != ProfilerIDESettings.OPEN_MONITORING) {
0480:                        return false;
0481:                    }
0482:                } else if (openThreadsViewCombo.getSelectedItem() == KEY_OPEN_NEVER) {
0483:                    if (settings.getThreadsViewBehavior() != ProfilerIDESettings.OPEN_NEVER) {
0484:                        return false;
0485:                    }
0486:                }
0487:
0488:                JavaPlatform sel = getSelectedJavaPlatform();
0489:
0490:                if (sel == null) {
0491:                    if (settings.getJavaPlatformForProfiling() != null) {
0492:                        return false;
0493:                    }
0494:                } else {
0495:                    if (!sel.getDisplayName().equals(
0496:                            settings.getJavaPlatformForProfiling())) {
0497:                        return false;
0498:                    }
0499:                }
0500:
0501:                if (settings.getHeapWalkerAnalysisEnabled() != enableHeapWalkerAnalysisCheckbox
0502:                        .isSelected()) {
0503:                    return false;
0504:                }
0505:
0506:                return true;
0507:            }
0508:
0509:            public void init(ProfilerIDESettings pis) {
0510:                resetConfirmationsButton.setEnabled(true);
0511:                updateJavaPlatformComboItems();
0512:
0513:                // GlobalProfilingSettings
0514:                portNoSpinner.setValue(new Integer(pis.getPortNo()));
0515:
0516:                if (pis.getJavaPlatformForProfiling() != null) {
0517:                    javaPlatformCombo.setSelectedItem(pis
0518:                            .getJavaPlatformForProfiling());
0519:                } else {
0520:                    javaPlatformCombo.setSelectedIndex(0);
0521:                }
0522:
0523:                // ProfilerIDESettings
0524:                cpuLiveResultsCheckbox.setSelected(pis
0525:                        .getDisplayLiveResultsCPU());
0526:                memoryLiveResultsCheckbox.setSelected(pis
0527:                        .getDisplayLiveResultsMemory());
0528:
0529:                if (pis.getAutoOpenSnapshot() && pis.getAutoSaveSnapshot()) {
0530:                    takingSnapshotCombo
0531:                            .setSelectedItem(OPEN_SAVE_SNAPSHOT_RADIO_TEXT);
0532:                } else if (pis.getAutoOpenSnapshot()) {
0533:                    takingSnapshotCombo
0534:                            .setSelectedItem(OPEN_SNAPSHOT_RADIO_TEXT);
0535:                } else if (pis.getAutoSaveSnapshot()) {
0536:                    takingSnapshotCombo
0537:                            .setSelectedItem(SAVE_SNAPSHOT_RADIO_TEXT);
0538:                }
0539:
0540:                if (pis.getOOMDetectionMode() == pis.OOME_DETECTION_NONE) {
0541:                    oomeCombo.setSelectedItem(OOME_NOTHING_TEXT);
0542:                } else if (pis.getOOMDetectionMode() == pis.OOME_DETECTION_PROJECTDIR) {
0543:                    oomeCombo.setSelectedItem(OOME_PROJECT_TEXT);
0544:                } else if (pis.getOOMDetectionMode() == pis.OOME_DETECTION_TEMPDIR) {
0545:                    oomeCombo.setSelectedItem(OOME_TEMP_TEXT);
0546:                } else if (pis.getOOMDetectionMode() == pis.OOME_DETECTION_CUSTOMDIR) {
0547:                    oomeCombo.setSelectedItem(OOME_CUSTOM_TEXT);
0548:                }
0549:
0550:                oomeDetectionDirTextField.setText(pis.getCustomHeapdumpPath());
0551:
0552:                enableHeapWalkerAnalysisCheckbox.setSelected(pis
0553:                        .getHeapWalkerAnalysisEnabled());
0554:
0555:                switch (pis.getTelemetryOverviewBehavior()) {
0556:                case ProfilerIDESettings.OPEN_ALWAYS:
0557:                    telemetryOverviewCombo.setSelectedItem(KEY_OPEN_ALWAYS);
0558:
0559:                    break;
0560:                case ProfilerIDESettings.OPEN_MONITORING:
0561:                    telemetryOverviewCombo.setSelectedItem(KEY_OPEN_MONITORING);
0562:
0563:                    break;
0564:                default:
0565:                    telemetryOverviewCombo.setSelectedItem(KEY_OPEN_NEVER);
0566:
0567:                    break;
0568:                }
0569:
0570:                switch (pis.getThreadsViewBehavior()) {
0571:                case ProfilerIDESettings.OPEN_ALWAYS:
0572:                    openThreadsViewCombo.setSelectedItem(KEY_OPEN_ALWAYS);
0573:
0574:                    break;
0575:                case ProfilerIDESettings.OPEN_MONITORING:
0576:                    openThreadsViewCombo.setSelectedItem(KEY_OPEN_MONITORING);
0577:
0578:                    break;
0579:                default:
0580:                    openThreadsViewCombo.setSelectedItem(KEY_OPEN_NEVER);
0581:
0582:                    break;
0583:                }
0584:
0585:                updateEnabling();
0586:            }
0587:
0588:            private void initComponents() {
0589:                setLayout(new GridBagLayout());
0590:
0591:                GridBagConstraints gridBagConstraints;
0592:                ButtonGroup oomeRadiosGroup = new ButtonGroup();
0593:
0594:                // --- General -------------------------------------------------------------
0595:
0596:                // General caption
0597:                CategorySeparator generalSeparator = new CategorySeparator(
0598:                        ENGINE_SETTINGS_BORDER_TEXT);
0599:                gridBagConstraints = new GridBagConstraints();
0600:                gridBagConstraints.gridx = 0;
0601:                gridBagConstraints.gridy = 0;
0602:                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
0603:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0604:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
0605:                gridBagConstraints.insets = new Insets(2, 0, 0, 6);
0606:                add(generalSeparator, gridBagConstraints);
0607:
0608:                // javaPlatformLabel
0609:                JLabel javaPlatformLabel = new JLabel();
0610:                org.openide.awt.Mnemonics.setLocalizedText(javaPlatformLabel,
0611:                        JAVA_PLATFORM_LABEL_TEXT);
0612:                gridBagConstraints = new GridBagConstraints();
0613:                gridBagConstraints.gridx = 0;
0614:                gridBagConstraints.gridy = 1;
0615:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0616:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0617:                add(javaPlatformLabel, gridBagConstraints);
0618:
0619:                // javaPlatformCombo
0620:                javaPlatformCombo = new JComboBox() {
0621:                    public Dimension getMinimumSize() {
0622:                        return getPreferredSize();
0623:                    }
0624:                };
0625:                javaPlatformCombo.getAccessibleContext()
0626:                        .setAccessibleDescription(
0627:                                JAVA_PLAFORM_COMBO_ACCESS_DESCR);
0628:                javaPlatformLabel.setLabelFor(javaPlatformCombo);
0629:                gridBagConstraints = new GridBagConstraints();
0630:                gridBagConstraints.gridx = 1;
0631:                gridBagConstraints.gridy = 1;
0632:                gridBagConstraints.weightx = 1.0;
0633:                gridBagConstraints.gridwidth = 2;
0634:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0635:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
0636:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0637:                add(javaPlatformCombo, gridBagConstraints);
0638:
0639:                // managePlatformsButton
0640:                managePlatformsButton = new JButton();
0641:                org.openide.awt.Mnemonics.setLocalizedText(
0642:                        managePlatformsButton, MANAGE_PLATFORMS_BUTTON_NAME);
0643:                managePlatformsButton.getAccessibleContext()
0644:                        .setAccessibleDescription(MANAGE_PLATFORMS_BUTTON_NAME);
0645:                managePlatformsButton.addActionListener(this );
0646:                gridBagConstraints = new java.awt.GridBagConstraints();
0647:                gridBagConstraints.gridx = 3;
0648:                gridBagConstraints.gridy = 1;
0649:                gridBagConstraints.insets = new java.awt.Insets(5, 3, 0, 6);
0650:                gridBagConstraints.fill = GridBagConstraints.NONE;
0651:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0652:                add(managePlatformsButton, gridBagConstraints);
0653:
0654:                // portNoLabel
0655:                JLabel portNoLabel = new JLabel();
0656:                org.openide.awt.Mnemonics.setLocalizedText(portNoLabel,
0657:                        COMM_PORT_LABEL_TEXT);
0658:                gridBagConstraints = new GridBagConstraints();
0659:                gridBagConstraints.gridx = 0;
0660:                gridBagConstraints.gridy = 2;
0661:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0662:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0663:                add(portNoLabel, gridBagConstraints);
0664:
0665:                // portNoSpinner
0666:                portNoSpinner = new JExtendedSpinner() {
0667:                    public Dimension getPreferredSize() {
0668:                        return new Dimension(super .getPreferredSize().width,
0669:                                org.netbeans.modules.profiler.ui.stp.Utils
0670:                                        .getDefaultSpinnerHeight());
0671:                    }
0672:
0673:                    public Dimension getMinimumSize() {
0674:                        return getPreferredSize();
0675:                    }
0676:                };
0677:                portNoLabel.setLabelFor(portNoSpinner);
0678:
0679:                if (portNoSpinner.getAccessibleContext() != null) {
0680:                    portNoSpinner.getAccessibleContext()
0681:                            .setAccessibleDescription(
0682:                                    PORT_NO_SPINNER_ACCESS_DESCR);
0683:                }
0684:
0685:                portNoSpinner.fixAccessibility();
0686:                portNoSpinner
0687:                        .setModel(new SpinnerNumberModel(5140, 1, 65535, 1));
0688:                portNoSpinner.setPreferredSize(new Dimension(portNoSpinner
0689:                        .getPreferredSize().width, javaPlatformCombo
0690:                        .getPreferredSize().height));
0691:                gridBagConstraints = new GridBagConstraints();
0692:                gridBagConstraints.gridx = 1;
0693:                gridBagConstraints.gridy = 2;
0694:                gridBagConstraints.gridwidth = 2;
0695:                gridBagConstraints.insets = new Insets(5, 10, 0, 6);
0696:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0697:                add(portNoSpinner, gridBagConstraints);
0698:
0699:                // --- When Profiling Starts -----------------------------------------------
0700:
0701:                // Profiling Start caption
0702:                CategorySeparator profilingStartSeparator = new CategorySeparator(
0703:                        WINDOWS_SETTINGS_BORDER_TEXT);
0704:                gridBagConstraints = new GridBagConstraints();
0705:                gridBagConstraints.gridx = 0;
0706:                gridBagConstraints.gridy = 3;
0707:                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
0708:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0709:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
0710:                gridBagConstraints.insets = new Insets(7, 0, 0, 6);
0711:                add(profilingStartSeparator, gridBagConstraints);
0712:
0713:                // telemetryOverviewLabel
0714:                JLabel telemetryOverviewLabel = new JLabel();
0715:                org.openide.awt.Mnemonics.setLocalizedText(
0716:                        telemetryOverviewLabel, TELEMETRY_OVERVIEW_LABEL_TEXT);
0717:                gridBagConstraints = new GridBagConstraints();
0718:                gridBagConstraints.gridx = 0;
0719:                gridBagConstraints.gridy = 4;
0720:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0721:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0722:                add(telemetryOverviewLabel, gridBagConstraints);
0723:
0724:                // telemetryOverviewCombo
0725:                telemetryOverviewCombo = new JComboBox() {
0726:                    public Dimension getMinimumSize() {
0727:                        return getPreferredSize();
0728:                    }
0729:                };
0730:                telemetryOverviewLabel.setLabelFor(telemetryOverviewCombo);
0731:                telemetryOverviewCombo.getAccessibleContext()
0732:                        .setAccessibleDescription(
0733:                                TELEMETRY_OVERVIEW_COMBO_ACCESS_DESCR);
0734:                telemetryOverviewCombo.setModel(new DefaultComboBoxModel(
0735:                        new String[] { KEY_OPEN_ALWAYS, KEY_OPEN_MONITORING,
0736:                                KEY_OPEN_NEVER }));
0737:                gridBagConstraints = new GridBagConstraints();
0738:                gridBagConstraints.gridx = 1;
0739:                gridBagConstraints.gridy = 4;
0740:                gridBagConstraints.gridwidth = 2;
0741:                gridBagConstraints.insets = new Insets(5, 10, 0, 6);
0742:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0743:                add(telemetryOverviewCombo, gridBagConstraints);
0744:
0745:                // openThreadsViewLabel
0746:                JLabel openThreadsViewLabel = new JLabel();
0747:                org.openide.awt.Mnemonics.setLocalizedText(
0748:                        openThreadsViewLabel, THREADS_VIEW_LABEL_TEXT);
0749:                gridBagConstraints = new GridBagConstraints();
0750:                gridBagConstraints.gridx = 0;
0751:                gridBagConstraints.gridy = 5;
0752:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0753:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0754:                add(openThreadsViewLabel, gridBagConstraints);
0755:
0756:                // openThreadsViewCombo
0757:                openThreadsViewCombo = new JComboBox() {
0758:                    public Dimension getMinimumSize() {
0759:                        return getPreferredSize();
0760:                    }
0761:                };
0762:                openThreadsViewLabel.setLabelFor(openThreadsViewCombo);
0763:                openThreadsViewCombo.getAccessibleContext()
0764:                        .setAccessibleDescription(
0765:                                THREADS_VIEW_COMBO_ACCESS_DESCR
0766:                                        + THREADS_VIEW_HINT_TEXT);
0767:                openThreadsViewCombo.setModel(new DefaultComboBoxModel(
0768:                        new String[] { KEY_OPEN_ALWAYS, KEY_OPEN_MONITORING,
0769:                                KEY_OPEN_NEVER }));
0770:                gridBagConstraints = new GridBagConstraints();
0771:                gridBagConstraints.gridx = 1;
0772:                gridBagConstraints.gridy = 5;
0773:                gridBagConstraints.gridwidth = 2;
0774:                gridBagConstraints.insets = new Insets(5, 10, 0, 6);
0775:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0776:                add(openThreadsViewCombo, gridBagConstraints);
0777:
0778:                int maxWidth = Math.max(telemetryOverviewCombo
0779:                        .getPreferredSize().width, openThreadsViewCombo
0780:                        .getPreferredSize().width) + 15;
0781:                int maxHeight = Math.max(telemetryOverviewCombo
0782:                        .getPreferredSize().height, openThreadsViewCombo
0783:                        .getPreferredSize().height);
0784:                telemetryOverviewCombo.setPreferredSize(new Dimension(maxWidth,
0785:                        maxHeight));
0786:                openThreadsViewCombo.setPreferredSize(new Dimension(maxWidth,
0787:                        maxHeight));
0788:
0789:                // liveResultsLabel
0790:                JLabel liveResultsLabel = new JLabel(LIVE_RESULTS_LABEL_TEXT);
0791:                gridBagConstraints = new GridBagConstraints();
0792:                gridBagConstraints.gridx = 0;
0793:                gridBagConstraints.gridy = 6;
0794:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0795:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0796:                add(liveResultsLabel, gridBagConstraints);
0797:
0798:                // liveResultsPanel
0799:                JPanel liveResultsPanel = new JPanel();
0800:                liveResultsPanel.setLayout(new GridLayout(1, 2, 0, 0));
0801:
0802:                // cpuLiveResultsCheckbox
0803:                cpuLiveResultsCheckbox = new JCheckBox();
0804:                org.openide.awt.Mnemonics.setLocalizedText(
0805:                        cpuLiveResultsCheckbox, CPU_CHCKBOX_TEXT);
0806:                cpuLiveResultsCheckbox.getAccessibleContext()
0807:                        .setAccessibleDescription(
0808:                                CPU_LIVE_RESULTS_CHECKBOX_ACCESS_DESCR);
0809:                liveResultsPanel.add(cpuLiveResultsCheckbox);
0810:
0811:                // memoryLiveResultsCheckbox
0812:                memoryLiveResultsCheckbox = new JCheckBox();
0813:                org.openide.awt.Mnemonics.setLocalizedText(
0814:                        memoryLiveResultsCheckbox, MEMORY_CHCKBOX_TEXT);
0815:                memoryLiveResultsCheckbox.getAccessibleContext()
0816:                        .setAccessibleDescription(
0817:                                MEMORY_LIVE_RESULTS_CHECKBOX_ACCESS_DESCR);
0818:                liveResultsPanel.add(memoryLiveResultsCheckbox);
0819:
0820:                // liveResultsLabel placing
0821:                gridBagConstraints = new GridBagConstraints();
0822:                gridBagConstraints.gridx = 1;
0823:                gridBagConstraints.gridy = 6;
0824:                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
0825:                gridBagConstraints.insets = new Insets(5, 10, 0, 6);
0826:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0827:                add(liveResultsPanel, gridBagConstraints);
0828:
0829:                // --- Miscellaneous -------------------------------------------------------
0830:
0831:                // Miscellaneous caption
0832:                CategorySeparator miscellaneousSeparator = new CategorySeparator(
0833:                        SNAPSHOTS_SETTINGS_BORDER_TEXT);
0834:                gridBagConstraints = new GridBagConstraints();
0835:                gridBagConstraints.gridx = 0;
0836:                gridBagConstraints.gridy = 7;
0837:                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
0838:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0839:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
0840:                gridBagConstraints.insets = new Insets(5, 0, 0, 6);
0841:                add(miscellaneousSeparator, gridBagConstraints);
0842:
0843:                // takingSnapshotLabel
0844:                JLabel takingSnapshotLabel = new JLabel();
0845:                org.openide.awt.Mnemonics.setLocalizedText(takingSnapshotLabel,
0846:                        TAKING_SNAPSHOT_LABEL_TEXT);
0847:                gridBagConstraints = new GridBagConstraints();
0848:                gridBagConstraints.gridx = 0;
0849:                gridBagConstraints.gridy = 8;
0850:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0851:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0852:                add(takingSnapshotLabel, gridBagConstraints);
0853:
0854:                // takingSnapshotCombo
0855:                takingSnapshotCombo = new JComboBox() {
0856:                    public Dimension getMinimumSize() {
0857:                        return getPreferredSize();
0858:                    }
0859:                };
0860:                takingSnapshotLabel.setLabelFor(takingSnapshotCombo);
0861:                takingSnapshotCombo.getAccessibleContext()
0862:                        .setAccessibleDescription(
0863:                                TAKING_SNAPSHOT_COMBO_ACCESS_DESCR);
0864:                takingSnapshotCombo.setModel(new DefaultComboBoxModel(
0865:                        new String[] { OPEN_SNAPSHOT_RADIO_TEXT,
0866:                                SAVE_SNAPSHOT_RADIO_TEXT,
0867:                                OPEN_SAVE_SNAPSHOT_RADIO_TEXT }));
0868:                gridBagConstraints = new GridBagConstraints();
0869:                gridBagConstraints.gridx = 1;
0870:                gridBagConstraints.gridy = 8;
0871:                gridBagConstraints.gridwidth = 2;
0872:                gridBagConstraints.insets = new Insets(5, 10, 0, 6);
0873:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0874:                add(takingSnapshotCombo, gridBagConstraints);
0875:
0876:                // oomeDetectionLabel
0877:                JLabel oomeDetectionLabel = new JLabel();
0878:                org.openide.awt.Mnemonics.setLocalizedText(oomeDetectionLabel,
0879:                        OOME_BORDER_TEXT);
0880:                gridBagConstraints = new GridBagConstraints();
0881:                gridBagConstraints.gridx = 0;
0882:                gridBagConstraints.gridy = 9;
0883:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0884:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0885:                add(oomeDetectionLabel, gridBagConstraints);
0886:
0887:                // oomeCombo
0888:                oomeCombo = new JComboBox() {
0889:                    public Dimension getMinimumSize() {
0890:                        return getPreferredSize();
0891:                    }
0892:                };
0893:                oomeDetectionLabel.setLabelFor(oomeCombo);
0894:                oomeCombo.getAccessibleContext().setAccessibleDescription(
0895:                        OOME_COMBO_ACCESS_DESCR);
0896:                oomeCombo.addItemListener(new ItemListener() {
0897:                    public void itemStateChanged(ItemEvent e) {
0898:                        updateEnabling();
0899:                    }
0900:                });
0901:                oomeCombo.setModel(new DefaultComboBoxModel(new String[] {
0902:                        OOME_NOTHING_TEXT, OOME_PROJECT_TEXT, OOME_TEMP_TEXT,
0903:                        OOME_CUSTOM_TEXT }));
0904:                gridBagConstraints = new GridBagConstraints();
0905:                gridBagConstraints.gridx = 1;
0906:                gridBagConstraints.gridy = 9;
0907:                gridBagConstraints.insets = new Insets(5, 10, 0, 6);
0908:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0909:                add(oomeCombo, gridBagConstraints);
0910:
0911:                int maxWidth1 = Math.max(
0912:                        takingSnapshotCombo.getPreferredSize().width, oomeCombo
0913:                                .getPreferredSize().width);
0914:                int maxHeight1 = Math.max(takingSnapshotCombo
0915:                        .getPreferredSize().height, oomeCombo
0916:                        .getPreferredSize().height);
0917:                takingSnapshotCombo.setPreferredSize(new Dimension(maxWidth1,
0918:                        maxHeight1));
0919:                oomeCombo
0920:                        .setPreferredSize(new Dimension(maxWidth1, maxHeight1));
0921:
0922:                // oomeDetectionPanel
0923:                JPanel oomeDetectionPanel = new JPanel(new GridBagLayout());
0924:
0925:                // oomeDetectionDirTextField
0926:                oomeDetectionDirTextField = new JTextField() {
0927:                    public Dimension getPreferredSize() {
0928:                        return new Dimension(
0929:                                super .getPreferredSize().width,
0930:                                oomeDetectionChooseDirButton.getPreferredSize().height);
0931:                    }
0932:
0933:                    public Dimension getMinimumSize() {
0934:                        return new Dimension(super .getMinimumSize().width,
0935:                                getPreferredSize().height);
0936:                    }
0937:                };
0938:                oomeDetectionDirTextField.getAccessibleContext()
0939:                        .setAccessibleName(OOME_CUSTOM_ACCESS_DESCR);
0940:                oomeDetectionDirTextField.getAccessibleContext()
0941:                        .setAccessibleDescription(
0942:                                OOME_CUSTOM_TEXTFIELD_ACCESS_DESCR);
0943:                oomeDetectionDirTextField.setEnabled(false);
0944:                gridBagConstraints = new GridBagConstraints();
0945:                gridBagConstraints.gridx = 1;
0946:                gridBagConstraints.gridy = 0;
0947:                gridBagConstraints.weightx = 1;
0948:                gridBagConstraints.weighty = 1;
0949:                gridBagConstraints.insets = new Insets(0, 0, 0, 5);
0950:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0951:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
0952:                oomeDetectionPanel.add(oomeDetectionDirTextField,
0953:                        gridBagConstraints);
0954:
0955:                // oomeDetectionChooseDirButton
0956:                oomeDetectionChooseDirButton = new JButton();
0957:                org.openide.awt.Mnemonics.setLocalizedText(
0958:                        oomeDetectionChooseDirButton, "&..."); // NOI18N
0959:                oomeDetectionChooseDirButton.getAccessibleContext()
0960:                        .setAccessibleName(OOME_CUSTOM_BUTTON_ACCESS_NAME);
0961:                oomeDetectionChooseDirButton.addActionListener(this );
0962:                oomeDetectionChooseDirButton.setEnabled(false);
0963:                gridBagConstraints = new GridBagConstraints();
0964:                gridBagConstraints.gridx = 2;
0965:                gridBagConstraints.gridy = 0;
0966:                gridBagConstraints.insets = new Insets(0, 3, 0, 0);
0967:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0968:                oomeDetectionPanel.add(oomeDetectionChooseDirButton,
0969:                        gridBagConstraints);
0970:
0971:                // oomeDetectionPanel
0972:                gridBagConstraints = new GridBagConstraints();
0973:                gridBagConstraints.gridx = 2;
0974:                gridBagConstraints.gridy = 9;
0975:                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
0976:                gridBagConstraints.insets = new Insets(5, 0, 0, 6);
0977:                gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
0978:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
0979:                add(oomeDetectionPanel, gridBagConstraints);
0980:
0981:                // heapWalkerLabel
0982:                JLabel heapWalkerLabel = new JLabel(HEAPWALKER_LABEL_TEXT);
0983:                gridBagConstraints = new GridBagConstraints();
0984:                gridBagConstraints.gridx = 0;
0985:                gridBagConstraints.gridy = 11;
0986:                gridBagConstraints.insets = new Insets(5, 10, 0, 5);
0987:                gridBagConstraints.anchor = GridBagConstraints.WEST;
0988:                gridBagConstraints.fill = GridBagConstraints.NONE;
0989:                add(heapWalkerLabel, gridBagConstraints);
0990:
0991:                // enableHeapWalkerAnalysisCheckbox
0992:                enableHeapWalkerAnalysisCheckbox = new JCheckBox();
0993:                org.openide.awt.Mnemonics.setLocalizedText(
0994:                        enableHeapWalkerAnalysisCheckbox,
0995:                        ENABLE_ANALYSIS_CHECKBOX);
0996:                enableHeapWalkerAnalysisCheckbox.getAccessibleContext()
0997:                        .setAccessibleDescription(ENABLE_ANALYSIS_CHECKBOX);
0998:                gridBagConstraints = new GridBagConstraints();
0999:                gridBagConstraints.gridx = 1;
1000:                gridBagConstraints.gridy = 11;
1001:                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
1002:                gridBagConstraints.insets = new Insets(5, 10, 0, 6);
1003:                gridBagConstraints.anchor = GridBagConstraints.WEST;
1004:                gridBagConstraints.fill = GridBagConstraints.NONE;
1005:                add(enableHeapWalkerAnalysisCheckbox, gridBagConstraints);
1006:
1007:                // resetConfirmationsPanel
1008:                JPanel resetConfirmationsPanel = new JPanel(new GridBagLayout());
1009:
1010:                // resetConfirmationsArea
1011:                JTextArea resetConfirmationsArea = new JTextArea(
1012:                        RESET_HINT_TEXT);
1013:                resetConfirmationsArea.setOpaque(false);
1014:                resetConfirmationsArea.setWrapStyleWord(true);
1015:                resetConfirmationsArea.setLineWrap(true);
1016:                resetConfirmationsArea.setEnabled(false);
1017:                resetConfirmationsArea.setFont(UIManager.getFont("Label.font")); //NOI18N
1018:                resetConfirmationsArea.setDisabledTextColor(UIManager
1019:                        .getColor("Label.foreground")); //NOI18N
1020:                gridBagConstraints = new GridBagConstraints();
1021:                gridBagConstraints.gridx = 0;
1022:                gridBagConstraints.gridy = 0;
1023:                gridBagConstraints.weightx = 1;
1024:                gridBagConstraints.weighty = 1;
1025:                gridBagConstraints.insets = new Insets(0, 0, 0, 5);
1026:                gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
1027:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
1028:                resetConfirmationsPanel.add(resetConfirmationsArea,
1029:                        gridBagConstraints);
1030:
1031:                // resetConfirmationsButton
1032:                resetConfirmationsButton = new JButton();
1033:                org.openide.awt.Mnemonics.setLocalizedText(
1034:                        resetConfirmationsButton, RESET_BUTTON_NAME);
1035:                resetConfirmationsButton.getAccessibleContext()
1036:                        .setAccessibleDescription(RESET_HINT_TEXT);
1037:                resetConfirmationsButton.addActionListener(this );
1038:                gridBagConstraints = new GridBagConstraints();
1039:                gridBagConstraints.gridx = 1;
1040:                gridBagConstraints.gridy = 0;
1041:                gridBagConstraints.insets = new Insets(0, 5, 0, 0);
1042:                gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
1043:                resetConfirmationsPanel.add(resetConfirmationsButton,
1044:                        gridBagConstraints);
1045:
1046:                gridBagConstraints = new GridBagConstraints();
1047:                gridBagConstraints.gridx = 0;
1048:                gridBagConstraints.gridy = 12;
1049:                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
1050:                gridBagConstraints.weighty = 1;
1051:                gridBagConstraints.insets = new Insets(5, 10, 0, 6);
1052:                gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
1053:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
1054:                add(resetConfirmationsPanel, gridBagConstraints);
1055:            }
1056:
1057:            private void updateEnabling() {
1058:                boolean customOOMEdirSelected = oomeCombo.getSelectedItem() == OOME_CUSTOM_TEXT;
1059:                oomeDetectionDirTextField.setEnabled(customOOMEdirSelected);
1060:                oomeDetectionChooseDirButton.setEnabled(customOOMEdirSelected);
1061:            }
1062:
1063:            private void updateJavaPlatformComboItems() {
1064:                updateJavaPlatforms();
1065:
1066:                Object selectedJavaPlatform = javaPlatformCombo
1067:                        .getSelectedItem();
1068:
1069:                javaPlatformCombo.removeAllItems();
1070:
1071:                DefaultComboBoxModel javaPlatformComboModel = new DefaultComboBoxModel(
1072:                        supportedJavaPlatformsNames.toArray());
1073:                javaPlatformComboModel.insertElementAt(USE_PROJECT_JVM_TEXT, 0);
1074:
1075:                javaPlatformCombo.setModel(javaPlatformComboModel);
1076:
1077:                if (selectedJavaPlatform != null) {
1078:                    javaPlatformCombo.setSelectedItem(selectedJavaPlatform);
1079:                }
1080:            }
1081:
1082:            private void updateJavaPlatforms() {
1083:                supportedJavaPlatforms.clear();
1084:                supportedJavaPlatformsNames.clear();
1085:
1086:                Iterator supportedPlatforms = JavaPlatformSelector
1087:                        .getSupportedPlatforms().iterator();
1088:
1089:                JavaPlatform supportedJavaPlatform;
1090:                String supportedJavaPlatformName;
1091:
1092:                while (supportedPlatforms.hasNext()) {
1093:                    supportedJavaPlatform = (JavaPlatform) supportedPlatforms
1094:                            .next();
1095:                    supportedJavaPlatformName = supportedJavaPlatform
1096:                            .getDisplayName();
1097:
1098:                    if (!supportedJavaPlatformsNames
1099:                            .contains(supportedJavaPlatformName)) {
1100:                        supportedJavaPlatforms.add(supportedJavaPlatform);
1101:                        supportedJavaPlatformsNames
1102:                                .add(supportedJavaPlatformName);
1103:                    }
1104:                }
1105:
1106:                supportedJavaPlatforms.addAll(JavaPlatformSelector
1107:                        .getSupportedPlatforms());
1108:            }
1109:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.