Source Code Cross Referenced for CustomizerRun.java in  » IDE-Netbeans » ruby » org » netbeans » modules » ruby » rubyproject » ui » customizer » 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 » ruby » org.netbeans.modules.ruby.rubyproject.ui.customizer 
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-2008 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:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:
0042:        package org.netbeans.modules.ruby.rubyproject.ui.customizer;
0043:
0044:        import java.awt.Component;
0045:        import java.awt.Dialog;
0046:        import java.awt.Font;
0047:        import java.awt.event.ActionEvent;
0048:        import java.awt.event.ActionListener;
0049:        import java.awt.event.MouseEvent;
0050:        import java.io.File;
0051:        import java.text.Collator;
0052:        import java.util.Comparator;
0053:        import java.util.HashMap;
0054:        import java.util.Map;
0055:        import java.util.SortedSet;
0056:        import java.util.TreeSet;
0057:        import javax.swing.DefaultComboBoxModel;
0058:        import javax.swing.DefaultListCellRenderer;
0059:        import javax.swing.JButton;
0060:        import javax.swing.JFileChooser;
0061:        import javax.swing.JLabel;
0062:        import javax.swing.JList;
0063:        import javax.swing.JPanel;
0064:        import javax.swing.JTextField;
0065:        import javax.swing.event.ChangeEvent;
0066:        import javax.swing.event.ChangeListener;
0067:        import javax.swing.event.DocumentEvent;
0068:        import javax.swing.event.DocumentListener;
0069:        import org.netbeans.api.ruby.platform.RubyPlatform;
0070:        import org.netbeans.modules.ruby.platform.PlatformComponentFactory;
0071:        import org.netbeans.modules.ruby.platform.RubyPlatformCustomizer;
0072:        import org.netbeans.modules.ruby.rubyproject.RubyProject;
0073:        import org.netbeans.modules.ruby.rubyproject.SourceRoots;
0074:        import org.openide.DialogDescriptor;
0075:        import org.openide.DialogDisplayer;
0076:        import org.openide.NotifyDescriptor;
0077:        import org.openide.awt.MouseUtils;
0078:        import org.openide.filesystems.FileUtil;
0079:        import org.openide.util.HelpCtx;
0080:        import org.openide.util.NbBundle;
0081:        import org.openide.util.Utilities;
0082:
0083:        public class CustomizerRun extends JPanel implements  HelpCtx.Provider {
0084:
0085:            private final RubyProject project;
0086:
0087:            private final JTextField[] data;
0088:            private final String[] keys;
0089:            private final Map<String/*|null*/, Map<String, String/*|null*/>/*|null*/> configs;
0090:            private final RubyProjectProperties uiProperties;
0091:            private PlatformComponentFactory.PlatformChangeListener platformListener;
0092:
0093:            public CustomizerRun(RubyProjectProperties uiProperties) {
0094:                this .uiProperties = uiProperties;
0095:                initComponents();
0096:
0097:                this .project = uiProperties.getProject();
0098:
0099:                configs = uiProperties.RUN_CONFIGS;
0100:
0101:                data = new JTextField[] { jTextFieldMainClass, jTextFieldArgs,
0102:                        jTextVMOptions, jTextWorkingDirectory, rakeTextField };
0103:                JLabel[] dataLabels = new JLabel[] { jLabelMainClass,
0104:                        jLabelArgs, jLabelVMOptions, jLabelWorkingDirectory,
0105:                        rakeLabel };
0106:                keys = new String[] { RubyProjectProperties.MAIN_CLASS,
0107:                        RubyProjectProperties.APPLICATION_ARGS,
0108:                        RubyProjectProperties.RUN_JVM_ARGS,
0109:                        RubyProjectProperties.RUN_WORK_DIR,
0110:                        RubyProjectProperties.RAKE_ARGS };
0111:                assert data.length == keys.length;
0112:
0113:                configChanged(uiProperties.activeConfig);
0114:
0115:                configCombo.setRenderer(new DefaultListCellRenderer() {
0116:                    public @Override
0117:                    Component getListCellRendererComponent(JList list,
0118:                            Object value, int index, boolean isSelected,
0119:                            boolean cellHasFocus) {
0120:                        String config = (String) value;
0121:                        String label;
0122:                        if (config == null) {
0123:                            // uninitialized?
0124:                            label = null;
0125:                        } else if (config.length() > 0) {
0126:                            Map<String, String> m = configs.get(config);
0127:                            label = m != null ? m.get("$label")
0128:                                    : /* temporary? */null; // NOI18N
0129:                            if (label == null) {
0130:                                label = config;
0131:                            }
0132:                        } else {
0133:                            label = NbBundle.getMessage(CustomizerRun.class,
0134:                                    "CustomizerRun.default");
0135:                        }
0136:                        return super .getListCellRendererComponent(list, label,
0137:                                index, isSelected, cellHasFocus);
0138:                    }
0139:                });
0140:
0141:                for (int i = 0; i < data.length; i++) {
0142:                    final JTextField field = data[i];
0143:                    final String prop = keys[i];
0144:                    final JLabel label = dataLabels[i];
0145:                    field.getDocument().addDocumentListener(
0146:                            new DocumentListener() {
0147:                                Font basefont = label.getFont();
0148:                                Font boldfont = basefont.deriveFont(Font.BOLD);
0149:                                {
0150:                                    updateFont();
0151:                                }
0152:
0153:                                public void insertUpdate(DocumentEvent e) {
0154:                                    changed();
0155:                                }
0156:
0157:                                public void removeUpdate(DocumentEvent e) {
0158:                                    changed();
0159:                                }
0160:
0161:                                public void changedUpdate(DocumentEvent e) {
0162:                                }
0163:
0164:                                void changed() {
0165:                                    String config = (String) configCombo
0166:                                            .getSelectedItem();
0167:                                    if (config.length() == 0) {
0168:                                        config = null;
0169:                                    }
0170:                                    String v = field.getText();
0171:                                    if (v != null
0172:                                            && config != null
0173:                                            && v.equals(configs.get(null).get(
0174:                                                    prop))) {
0175:                                        // default value, do not store as such
0176:                                        v = null;
0177:                                    }
0178:                                    configs.get(config).put(prop, v);
0179:                                    updateFont();
0180:                                }
0181:
0182:                                void updateFont() {
0183:                                    String v = field.getText();
0184:                                    String config = (String) configCombo
0185:                                            .getSelectedItem();
0186:                                    if (config.length() == 0) {
0187:                                        config = null;
0188:                                    }
0189:                                    String def = configs.get(null).get(prop);
0190:                                    label
0191:                                            .setFont(config != null
0192:                                                    && !Utilities
0193:                                                            .compareObjects(
0194:                                                                    v != null ? v
0195:                                                                            : "",
0196:                                                                    def != null ? def
0197:                                                                            : "") ? boldfont
0198:                                                    : basefont); // NOI18N
0199:                                }
0200:                            });
0201:                }
0202:
0203:                jButtonMainClass.addActionListener(new MainClassListener(
0204:                        project.getSourceRoots(), jTextFieldMainClass));
0205:                platforms.setSelectedItem(uiProperties.getPlatform());
0206:            }
0207:
0208:            public @Override
0209:            void addNotify() {
0210:                super .addNotify();
0211:                platformListener = new PlatformComponentFactory.PlatformChangeListener() {
0212:                    public void platformChanged() {
0213:                        uiProperties.setPlatform(((RubyPlatform) platforms
0214:                                .getSelectedItem()));
0215:                    }
0216:                };
0217:                PlatformComponentFactory.addPlatformChangeListener(platforms,
0218:                        platformListener);
0219:            }
0220:
0221:            public @Override
0222:            void removeNotify() {
0223:                PlatformComponentFactory.removePlatformChangeListener(
0224:                        platforms, platformListener);
0225:                super .removeNotify();
0226:            }
0227:
0228:            public HelpCtx getHelpCtx() {
0229:                return new HelpCtx(CustomizerRun.class);
0230:            }
0231:
0232:            /** This method is called from within the constructor to
0233:             * initialize the form.
0234:             * WARNING: Do NOT modify this code. The content of this method is
0235:             * always regenerated by the Form Editor.
0236:             */
0237:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
0238:            private void initComponents() {
0239:
0240:                configSep = new javax.swing.JSeparator();
0241:                configPanel = new javax.swing.JPanel();
0242:                mainPanel = new javax.swing.JPanel();
0243:                jLabelMainClass = new javax.swing.JLabel();
0244:                jTextFieldMainClass = new javax.swing.JTextField();
0245:                jButtonMainClass = new javax.swing.JButton();
0246:                jLabelArgs = new javax.swing.JLabel();
0247:                jTextFieldArgs = new javax.swing.JTextField();
0248:                jLabelWorkingDirectory = new javax.swing.JLabel();
0249:                jTextWorkingDirectory = new javax.swing.JTextField();
0250:                jButtonWorkingDirectoryBrowse = new javax.swing.JButton();
0251:                jLabelVMOptions = new javax.swing.JLabel();
0252:                jTextVMOptions = new javax.swing.JTextField();
0253:                jLabelVMOptionsExample = new javax.swing.JLabel();
0254:                rakeLabel = new javax.swing.JLabel();
0255:                rakeTextField = new javax.swing.JTextField();
0256:                rakeExampleLabel = new javax.swing.JLabel();
0257:                rubyPlatformLabel = new javax.swing.JLabel();
0258:                platforms = org.netbeans.modules.ruby.platform.PlatformComponentFactory
0259:                        .getRubyPlatformsComboxBox();
0260:                manageButton = new javax.swing.JButton();
0261:                configLabel = new javax.swing.JLabel();
0262:                configCombo = new javax.swing.JComboBox();
0263:                configDel = new javax.swing.JButton();
0264:                configNew = new javax.swing.JButton();
0265:
0266:                configPanel.setLayout(new java.awt.GridBagLayout());
0267:
0268:                jLabelMainClass.setLabelFor(jTextFieldMainClass);
0269:                org.openide.awt.Mnemonics.setLocalizedText(jLabelMainClass,
0270:                        org.openide.util.NbBundle.getMessage(
0271:                                CustomizerRun.class,
0272:                                "LBL_CustomizeRun_Run_MainClass_JLabel")); // NOI18N
0273:
0274:                org.openide.awt.Mnemonics.setLocalizedText(jButtonMainClass,
0275:                        org.openide.util.NbBundle.getMessage(
0276:                                CustomizerRun.class,
0277:                                "LBL_CustomizeRun_Run_MainClass_JButton")); // NOI18N
0278:
0279:                jLabelArgs.setLabelFor(jTextFieldArgs);
0280:                org.openide.awt.Mnemonics.setLocalizedText(jLabelArgs,
0281:                        org.openide.util.NbBundle.getMessage(
0282:                                CustomizerRun.class,
0283:                                "LBL_CustomizeRun_Run_Args_JLabel")); // NOI18N
0284:
0285:                jLabelWorkingDirectory.setLabelFor(jTextWorkingDirectory);
0286:                org.openide.awt.Mnemonics.setLocalizedText(
0287:                        jLabelWorkingDirectory,
0288:                        org.openide.util.NbBundle.getMessage(
0289:                                CustomizerRun.class,
0290:                                "LBL_CustomizeRun_Run_Working_Directory")); // NOI18N
0291:
0292:                org.openide.awt.Mnemonics
0293:                        .setLocalizedText(
0294:                                jButtonWorkingDirectoryBrowse,
0295:                                org.openide.util.NbBundle
0296:                                        .getMessage(CustomizerRun.class,
0297:                                                "LBL_CustomizeRun_Run_Working_Directory_Browse")); // NOI18N
0298:                jButtonWorkingDirectoryBrowse
0299:                        .addActionListener(new java.awt.event.ActionListener() {
0300:                            public void actionPerformed(
0301:                                    java.awt.event.ActionEvent evt) {
0302:                                jButtonWorkingDirectoryBrowseActionPerformed(evt);
0303:                            }
0304:                        });
0305:
0306:                jLabelVMOptions.setLabelFor(jTextVMOptions);
0307:                org.openide.awt.Mnemonics.setLocalizedText(jLabelVMOptions,
0308:                        org.openide.util.NbBundle.getMessage(
0309:                                CustomizerRun.class,
0310:                                "LBL_CustomizeRun_Run_VM_Options")); // NOI18N
0311:
0312:                org.openide.awt.Mnemonics.setLocalizedText(
0313:                        jLabelVMOptionsExample,
0314:                        org.openide.util.NbBundle.getMessage(
0315:                                CustomizerRun.class,
0316:                                "LBL_CustomizeRun_Run_VM_Options_Example")); // NOI18N
0317:
0318:                rakeLabel.setLabelFor(rakeTextField);
0319:                org.openide.awt.Mnemonics.setLocalizedText(rakeLabel,
0320:                        org.openide.util.NbBundle.getMessage(
0321:                                CustomizerRun.class, "RakeArgs")); // NOI18N
0322:
0323:                org.openide.awt.Mnemonics.setLocalizedText(rakeExampleLabel,
0324:                        org.openide.util.NbBundle.getMessage(
0325:                                CustomizerRun.class, "RakeArgsEx")); // NOI18N
0326:
0327:                org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(
0328:                        mainPanel);
0329:                mainPanel.setLayout(mainPanelLayout);
0330:                mainPanelLayout
0331:                        .setHorizontalGroup(mainPanelLayout
0332:                                .createParallelGroup(
0333:                                        org.jdesktop.layout.GroupLayout.LEADING)
0334:                                .add(
0335:                                        mainPanelLayout
0336:                                                .createSequentialGroup()
0337:                                                .add(
0338:                                                        mainPanelLayout
0339:                                                                .createParallelGroup(
0340:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0341:                                                                .add(
0342:                                                                        jLabelWorkingDirectory)
0343:                                                                .add(jLabelArgs)
0344:                                                                .add(
0345:                                                                        jLabelMainClass))
0346:                                                .addPreferredGap(
0347:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0348:                                                .add(
0349:                                                        mainPanelLayout
0350:                                                                .createParallelGroup(
0351:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0352:                                                                .add(
0353:                                                                        jTextFieldMainClass,
0354:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0355:                                                                        485,
0356:                                                                        Short.MAX_VALUE)
0357:                                                                .add(
0358:                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
0359:                                                                        jTextFieldArgs,
0360:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0361:                                                                        485,
0362:                                                                        Short.MAX_VALUE)
0363:                                                                .add(
0364:                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
0365:                                                                        jTextVMOptions,
0366:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0367:                                                                        485,
0368:                                                                        Short.MAX_VALUE)
0369:                                                                .add(
0370:                                                                        mainPanelLayout
0371:                                                                                .createSequentialGroup()
0372:                                                                                .add(
0373:                                                                                        jTextWorkingDirectory,
0374:                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0375:                                                                                        485,
0376:                                                                                        Short.MAX_VALUE)
0377:                                                                                .addPreferredGap(
0378:                                                                                        org.jdesktop.layout.LayoutStyle.UNRELATED))
0379:                                                                .add(
0380:                                                                        mainPanelLayout
0381:                                                                                .createSequentialGroup()
0382:                                                                                .addPreferredGap(
0383:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0384:                                                                                .add(
0385:                                                                                        mainPanelLayout
0386:                                                                                                .createParallelGroup(
0387:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0388:                                                                                                .add(
0389:                                                                                                        rakeTextField,
0390:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0391:                                                                                                        485,
0392:                                                                                                        Short.MAX_VALUE)
0393:                                                                                                .add(
0394:                                                                                                        mainPanelLayout
0395:                                                                                                                .createSequentialGroup()
0396:                                                                                                                .add(
0397:                                                                                                                        jLabelVMOptionsExample)
0398:                                                                                                                .addPreferredGap(
0399:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED,
0400:                                                                                                                        437,
0401:                                                                                                                        Short.MAX_VALUE))
0402:                                                                                                .add(
0403:                                                                                                        rakeExampleLabel))))
0404:                                                .add(9, 9, 9)
0405:                                                .add(
0406:                                                        mainPanelLayout
0407:                                                                .createParallelGroup(
0408:                                                                        org.jdesktop.layout.GroupLayout.TRAILING)
0409:                                                                .add(
0410:                                                                        jButtonWorkingDirectoryBrowse)
0411:                                                                .add(
0412:                                                                        jButtonMainClass)))
0413:                                .add(
0414:                                        mainPanelLayout.createSequentialGroup()
0415:                                                .add(jLabelVMOptions)
0416:                                                .addContainerGap()).add(
0417:                                        mainPanelLayout.createSequentialGroup()
0418:                                                .add(rakeLabel)
0419:                                                .addContainerGap()));
0420:                mainPanelLayout
0421:                        .setVerticalGroup(mainPanelLayout
0422:                                .createParallelGroup(
0423:                                        org.jdesktop.layout.GroupLayout.LEADING)
0424:                                .add(
0425:                                        mainPanelLayout
0426:                                                .createSequentialGroup()
0427:                                                .add(
0428:                                                        mainPanelLayout
0429:                                                                .createParallelGroup(
0430:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0431:                                                                .add(
0432:                                                                        jLabelMainClass)
0433:                                                                .add(
0434:                                                                        jButtonMainClass)
0435:                                                                .add(
0436:                                                                        jTextFieldMainClass,
0437:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0438:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0439:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0440:                                                .addPreferredGap(
0441:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0442:                                                .add(
0443:                                                        mainPanelLayout
0444:                                                                .createParallelGroup(
0445:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0446:                                                                .add(jLabelArgs)
0447:                                                                .add(
0448:                                                                        jTextFieldArgs,
0449:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0450:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0451:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0452:                                                .addPreferredGap(
0453:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0454:                                                .add(
0455:                                                        mainPanelLayout
0456:                                                                .createParallelGroup(
0457:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0458:                                                                .add(
0459:                                                                        jLabelWorkingDirectory)
0460:                                                                .add(
0461:                                                                        jButtonWorkingDirectoryBrowse)
0462:                                                                .add(
0463:                                                                        jTextWorkingDirectory,
0464:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0465:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0466:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0467:                                                .addPreferredGap(
0468:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0469:                                                .add(
0470:                                                        mainPanelLayout
0471:                                                                .createParallelGroup(
0472:                                                                        org.jdesktop.layout.GroupLayout.TRAILING)
0473:                                                                .add(
0474:                                                                        jLabelVMOptions)
0475:                                                                .add(
0476:                                                                        jTextVMOptions,
0477:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0478:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0479:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0480:                                                .add(0, 0, 0)
0481:                                                .add(jLabelVMOptionsExample)
0482:                                                .addPreferredGap(
0483:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0484:                                                .add(
0485:                                                        mainPanelLayout
0486:                                                                .createParallelGroup(
0487:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0488:                                                                .add(rakeLabel)
0489:                                                                .add(
0490:                                                                        rakeTextField,
0491:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0492:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0493:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0494:                                                .add(0, 0, 0)
0495:                                                .add(rakeExampleLabel)
0496:                                                .addContainerGap(
0497:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0498:                                                        Short.MAX_VALUE)));
0499:
0500:                jTextFieldMainClass
0501:                        .getAccessibleContext()
0502:                        .setAccessibleName(
0503:                                org.openide.util.NbBundle
0504:                                        .getMessage(CustomizerRun.class,
0505:                                                "CustomizerRun.jTextFieldMainClass.AccessibleContext.accessibleName")); // NOI18N
0506:                jTextFieldMainClass.getAccessibleContext()
0507:                        .setAccessibleDescription(
0508:                                org.openide.util.NbBundle.getBundle(
0509:                                        CustomizerRun.class).getString(
0510:                                        "AD_jTextFieldMainClass")); // NOI18N
0511:                jButtonMainClass.getAccessibleContext()
0512:                        .setAccessibleDescription(
0513:                                org.openide.util.NbBundle.getBundle(
0514:                                        CustomizerRun.class).getString(
0515:                                        "AD_jButtonMainClass")); // NOI18N
0516:                jTextFieldArgs
0517:                        .getAccessibleContext()
0518:                        .setAccessibleName(
0519:                                org.openide.util.NbBundle
0520:                                        .getMessage(CustomizerRun.class,
0521:                                                "CustomizerRun.jTextFieldArgs.AccessibleContext.accessibleName")); // NOI18N
0522:                jTextFieldArgs.getAccessibleContext().setAccessibleDescription(
0523:                        org.openide.util.NbBundle
0524:                                .getBundle(CustomizerRun.class).getString(
0525:                                        "AD_jTextFieldArgs")); // NOI18N
0526:                jTextWorkingDirectory
0527:                        .getAccessibleContext()
0528:                        .setAccessibleName(
0529:                                org.openide.util.NbBundle
0530:                                        .getMessage(CustomizerRun.class,
0531:                                                "CustomizerRun.jTextWorkingDirectory.AccessibleContext.accessibleName")); // NOI18N
0532:                java.util.ResourceBundle bundle = java.util.ResourceBundle
0533:                        .getBundle("org/netbeans/modules/ruby/rubyproject/ui/customizer/Bundle"); // NOI18N
0534:                jTextWorkingDirectory
0535:                        .getAccessibleContext()
0536:                        .setAccessibleDescription(
0537:                                bundle
0538:                                        .getString("AD_CustomizeRun_Run_Working_Directory")); // NOI18N
0539:                jButtonWorkingDirectoryBrowse
0540:                        .getAccessibleContext()
0541:                        .setAccessibleDescription(
0542:                                bundle
0543:                                        .getString("AD_CustomizeRun_Run_Working_Directory_Browse")); // NOI18N
0544:                jTextVMOptions
0545:                        .getAccessibleContext()
0546:                        .setAccessibleName(
0547:                                org.openide.util.NbBundle
0548:                                        .getMessage(CustomizerRun.class,
0549:                                                "CustomizerRun.jTextVMOptions.AccessibleContext.accessibleName")); // NOI18N
0550:                jTextVMOptions.getAccessibleContext().setAccessibleDescription(
0551:                        bundle.getString("AD_CustomizeRun_Run_VM_Options")); // NOI18N
0552:                jLabelVMOptionsExample
0553:                        .getAccessibleContext()
0554:                        .setAccessibleDescription(
0555:                                bundle
0556:                                        .getString("LBL_CustomizeRun_Run_VM_Options_Example")); // NOI18N
0557:                rakeLabel
0558:                        .getAccessibleContext()
0559:                        .setAccessibleDescription(
0560:                                org.openide.util.NbBundle
0561:                                        .getMessage(CustomizerRun.class,
0562:                                                "CustomizerRun.rakeLabel.AccessibleContext.accessibleDescription")); // NOI18N
0563:                rakeTextField
0564:                        .getAccessibleContext()
0565:                        .setAccessibleName(
0566:                                org.openide.util.NbBundle
0567:                                        .getMessage(CustomizerRun.class,
0568:                                                "CustomizerRun.rakeTextField.AccessibleContext.accessibleName")); // NOI18N
0569:
0570:                rubyPlatformLabel.setLabelFor(platforms);
0571:                org.openide.awt.Mnemonics.setLocalizedText(rubyPlatformLabel,
0572:                        org.openide.util.NbBundle.getMessage(
0573:                                CustomizerRun.class, "RubyPlatformLabel")); // NOI18N
0574:
0575:                org.openide.awt.Mnemonics.setLocalizedText(manageButton,
0576:                        org.openide.util.NbBundle.getMessage(
0577:                                CustomizerRun.class, "RubyHomeBrowse")); // NOI18N
0578:                manageButton
0579:                        .addActionListener(new java.awt.event.ActionListener() {
0580:                            public void actionPerformed(
0581:                                    java.awt.event.ActionEvent evt) {
0582:                                manageButtonActionPerformed(evt);
0583:                            }
0584:                        });
0585:
0586:                configLabel.setLabelFor(configCombo);
0587:                org.openide.awt.Mnemonics.setLocalizedText(configLabel,
0588:                        org.openide.util.NbBundle.getMessage(
0589:                                CustomizerRun.class,
0590:                                "CustomizerRun.configLabel")); // NOI18N
0591:
0592:                configCombo.setModel(new javax.swing.DefaultComboBoxModel(
0593:                        new String[] { "<default>" })); // NOI18N
0594:                configCombo
0595:                        .addActionListener(new java.awt.event.ActionListener() {
0596:                            public void actionPerformed(
0597:                                    java.awt.event.ActionEvent evt) {
0598:                                configComboActionPerformed(evt);
0599:                            }
0600:                        });
0601:
0602:                org.openide.awt.Mnemonics.setLocalizedText(configDel,
0603:                        org.openide.util.NbBundle.getMessage(
0604:                                CustomizerRun.class,
0605:                                "CustomizerRun.configDelete")); // NOI18N
0606:                configDel
0607:                        .addActionListener(new java.awt.event.ActionListener() {
0608:                            public void actionPerformed(
0609:                                    java.awt.event.ActionEvent evt) {
0610:                                configDelActionPerformed(evt);
0611:                            }
0612:                        });
0613:
0614:                org.openide.awt.Mnemonics
0615:                        .setLocalizedText(configNew, org.openide.util.NbBundle
0616:                                .getMessage(CustomizerRun.class,
0617:                                        "CustomizerRun.configNew")); // NOI18N
0618:                configNew
0619:                        .addActionListener(new java.awt.event.ActionListener() {
0620:                            public void actionPerformed(
0621:                                    java.awt.event.ActionEvent evt) {
0622:                                configNewActionPerformed(evt);
0623:                            }
0624:                        });
0625:
0626:                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
0627:                        this );
0628:                this .setLayout(layout);
0629:                layout
0630:                        .setHorizontalGroup(layout
0631:                                .createParallelGroup(
0632:                                        org.jdesktop.layout.GroupLayout.LEADING)
0633:                                .add(
0634:                                        org.jdesktop.layout.GroupLayout.TRAILING,
0635:                                        layout
0636:                                                .createSequentialGroup()
0637:                                                .add(
0638:                                                        layout
0639:                                                                .createParallelGroup(
0640:                                                                        org.jdesktop.layout.GroupLayout.TRAILING)
0641:                                                                .add(
0642:                                                                        org.jdesktop.layout.GroupLayout.LEADING,
0643:                                                                        mainPanel,
0644:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0645:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0646:                                                                        Short.MAX_VALUE)
0647:                                                                .add(
0648:                                                                        org.jdesktop.layout.GroupLayout.LEADING,
0649:                                                                        configPanel,
0650:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0651:                                                                        410,
0652:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
0653:                                                                .add(
0654:                                                                        org.jdesktop.layout.GroupLayout.LEADING,
0655:                                                                        layout
0656:                                                                                .createSequentialGroup()
0657:                                                                                .add(
0658:                                                                                        layout
0659:                                                                                                .createParallelGroup(
0660:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0661:                                                                                                .add(
0662:                                                                                                        rubyPlatformLabel)
0663:                                                                                                .add(
0664:                                                                                                        configLabel))
0665:                                                                                .addPreferredGap(
0666:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0667:                                                                                .add(
0668:                                                                                        layout
0669:                                                                                                .createParallelGroup(
0670:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0671:                                                                                                .add(
0672:                                                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
0673:                                                                                                        platforms,
0674:                                                                                                        0,
0675:                                                                                                        452,
0676:                                                                                                        Short.MAX_VALUE)
0677:                                                                                                .add(
0678:                                                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
0679:                                                                                                        configCombo,
0680:                                                                                                        0,
0681:                                                                                                        452,
0682:                                                                                                        Short.MAX_VALUE))
0683:                                                                                .addPreferredGap(
0684:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0685:                                                                                .add(
0686:                                                                                        layout
0687:                                                                                                .createParallelGroup(
0688:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0689:                                                                                                .add(
0690:                                                                                                        layout
0691:                                                                                                                .createSequentialGroup()
0692:                                                                                                                .add(
0693:                                                                                                                        configNew)
0694:                                                                                                                .addPreferredGap(
0695:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0696:                                                                                                                .add(
0697:                                                                                                                        configDel))
0698:                                                                                                .add(
0699:                                                                                                        manageButton))
0700:                                                                                .addPreferredGap(
0701:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED))
0702:                                                                .add(
0703:                                                                        configSep,
0704:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0705:                                                                        711,
0706:                                                                        Short.MAX_VALUE))
0707:                                                .addContainerGap()));
0708:                layout
0709:                        .setVerticalGroup(layout
0710:                                .createParallelGroup(
0711:                                        org.jdesktop.layout.GroupLayout.LEADING)
0712:                                .add(
0713:                                        layout
0714:                                                .createSequentialGroup()
0715:                                                .add(
0716:                                                        layout
0717:                                                                .createParallelGroup(
0718:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0719:                                                                .add(
0720:                                                                        rubyPlatformLabel)
0721:                                                                .add(
0722:                                                                        platforms,
0723:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0724:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0725:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
0726:                                                                .add(
0727:                                                                        manageButton))
0728:                                                .add(
0729:                                                        layout
0730:                                                                .createParallelGroup(
0731:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0732:                                                                .add(
0733:                                                                        layout
0734:                                                                                .createSequentialGroup()
0735:                                                                                .add(
0736:                                                                                        6,
0737:                                                                                        6,
0738:                                                                                        6)
0739:                                                                                .add(
0740:                                                                                        layout
0741:                                                                                                .createParallelGroup(
0742:                                                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0743:                                                                                                .add(
0744:                                                                                                        configLabel)
0745:                                                                                                .add(
0746:                                                                                                        configCombo,
0747:                                                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0748:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0749:                                                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0750:                                                                                .addPreferredGap(
0751:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0752:                                                                                .add(
0753:                                                                                        configPanel,
0754:                                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0755:                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0756:                                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0757:                                                                .add(
0758:                                                                        layout
0759:                                                                                .createSequentialGroup()
0760:                                                                                .addPreferredGap(
0761:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0762:                                                                                .add(
0763:                                                                                        layout
0764:                                                                                                .createParallelGroup(
0765:                                                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0766:                                                                                                .add(
0767:                                                                                                        configDel)
0768:                                                                                                .add(
0769:                                                                                                        configNew))))
0770:                                                .addPreferredGap(
0771:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0772:                                                .add(
0773:                                                        configSep,
0774:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0775:                                                        2,
0776:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
0777:                                                .addPreferredGap(
0778:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0779:                                                .add(
0780:                                                        mainPanel,
0781:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0782:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0783:                                                        Short.MAX_VALUE)));
0784:
0785:                rubyPlatformLabel
0786:                        .getAccessibleContext()
0787:                        .setAccessibleDescription(
0788:                                org.openide.util.NbBundle
0789:                                        .getMessage(CustomizerRun.class,
0790:                                                "CustomizerRun.rubyPlatformLabel.AccessibleContext.accessibleDescription")); // NOI18N
0791:                manageButton
0792:                        .getAccessibleContext()
0793:                        .setAccessibleDescription(
0794:                                org.openide.util.NbBundle
0795:                                        .getMessage(CustomizerRun.class,
0796:                                                "CustomizerRun.manageButton.AccessibleContext.accessibleDescription")); // NOI18N
0797:                configLabel
0798:                        .getAccessibleContext()
0799:                        .setAccessibleDescription(
0800:                                org.openide.util.NbBundle
0801:                                        .getMessage(CustomizerRun.class,
0802:                                                "CustomizerRun.configLabel.AccessibleContext.accessibleDescription")); // NOI18N
0803:                configNew
0804:                        .getAccessibleContext()
0805:                        .setAccessibleDescription(
0806:                                org.openide.util.NbBundle
0807:                                        .getMessage(CustomizerRun.class,
0808:                                                "CustomizerRun.configNew.AccessibleContext.accessibleDescription")); // NOI18N
0809:            }// </editor-fold>//GEN-END:initComponents
0810:
0811:            private void configDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configDelActionPerformed
0812:                String config = (String) configCombo.getSelectedItem();
0813:                assert config != null;
0814:                configs.put(config, null);
0815:                configChanged(null);
0816:                uiProperties.activeConfig = null;
0817:            }//GEN-LAST:event_configDelActionPerformed
0818:
0819:            private void configNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configNewActionPerformed
0820:                NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine(
0821:                        NbBundle.getMessage(CustomizerRun.class,
0822:                                "CustomizerRun.input.prompt"), NbBundle
0823:                                .getMessage(CustomizerRun.class,
0824:                                        "CustomizerRun.input.title"));
0825:                if (DialogDisplayer.getDefault().notify(d) != NotifyDescriptor.OK_OPTION) {
0826:                    return;
0827:                }
0828:                String name = d.getInputText();
0829:                String config = name.replaceAll("[^a-zA-Z0-9_.-]", "_"); // NOI18N
0830:                if (configs.get(config) != null) {
0831:                    DialogDisplayer.getDefault().notify(
0832:                            new NotifyDescriptor.Message(NbBundle.getMessage(
0833:                                    CustomizerRun.class,
0834:                                    "CustomizerRun.input.duplicate", config),
0835:                                    NotifyDescriptor.WARNING_MESSAGE));
0836:                    return;
0837:                }
0838:                Map<String, String> m = new HashMap<String, String>();
0839:                if (!name.equals(config)) {
0840:                    m.put("$label", name); // NOI18N
0841:                }
0842:                configs.put(config, m);
0843:                configChanged(config);
0844:                uiProperties.activeConfig = config;
0845:            }//GEN-LAST:event_configNewActionPerformed
0846:
0847:            private void configComboActionPerformed(
0848:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configComboActionPerformed
0849:                String config = (String) configCombo.getSelectedItem();
0850:                if (config.length() == 0) {
0851:                    config = null;
0852:                }
0853:                configChanged(config);
0854:                uiProperties.activeConfig = config;
0855:            }//GEN-LAST:event_configComboActionPerformed
0856:
0857:            private void jButtonWorkingDirectoryBrowseActionPerformed(
0858:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonWorkingDirectoryBrowseActionPerformed
0859:                JFileChooser chooser = new JFileChooser();
0860:                FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
0861:                chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
0862:                chooser.setMultiSelectionEnabled(false);
0863:
0864:                String workDir = jTextWorkingDirectory.getText();
0865:                if (workDir.equals("")) {
0866:                    workDir = FileUtil.toFile(project.getProjectDirectory())
0867:                            .getAbsolutePath();
0868:                }
0869:                chooser.setSelectedFile(new File(workDir));
0870:                chooser.setDialogTitle(NbBundle.getMessage(CustomizerRun.class,
0871:                        "LBL_CustomizeRun_Run_Working_Directory_Browse_Title"));
0872:                if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this )) { //NOI18N
0873:                    File file = FileUtil.normalizeFile(chooser
0874:                            .getSelectedFile());
0875:                    jTextWorkingDirectory.setText(file.getAbsolutePath());
0876:                }
0877:            }//GEN-LAST:event_jButtonWorkingDirectoryBrowseActionPerformed
0878:
0879:            private void manageButtonActionPerformed(
0880:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageButtonActionPerformed
0881:                RubyPlatformCustomizer.manage(platforms);
0882:            }//GEN-LAST:event_manageButtonActionPerformed
0883:
0884:            private void configChanged(String activeConfig) {
0885:                DefaultComboBoxModel model = new DefaultComboBoxModel();
0886:                model.addElement("");
0887:                SortedSet<String> alphaConfigs = new TreeSet<String>(
0888:                        new Comparator<String>() {
0889:                            Collator coll = Collator.getInstance();
0890:
0891:                            public int compare(String s1, String s2) {
0892:                                return coll.compare(label(s1), label(s2));
0893:                            }
0894:
0895:                            private String label(String c) {
0896:                                Map<String, String> m = configs.get(c);
0897:                                String label = m.get("$label"); // NOI18N
0898:                                return label != null ? label : c;
0899:                            }
0900:                        });
0901:                for (Map.Entry<String, Map<String, String>> entry : configs
0902:                        .entrySet()) {
0903:                    String config = entry.getKey();
0904:                    if (config != null && entry.getValue() != null) {
0905:                        alphaConfigs.add(config);
0906:                    }
0907:                }
0908:                for (String c : alphaConfigs) {
0909:                    model.addElement(c);
0910:                }
0911:                configCombo.setModel(model);
0912:                configCombo.setSelectedItem(activeConfig != null ? activeConfig
0913:                        : "");
0914:                Map<String, String> m = configs.get(activeConfig);
0915:                Map<String, String> def = configs.get(null);
0916:                if (m != null) {
0917:                    for (int i = 0; i < data.length; i++) {
0918:                        String v = m.get(keys[i]);
0919:                        if (v == null) {
0920:                            // display default value
0921:                            v = def.get(keys[i]);
0922:                        }
0923:                        data[i].setText(v);
0924:                    }
0925:                } // else ??
0926:                configDel.setEnabled(activeConfig != null);
0927:            }
0928:
0929:            // Variables declaration - do not modify//GEN-BEGIN:variables
0930:            private javax.swing.JComboBox configCombo;
0931:            private javax.swing.JButton configDel;
0932:            private javax.swing.JLabel configLabel;
0933:            private javax.swing.JButton configNew;
0934:            private javax.swing.JPanel configPanel;
0935:            private javax.swing.JSeparator configSep;
0936:            private javax.swing.JButton jButtonMainClass;
0937:            private javax.swing.JButton jButtonWorkingDirectoryBrowse;
0938:            private javax.swing.JLabel jLabelArgs;
0939:            private javax.swing.JLabel jLabelMainClass;
0940:            private javax.swing.JLabel jLabelVMOptions;
0941:            private javax.swing.JLabel jLabelVMOptionsExample;
0942:            private javax.swing.JLabel jLabelWorkingDirectory;
0943:            private javax.swing.JTextField jTextFieldArgs;
0944:            private javax.swing.JTextField jTextFieldMainClass;
0945:            private javax.swing.JTextField jTextVMOptions;
0946:            private javax.swing.JTextField jTextWorkingDirectory;
0947:            private javax.swing.JPanel mainPanel;
0948:            private javax.swing.JButton manageButton;
0949:            private javax.swing.JComboBox platforms;
0950:            private javax.swing.JLabel rakeExampleLabel;
0951:            private javax.swing.JLabel rakeLabel;
0952:            private javax.swing.JTextField rakeTextField;
0953:            private javax.swing.JLabel rubyPlatformLabel;
0954:
0955:            // End of variables declaration//GEN-END:variables
0956:
0957:            private class MainClassListener implements  ActionListener /*, DocumentListener */{
0958:
0959:                private final JButton okButton;
0960:                private final SourceRoots sourceRoots;
0961:                private final JTextField mainClassTextField;
0962:
0963:                MainClassListener(SourceRoots sourceRoots,
0964:                        JTextField mainClassTextField) {
0965:                    this .sourceRoots = sourceRoots;
0966:                    this .mainClassTextField = mainClassTextField;
0967:                    this .okButton = new JButton(NbBundle.getMessage(
0968:                            CustomizerRun.class, "LBL_ChooseMainClass_OK"));
0969:                    this .okButton.getAccessibleContext()
0970:                            .setAccessibleDescription(
0971:                                    NbBundle.getMessage(CustomizerRun.class,
0972:                                            "AD_ChooseMainClass_OK"));
0973:                }
0974:
0975:                /** Handles button events */
0976:                public void actionPerformed(ActionEvent e) {
0977:                    // only chooseMainClassButton can be performed
0978:                    final MainClassChooser panel = new MainClassChooser(
0979:                            sourceRoots.getRoots());
0980:                    Object[] options = new Object[] { okButton,
0981:                            DialogDescriptor.CANCEL_OPTION };
0982:                    panel.addChangeListener(new ChangeListener() {
0983:                        public void stateChanged(ChangeEvent e) {
0984:                            if (e.getSource() instanceof  MouseEvent
0985:                                    && MouseUtils.isDoubleClick(((MouseEvent) e
0986:                                            .getSource()))) {
0987:                                // click button and finish the dialog with selected class
0988:                                okButton.doClick();
0989:                            } else {
0990:                                okButton.setEnabled(panel
0991:                                        .getSelectedMainClass() != null);
0992:                            }
0993:                        }
0994:                    });
0995:                    okButton.setEnabled(false);
0996:                    DialogDescriptor desc = new DialogDescriptor(panel,
0997:                            NbBundle.getMessage(CustomizerRun.class,
0998:                                    "LBL_ChooseMainClass_Title"), true,
0999:                            options, options[0], DialogDescriptor.BOTTOM_ALIGN,
1000:                            null, null);
1001:                    //desc.setMessageType (DialogDescriptor.INFORMATION_MESSAGE);
1002:                    Dialog dlg = DialogDisplayer.getDefault()
1003:                            .createDialog(desc);
1004:                    dlg.setVisible(true);
1005:                    if (desc.getValue() == options[0]) {
1006:                        mainClassTextField
1007:                                .setText(panel.getSelectedMainClass());
1008:                    }
1009:                    dlg.dispose();
1010:                }
1011:
1012:            }
1013:
1014:        }
w_w_w__.___ja___v___a___2__s._c_o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.