Source Code Cross Referenced for ToolsPanel.java in  » IDE-Netbeans » cnd » org » netbeans » modules » cnd » ui » options » 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 » cnd » org.netbeans.modules.cnd.ui.options 
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:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 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.cnd.ui.options;
0043:
0044:        import java.awt.Color;
0045:        import java.awt.Dialog;
0046:        import java.awt.HeadlessException;
0047:        import java.awt.event.ActionEvent;
0048:        import java.awt.event.ActionListener;
0049:        import java.awt.event.ItemEvent;
0050:        import java.awt.event.ItemListener;
0051:        import java.io.File;
0052:        import java.io.IOException;
0053:        import java.lang.StringBuilder;
0054:        import java.util.ArrayList;
0055:        import java.util.HashMap;
0056:        import java.util.HashSet;
0057:        import java.util.List;
0058:        import java.util.ResourceBundle;
0059:        import java.util.Set;
0060:        import java.util.StringTokenizer;
0061:        import javax.swing.DefaultComboBoxModel;
0062:        import javax.swing.JButton;
0063:        import javax.swing.JCheckBox;
0064:        import javax.swing.JComboBox;
0065:        import javax.swing.JFileChooser;
0066:        import javax.swing.JPanel;
0067:        import javax.swing.JScrollPane;
0068:        import javax.swing.JTextField;
0069:        import javax.swing.event.ChangeEvent;
0070:        import javax.swing.event.ChangeListener;
0071:        import javax.swing.event.DocumentEvent;
0072:        import javax.swing.event.DocumentListener;
0073:        import javax.swing.event.ListSelectionEvent;
0074:        import javax.swing.event.ListSelectionListener;
0075:        import javax.swing.text.AttributeSet;
0076:        import javax.swing.text.BadLocationException;
0077:        import javax.swing.text.Document;
0078:        import javax.swing.text.PlainDocument;
0079:        import org.netbeans.modules.cnd.MIMENames;
0080:        import org.netbeans.modules.cnd.api.compilers.CompilerSet;
0081:        import org.netbeans.modules.cnd.api.compilers.CompilerSet.CompilerFlavor;
0082:        import org.netbeans.modules.cnd.api.compilers.CompilerSetManager;
0083:        import org.netbeans.modules.cnd.api.compilers.Tool;
0084:        import org.netbeans.modules.cnd.api.utils.IpeUtils;
0085:        import org.netbeans.modules.cnd.api.utils.Path;
0086:        import org.netbeans.modules.cnd.settings.CppSettings;
0087:        import org.openide.DialogDescriptor;
0088:        import org.openide.DialogDisplayer;
0089:        import org.openide.NotifyDescriptor;
0090:        import org.openide.filesystems.FileObject;
0091:        import org.openide.filesystems.FileUtil;
0092:        import org.openide.util.NbBundle;
0093:        import org.openide.util.RequestProcessor;
0094:
0095:        /** Display the "Tools Default" panel */
0096:        public class ToolsPanel extends JPanel implements  ActionListener,
0097:                DocumentListener, ListSelectionListener, ItemListener {
0098:
0099:            // The following are constants so I can do == rather than "equals"
0100:            private final String MAKE_NAME = "make"; // NOI18N
0101:            private final String GDB_NAME = "gdb"; // NOI18N
0102:            //    private final String C_NAME = "C"; // NOI18N
0103:            //    private final String Cpp_NAME = "C++"; // NOI18N
0104:            //    private final String FORTRAN_NAME = "Fortran"; // NOI18N
0105:
0106:            private static final String DIRECTORY_MOVE_UP = "Up"; // NOI18N
0107:            private static final String DIRECTORY_MOVE_DOWN = "Down"; // NOI18N
0108:
0109:            public static final String PROP_VALID = "valid"; // NOI18N
0110:
0111:            private boolean initialized = false;
0112:            private boolean changed;
0113:            private boolean changingCompilerSet;
0114:            private boolean updating;
0115:            private boolean valid;
0116:            private static ArrayList<String> dirlist = null;
0117:            private ToolsPanelModel model = null;
0118:            private Color tfColor = null;
0119:            private boolean gdbEnabled;
0120:
0121:            private Tool cCommandSelection = null;
0122:            private Tool cppCommandSelection = null;
0123:            private Tool fortranCommandSelection = null;
0124:
0125:            private static ToolsPanel instance = null;
0126:
0127:            /** The default (or previously selected) C compiler for each CompilerSet */
0128:            private HashMap<String, String> cSelections;
0129:
0130:            /** The default (or previously selected) C++ compiler for each CompilerSet */
0131:            private HashMap<String, String> cppSelections;
0132:
0133:            /** The default (or previously selected) Fortran compiler for each CompilerSet */
0134:            private HashMap<String, String> fortranSelections;
0135:
0136:            private JFileChooser addDirectoryChooser;
0137:            private CompilerSetManager csm;
0138:            private CompilerSet currentCompilerSet;
0139:
0140:            /** Creates new form ToolsPanel */
0141:            public ToolsPanel() {
0142:                initComponents();
0143:                setName("TAB_ToolsTab"); // NOI18N (used as a pattern...)
0144:                cbGdbRequired.setName("gdb"); // NOI18N
0145:                cbCRequired.setName("c"); // NOI18N
0146:                cbCppRequired.setName("c++"); // NOI18N
0147:                cbFortranRequired.setName("fortran"); // NOI18N
0148:                changed = false;
0149:                instance = this ;
0150:                currentCompilerSet = null;
0151:
0152:                errorTextArea.setText("");
0153:                errorTextArea.setBackground(jPanel1.getBackground());
0154:            }
0155:
0156:            public ToolsPanel(ToolsPanelModel model) {
0157:                this ();
0158:                this .model = model;
0159:            }
0160:
0161:            private void initialize() {
0162:                changingCompilerSet = true;
0163:                if (model == null) {
0164:                    model = new GlobalToolsPanelModel();
0165:                }
0166:                if (!model.showRequiredTools()) {
0167:                    jLabel1.setVisible(false); // Required Tools label!
0168:                    jPanel1.setVisible(false); // Required Tools panel!
0169:                }
0170:                if (dirlist == null) {
0171:                    // Take a copy ...
0172:                    dirlist = new ArrayList<String>();
0173:                    dirlist.addAll(Path.getPath());
0174:                }
0175:                //        dirlist = model.getPath();
0176:                if (csm == null) {
0177:                    csm = CompilerSetManager.getDefault();
0178:                }
0179:                gdbEnabled = IpeUtils.isGdbEnabled();
0180:
0181:                cSelections = new HashMap();
0182:                cppSelections = new HashMap();
0183:                fortranSelections = new HashMap();
0184:                addDirectoryChooser = null;
0185:
0186:                //        tfMakeCommand.setText(model.getMakeName());
0187:                //        tfGdbCommand.setText(model.getGdbName());
0188:
0189:                // Assume fortran is enabled externally before the initial display of this dialog
0190:                boolean fortran = CppSettings.getDefault().isFortranEnabled();
0191:                lbFortranCommand.setVisible(fortran);
0192:                cbFortranCommand.setVisible(fortran);
0193:                tfFortranPath.setVisible(fortran);
0194:                btFortranVersion.setVisible(fortran);
0195:                cbFortranRequired.setVisible(fortran);
0196:
0197:                // Initialize Required tools. Can't do it in constructor because there is no model then.
0198:                cbMakeRequired.setSelected(model.isMakeRequired());
0199:                cbGdbRequired.setSelected(model.isGdbRequired());
0200:                cbCRequired.setSelected(model.isCRequired());
0201:                cbCppRequired.setSelected(model.isCppRequired());
0202:                cbFortranRequired.setSelected(model.isFortranRequired());
0203:
0204:                cbCompilerSet.removeAllItems();
0205:            }
0206:
0207:            private void addDirectory() {
0208:                File file;
0209:                int rc;
0210:
0211:                if (addDirectoryChooser == null) {
0212:                    ResourceBundle bundle = NbBundle
0213:                            .getBundle(ToolsPanel.class);
0214:                    addDirectoryChooser = new JFileChooser();
0215:                    addDirectoryChooser
0216:                            .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
0217:                    addDirectoryChooser.setDialogTitle(bundle
0218:                            .getString("LBL_AddDirectoryTitle")); // NOI18N
0219:                    addDirectoryChooser.setApproveButtonText(bundle
0220:                            .getString("LBL_AddDirectoryAcceptButton")); // NOI18N
0221:                    addDirectoryChooser.setApproveButtonMnemonic(bundle
0222:                            .getString("MNEM_AddDirectoryAcceptButton").charAt(
0223:                                    0)); // NOI18N
0224:                }
0225:                try {
0226:                    rc = addDirectoryChooser.showDialog(this , null);
0227:                    if (rc == JFileChooser.APPROVE_OPTION) {
0228:                        changed = true;
0229:                        file = addDirectoryChooser.getSelectedFile();
0230:                        dirlist.add(0, file.getAbsolutePath());
0231:                        csm = new CompilerSetManager(dirlist);
0232:                        update(false);
0233:                    }
0234:                } catch (HeadlessException ex) {
0235:                }
0236:            }
0237:
0238:            private void removeDirectory() {
0239:                int idx = lstDirlist.getSelectedIndex();
0240:                assert idx != -1; // the button shouldn't be enabled
0241:                if (checkForCSRemoval(idx)) {
0242:                    String dir = dirlist.remove(idx);
0243:                    changed = true;
0244:                    if (dirlist.size() > 0) {
0245:                        if (idx == dirlist.size()) {
0246:                            idx--;
0247:                        }
0248:                    }
0249:
0250:                    try {
0251:                        for (CompilerSet cs : csm.getCompilerSets()) {
0252:                            StringTokenizer tok = new StringTokenizer(cs
0253:                                    .getDirectory(), File.pathSeparator);
0254:                            while (tok.hasMoreTokens()) {
0255:                                String d = tok.nextToken();
0256:                                if (d.equals(dir)) {
0257:                                    csm = new CompilerSetManager(dirlist);
0258:                                    return;
0259:                                }
0260:                            }
0261:                        }
0262:                    } finally {
0263:                        if (changed) {
0264:                            update(false);
0265:                        }
0266:                    }
0267:                }
0268:            }
0269:
0270:            private void moveDirectory(String direction) {
0271:                assert direction == DIRECTORY_MOVE_UP
0272:                        || direction == DIRECTORY_MOVE_DOWN;
0273:                int idx = lstDirlist.getSelectedIndex();
0274:                assert idx != -1; // the button shouldn't be enabled
0275:                String dir = dirlist.get(idx);
0276:                dirlist.remove(idx);
0277:                changed = true;
0278:                if (direction == DIRECTORY_MOVE_UP) {
0279:                    idx--;
0280:                } else {
0281:                    idx++;
0282:                }
0283:                dirlist.add(idx, dir);
0284:                lstDirlist.setSelectedIndex(idx);
0285:                update(false);
0286:            }
0287:
0288:            /**
0289:             * The user has pressed the Remove button id the directories list and the removal
0290:             * of the selected directory will result in the elimination of a compiler set. Ask
0291:             * the user if thats what they want and warn them some projects may be converted to
0292:             * another compiler collection. If the compiler set is the only one, tell the user
0293:             * its not allowed and stop the action.
0294:             *
0295:             * @param idx The index of the selected directory
0296:             * @returns True if the user OK's removal or removal doesn't cause elimination of a compiler collection
0297:             */
0298:            private boolean checkForCSRemoval(int idx) {
0299:                String dir = dirlist.get(idx);
0300:                int count = 0;
0301:
0302:                for (String d : dirlist) {
0303:                    if (d.equals(dir)) {
0304:                        count++;
0305:                    }
0306:                }
0307:                if (count > 1) {
0308:                    return true; // its OK to remove a duplicate directory...
0309:                }
0310:
0311:                for (CompilerSet cs : csm.getCompilerSets()) {
0312:                    String csdirs = cs.getDirectory();
0313:                    StringTokenizer tok = new StringTokenizer(csdirs,
0314:                            File.pathSeparator);
0315:                    while (tok.hasMoreTokens()) {
0316:                        String d = tok.nextToken();
0317:                        if (d.equals(dir)) {
0318:                            if (csm.getCompilerSets().size() == 1) {
0319:                                return suppressCSRemoval(dir, cs
0320:                                        .getDisplayName());
0321:                            } else {
0322:                                return warnAboutCSRemoval(dir, cs
0323:                                        .getDisplayName());
0324:                            }
0325:                        }
0326:                    }
0327:                }
0328:                return true;
0329:            }
0330:
0331:            /**
0332:             * Post a confirmation dialog about removing a compiler collection.
0333:             *
0334:             * @param dir The directory about to be removed
0335:             * @param csname The Compiler Collection about to be eliminated
0336:             * @returns True if the user pressed OK, false otherwise
0337:             */
0338:            private boolean warnAboutCSRemoval(String dir, String csname) {
0339:                NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
0340:                        NbBundle.getMessage(ToolsPanel.class,
0341:                                "WARN_CSRemovalPending", dir, csname), // NOI18N
0342:                        NbBundle.getMessage(ToolsPanel.class,
0343:                                "LBL_PendingCSRemoval_Title"), // NOI18N
0344:                        NotifyDescriptor.OK_CANCEL_OPTION);
0345:                Object ret = DialogDisplayer.getDefault().notify(nd);
0346:                return ret == NotifyDescriptor.OK_OPTION;
0347:            }
0348:
0349:            /**
0350:             * Post a warning dialog telling the user they can't remove the last compiler collection.
0351:             *
0352:             * @param dir The directory about to be removed
0353:             * @param csname The Compiler Collection about to be eliminated
0354:             * @returns false
0355:             */
0356:            private boolean suppressCSRemoval(String dir, String csname) {
0357:                NotifyDescriptor nb = new NotifyDescriptor.Message(NbBundle
0358:                        .getMessage(ToolsPanel.class,
0359:                                "WARN_CSRemovalDisallowed", dir, csname),
0360:                        NotifyDescriptor.ERROR_MESSAGE); // NOI18N
0361:                nb.setTitle(NbBundle.getMessage(ToolsPanel.class,
0362:                        "LBL_CSRemovalDisallowed_Title")); // NOI18N
0363:                DialogDisplayer.getDefault().notify(nb);
0364:                return false;
0365:            }
0366:
0367:            private void setMakePathField(String path) {
0368:                tfMakePath.setText(path); // Validation happens automatically
0369:            }
0370:
0371:            private void validateMakePathField() {
0372:                setPathFieldValid(tfMakePath, isPathFieldValid(tfMakePath));
0373:                dataValid();
0374:            }
0375:
0376:            private void setGdbPathField(String path) {
0377:                tfGdbPath.setText(path); // Validation happens automatically
0378:            }
0379:
0380:            private void validateGdbPathField() {
0381:                setPathFieldValid(tfGdbPath, isPathFieldValid(tfGdbPath));
0382:                dataValid();
0383:            }
0384:
0385:            private boolean isPathFieldValid(JTextField field) {
0386:                String txt = field.getText();
0387:                if (txt.length() == 0) {
0388:                    return false;
0389:                }
0390:                File file = new File(txt);
0391:                boolean ok = false;
0392:                ok = file.exists() && !file.isDirectory();
0393:                if (!ok) {
0394:                    // try users path
0395:                    ArrayList<String> paths = Path.getPath();
0396:                    for (String p : paths) {
0397:                        file = new File(p + File.separatorChar + txt);
0398:                        ok = file.exists() && !file.isDirectory();
0399:                        if (ok) {
0400:                            break;
0401:                        }
0402:                    }
0403:                }
0404:                return ok;
0405:            }
0406:
0407:            private void setPathFieldValid(JTextField field, boolean valid) {
0408:                if (valid) {
0409:                    field.setForeground(tfColor);
0410:                } else {
0411:                    field.setForeground(Color.RED);
0412:                }
0413:            }
0414:
0415:            //    private void setGdbPathField(String cmd) {
0416:            //        String path = findCommandFromPath(cmd);
0417:            //        if (path != null) {
0418:            //            tfGdbPath.setForeground(tfColor);
0419:            //            tfGdbPath.setText(path);
0420:            //        } else {
0421:            //            tfGdbPath.setForeground(Color.RED);
0422:            //            try {  // Want to output Red text and make data_valid return false
0423:            //                Document doc = tfGdbPath.getDocument();
0424:            //                doc.remove(0, doc.getLength());
0425:            //                doc.insertString(0, NbBundle.getMessage(ToolsPanel.class, "ERR_NotFound"),  // NOI18N
0426:            //                        SimpleAttributeSet.EMPTY);
0427:            //            } catch (BadLocationException ex) {
0428:            //            }
0429:            //        }
0430:            //        dataValid();
0431:            //    }
0432:            //    
0433:            //    private String findCommandFromPath(String cmd) {
0434:            //        File file;
0435:            //        String cmd2 = null;
0436:            //        
0437:            //        if (cmd.length() > 0) {
0438:            //            if (Utilities.isWindows() && !cmd.endsWith(".exe")) { // NOI18N
0439:            //                cmd2 = cmd + ".exe"; // NOI18N
0440:            //            }
0441:            //
0442:            //            for (String dir : dirlist) {
0443:            //                file = new File(dir, cmd);
0444:            //                if (file.exists()) {
0445:            //                    return file.getAbsolutePath();
0446:            //                }
0447:            //                if (cmd2 != null) {
0448:            //                    file = new File(dir, cmd2);
0449:            //                    if (file.exists()) {
0450:            //                        return file.getAbsolutePath();
0451:            //                    }
0452:            //                }
0453:            //            }
0454:            //        }
0455:            //        return null;
0456:            //    }
0457:
0458:            /** Update the display */
0459:            public void update() {
0460:                update(true);
0461:            }
0462:
0463:            /** Update the display */
0464:            public void update(boolean doInitialize) {
0465:
0466:                updating = true;
0467:                if (!initialized || doInitialize) {
0468:                    initialize();
0469:                }
0470:
0471:                lbGdbCommand.setVisible(gdbEnabled);
0472:                //        tfGdbCommand.setVisible(gdbEnabled);
0473:                tfGdbPath.setVisible(gdbEnabled);
0474:                btGdbVersion.setVisible(gdbEnabled);
0475:                //        cbGdbRequired.setVisible(gdbEnabled);
0476:
0477:                cbMakeRequired.setVisible(model.showRequiredBuildTools());
0478:                cbGdbRequired.setVisible(model.showRequiredDebugTools()
0479:                        && gdbEnabled);
0480:                cbCppRequired.setVisible(model.showRequiredBuildTools());
0481:                cbCRequired.setVisible(model.showRequiredBuildTools());
0482:                cbFortranRequired.setVisible(model.showRequiredBuildTools()
0483:                        && CppSettings.getDefault().isFortranEnabled());
0484:
0485:                int idx = lstDirlist.getSelectedIndex();
0486:                lstDirlist.setListData(dirlist.toArray());
0487:                if (idx >= 0) {
0488:                    lstDirlist.setSelectedIndex(idx);
0489:                    lstDirlist.ensureIndexIsVisible(idx);
0490:                }
0491:                //        setMakePathField(tfMakeCommand.getText());
0492:                //        setGdbPathField(tfGdbCommand.getText());
0493:                updateCompilers();
0494:                updating = false;
0495:                dataValid();
0496:                initialized = true;
0497:            }
0498:
0499:            private void updateCompilers() {
0500:
0501:                if (!csm.getCompilerSets().isEmpty()) {
0502:                    String name, dname;
0503:
0504:                    if (cbCompilerSet.getItemCount() > 0) {
0505:                        name = ((CompilerSet) cbCompilerSet.getSelectedItem())
0506:                                .getName();
0507:                        dname = ((CompilerSet) cbCompilerSet.getSelectedItem())
0508:                                .getDisplayName();
0509:                    } else {
0510:                        name = model.getCompilerSetName();
0511:                        if (name.length() == 0
0512:                                || csm.getCompilerSet(name) == null) {
0513:                            name = CompilerSetManager.getDefault()
0514:                                    .getCompilerSet(0).getName();
0515:                            dname = CompilerSetManager.getDefault()
0516:                                    .getCompilerSet(0).getDisplayName();
0517:                        } else {
0518:                            name = csm.getCompilerSet(name).getName(); // Sun12 will fallback match any Sun release
0519:                            dname = csm.getCompilerSet(name).getDisplayName();
0520:                        }
0521:                    }
0522:                    cbCompilerSet.removeAllItems();
0523:                    for (CompilerSet cs : csm.getCompilerSets()) {
0524:                        cbCompilerSet.addItem(cs);
0525:                    }
0526:
0527:                    CompilerSet cs = csm.getCompilerSet(name, dname);
0528:                    if (cs == null) {
0529:                        cs = csm.getCompilerSet(0);
0530:                    }
0531:                    cbCompilerSet.setSelectedItem(cs);
0532:                    changeCompilerSet(cs);
0533:                } else {
0534:                    cbCompilerSet.removeAllItems();
0535:                }
0536:            }
0537:
0538:            private void changeCompilerSet(CompilerSet cs) {
0539:                boolean fortran = CppSettings.getDefault().isFortranEnabled();
0540:                Tool fortranSelection = null;
0541:
0542:                changingCompilerSet = true;
0543:                cbCCommand.removeAllItems();
0544:                cbCppCommand.removeAllItems();
0545:                if (fortran) {
0546:                    cbFortranCommand.removeAllItems();
0547:                    fortranSelection = getDefaultCompiler(cs,
0548:                            Tool.FortranCompiler);
0549:                }
0550:
0551:                Tool cSelection = getDefaultCompiler(cs, Tool.CCompiler);
0552:                Tool cppSelection = getDefaultCompiler(cs, Tool.CCCompiler);
0553:                Tool makeToolSelection = cs.getTool(Tool.MakeTool);
0554:                Tool debuggerToolSelection = cs.getTool(Tool.DebuggerTool);
0555:
0556:                for (Tool tool : cs.getTools()) {
0557:                    if (tool.getName().length() > 0) {
0558:                        if (tool.getKind() == Tool.CCompiler) {
0559:                            cbCCommand.addItem(tool);
0560:                        }
0561:                        if (tool.getKind() == Tool.CCCompiler) {
0562:                            cbCppCommand.addItem(tool);
0563:                        }
0564:                        if (fortran && tool.getKind() == Tool.FortranCompiler) {
0565:                            cbFortranCommand.addItem(tool);
0566:                        }
0567:                    }
0568:                }
0569:                if (cSelection != null) {
0570:                    cbCCommand.setSelectedItem(cSelection);
0571:                    cbCCommand.setToolTipText(cSelection.toString());
0572:                    updateCPath(cSelection);
0573:                    cCommandSelection = cSelection;
0574:                } else {
0575:                    tfCPath.setText("");
0576:                    cbCCommand.setSelectedIndex(0);
0577:                }
0578:                if (cppSelection != null) {
0579:                    cbCppCommand.setSelectedItem(cppSelection);
0580:                    cbCppCommand.setToolTipText(cppSelection.toString());
0581:                    updateCppPath(cppSelection);
0582:                    cppCommandSelection = cppSelection;
0583:                } else {
0584:                    tfCppPath.setText("");
0585:                    cbCppCommand.setSelectedIndex(0);
0586:                }
0587:                if (fortran) {
0588:                    if (fortranSelection != null) {
0589:                        cbFortranCommand.setSelectedItem(fortranSelection);
0590:                        cbFortranCommand.setToolTipText(fortranSelection
0591:                                .toString());
0592:                        updateFortranPath(fortranSelection);
0593:                        fortranCommandSelection = fortranSelection;
0594:                    } else {
0595:                        tfFortranPath.setText("");
0596:                        cbFortranCommand.setSelectedIndex(0);
0597:                    }
0598:                }
0599:                setMakePathField(makeToolSelection.getPath());
0600:                setGdbPathField(debuggerToolSelection.getPath());
0601:                changingCompilerSet = false;
0602:                currentCompilerSet = cs;
0603:                fireCompilerSetChange();
0604:                dataValid();
0605:            }
0606:
0607:            private void updatePath(Tool tool, int kind) {
0608:                if (kind == Tool.CCompiler) {
0609:                    updateCPath(tool);
0610:                } else if (kind == Tool.CCCompiler) {
0611:                    updateCppPath(tool);
0612:                } else if (kind == Tool.FortranCompiler) {
0613:                    updateFortranPath(tool);
0614:                }
0615:            }
0616:
0617:            private void updateCPath(Tool tool) {
0618:                if (tool != null) {
0619:                    int toollen = tool.getPath().length();
0620:                    int pathlen = tfCPath.getText().length();
0621:
0622:                    if ((toollen > 0 && pathlen == 0)
0623:                            || (toollen == 0 && pathlen > 0)) {
0624:                        dataValid(); // force fire prop changed on PROP_VALID
0625:                    }
0626:                    tfCPath.setText(tool.getPath());
0627:                    tfCPath.setToolTipText(tool.getPath());
0628:                } else {
0629:                    tfCPath.setText("");
0630:                    tfCPath.setToolTipText("");
0631:                }
0632:            }
0633:
0634:            private void updateCppPath(Tool tool) {
0635:                if (tool != null) {
0636:                    int toollen = tool.getPath().length();
0637:                    int pathlen = tfCppPath.getText().length();
0638:
0639:                    if ((toollen > 0 && pathlen == 0)
0640:                            || (toollen == 0 && pathlen > 0)) {
0641:                        dataValid(); // force fire prop changed on PROP_VALID
0642:                    }
0643:                    tfCppPath.setText(tool.getPath());
0644:                    tfCppPath.setToolTipText(tool.getPath());
0645:                } else {
0646:                    tfCppPath.setText("");
0647:                    tfCppPath.setToolTipText("");
0648:                }
0649:            }
0650:
0651:            private void updateFortranPath(Tool tool) {
0652:                if (tool != null) {
0653:                    int toollen = tool.getPath().length();
0654:                    int pathlen = tfFortranPath.getText().length();
0655:
0656:                    if ((toollen > 0 && pathlen == 0)
0657:                            || (toollen == 0 && pathlen > 0)) {
0658:                        dataValid(); // force fire prop changed on PROP_VALID
0659:                    }
0660:                    tfFortranPath.setText(tool.getPath());
0661:                    tfFortranPath.setToolTipText(tool.getPath());
0662:                } else {
0663:                    tfFortranPath.setText("");
0664:                    tfFortranPath.setToolTipText("");
0665:                }
0666:            }
0667:
0668:            /**
0669:             * Set the default compiler for each compiler type. This is useful when the user changes
0670:             * CompilerSets to one whose default compiler had been changed earlier. This lets it get
0671:             * restored to the earlier value.
0672:             *
0673:             * @param type The compiler type
0674:             * @param name The display name of the selected compiler
0675:             */
0676:            protected void setDefaultCompiler(int type, String name) {
0677:                CompilerSet cs = (CompilerSet) cbCompilerSet.getSelectedItem();
0678:                changed = true;
0679:
0680:                if (type == Tool.CCompiler) {
0681:                    cSelections.put(cs.getName(), name);
0682:                } else if (type == Tool.CCCompiler) {
0683:                    cppSelections.put(cs.getName(), name);
0684:                } else if (type == Tool.FortranCompiler) {
0685:                    fortranSelections.put(cs.getName(), name);
0686:                }
0687:            }
0688:
0689:            /**
0690:             * Get the default compiler for each compiler type. This is useful when the user changes
0691:             * CompilerSets to one whose default compiler had been changed earlier. This lets it get
0692:             * restored to the earlier value.
0693:             *
0694:             * @param cs The CompilerSet for whom we want a tool
0695:             * @param kind The compiler type we want
0696:             * @returns The Tool for the requested compiler (or null)
0697:             */
0698:            protected Tool getDefaultCompiler(CompilerSet cs, int kind) {
0699:                String name = cs.getName();
0700:
0701:                if (!name.equals(CompilerSet.None)) {
0702:                    if (kind == Tool.CCompiler) {
0703:                        if (cSelections.get(name) == null) {
0704:                            return cs
0705:                                    .getTool(cs.isSunCompiler() ? "cc" : "gcc"); // NOI18N
0706:                        } else {
0707:                            return cs.getTool(cSelections.get(name));
0708:                        }
0709:                    } else if (kind == Tool.CCCompiler) {
0710:                        if (cppSelections.get(name) == null) {
0711:                            return cs
0712:                                    .getTool(cs.isSunCompiler() ? "CC" : "g++"); // NOI18N
0713:                        } else {
0714:                            Tool tool = cs.getTool(cppSelections.get(name),
0715:                                    kind);
0716:                            if (tool == null) {
0717:                                File file = new File(cs.getDirectory(), name);
0718:                                if (file.exists()) {
0719:                                    tool = cs.addTool(name, cs.getDirectory(),
0720:                                            kind);
0721:                                }
0722:                            }
0723:                            return tool;
0724:                        }
0725:                    } else if (kind == Tool.FortranCompiler) {
0726:                        if (fortranSelections.get(name) == null) {
0727:                            return cs.getTool(cs.isSunCompiler() ? "f90"
0728:                                    : "g77"); // NOI18N
0729:                        } else {
0730:                            return cs.getTool(fortranSelections.get(name));
0731:                        }
0732:                    }
0733:                }
0734:                return null;
0735:            }
0736:
0737:            public void applyChanges(boolean force) {
0738:                changed = force;
0739:                applyChanges();
0740:            }
0741:
0742:            /** Apply changes */
0743:            public void applyChanges() {
0744:                if (changed) {
0745:                    CompilerSet cs = (CompilerSet) cbCompilerSet
0746:                            .getSelectedItem();
0747:                    changed = false;
0748:
0749:                    CompilerSetManager.setDefault(csm);
0750:                    //            model.setPath(dirlist);
0751:                    //            model.setMakeName(tfMakeCommand.getText());
0752:                    //            model.setMakePath(tfMakePath.getText());
0753:                    cs.getTool(Tool.MakeTool).setPath(tfMakePath.getText());
0754:                    cs.getTool(Tool.DebuggerTool).setPath(tfGdbPath.getText());
0755:                    //            model.setGdbName(tfGdbCommand.getText());
0756:                    //            model.setGdbPath(tfGdbPath.getText());
0757:                    model.setCompilerSetName(cs.getName());
0758:                    //            if (cSelections.get(cs.getName()) != null) {
0759:                    //                model.setCCompilerName(cSelections.get(cs.getName()));
0760:                    //            }
0761:                    //            if (cppSelections.get(cs.getName()) != null) {
0762:                    //                model.setCppCompilerName(cppSelections.get(cs.getName()));
0763:                    //            }
0764:                    //            if (fortranSelections.get(cs.getName()) != null) {
0765:                    //                model.setFortranCompilerName(fortranSelections.get(cs.getName()));
0766:                    //            }
0767:                    currentCompilerSet = cs;
0768:                    fireCompilerSetChange();
0769:                    fireCompilerSetModified();
0770:                }
0771:
0772:                if (model != null) { // model is null for Tools->Options if we don't look at C/C++ panel
0773:                    // the following don't set changed if changed
0774:                    if (model.isGdbRequired() != cbGdbRequired.isSelected()) {
0775:                        model.setGdbRequired(cbGdbRequired.isSelected());
0776:                    }
0777:                    if (model.isCRequired() != cbCRequired.isSelected()) {
0778:                        model.setCRequired(cbCRequired.isSelected());
0779:                    }
0780:                    if (model.isCppRequired() != cbCppRequired.isSelected()) {
0781:                        model.setCppRequired(cbCppRequired.isSelected());
0782:                    }
0783:                    if (model.isFortranRequired() != cbFortranRequired
0784:                            .isSelected()) {
0785:                        model
0786:                                .setFortranRequired(cbFortranRequired
0787:                                        .isSelected());
0788:                    }
0789:                }
0790:                instance = null; // remove the global instance
0791:            }
0792:
0793:            /** What to do if user cancels the dialog (nothing) */
0794:            public void cancel() {
0795:                changed = false;
0796:            }
0797:
0798:            public static ToolsPanel getToolsPanel() {
0799:                return instance;
0800:            }
0801:
0802:            public CompilerSetManager getCompilerSetManager() {
0803:                if (csm == null) {
0804:                    csm = CompilerSetManager.getDefault();
0805:                }
0806:                return csm;
0807:            }
0808:
0809:            public CompilerSet getCurrentCompilerSet() {
0810:                return currentCompilerSet;
0811:            }
0812:
0813:            /**
0814:             * Lets NB know if the data in the panel is valid and OK should be enabled
0815:             * 
0816:             * @return Returns true if all data is valid
0817:             */
0818:            public boolean dataValid() {
0819:
0820:                if (updating || changingCompilerSet) {
0821:                    return true;
0822:                } else {
0823:                    boolean csmValid = csm.getCompilerSets().size() > 0;
0824:                    boolean makeValid = cbMakeRequired.isSelected() ? isPathFieldValid(tfMakePath)
0825:                            : true;
0826:                    boolean gdbValid = cbGdbRequired.isSelected() ? isPathFieldValid(tfGdbPath)
0827:                            : true;
0828:                    boolean cValid = cbCRequired.isSelected() ? tfCPath
0829:                            .getText().length() > 0 : true;
0830:                    boolean cppValid = cbCppRequired.isSelected() ? tfCppPath
0831:                            .getText().length() > 0 : true;
0832:                    boolean fortranValid = cbFortranRequired.isSelected() ? tfFortranPath
0833:                            .getText().length() > 0
0834:                            : true;
0835:
0836:                    if (!initialized) {
0837:                        valid = !(csmValid && makeValid && gdbValid && cValid
0838:                                && cppValid && fortranValid);
0839:                    }
0840:
0841:                    if (valid != (csmValid && makeValid && gdbValid && cValid
0842:                            && cppValid && fortranValid)) {
0843:                        valid = !valid;
0844:                        firePropertyChange(PROP_VALID, !valid, valid);
0845:                    }
0846:
0847:                    // post errors in error text area
0848:                    errorTextArea.setText("");
0849:                    errorTextArea.setRows(0);
0850:                    if (!valid) {
0851:                        ArrayList<String> errors = new ArrayList<String>();
0852:                        if (cbMakeRequired.isSelected() && !makeValid) {
0853:                            errors.add("Make tool is missing or invalid");
0854:                        }
0855:                        if (cbCRequired.isSelected() && !cValid) {
0856:                            errors.add("C Compiler is missing or invalid");
0857:                        }
0858:                        if (cbCppRequired.isSelected() && !cppValid) {
0859:                            errors.add("C++ Compiler is missing or invalid");
0860:                        }
0861:                        if (cbGdbRequired.isSelected() && !gdbValid) {
0862:                            errors.add("Debugger is missing or invalid");
0863:                        }
0864:                        if (cbFortranRequired.isSelected() && !fortranValid) {
0865:                            errors.add("Fortran Compiler missing or invalid");
0866:                        }
0867:                        StringBuilder errorString = new StringBuilder();
0868:                        for (int i = 0; i < errors.size(); i++) {
0869:                            errorString.append(errors.get(i));
0870:                            if (i < errors.size() - 1)
0871:                                errorString.append("\n"); // NOI18N
0872:                        }
0873:                        errorTextArea.setRows(errors.size());
0874:                        errorTextArea.setText(errorString.toString());
0875:
0876:                        validate();
0877:                        repaint();
0878:                    }
0879:                    return valid;
0880:                }
0881:            }
0882:
0883:            /**
0884:             * Lets caller know if any data has been changed.
0885:             * 
0886:             * @return True if anything has been changed
0887:             */
0888:            public boolean isChanged() {
0889:                return changed;
0890:            }
0891:
0892:            /**
0893:             * Post version information for tools not considered part of a CompilerSet (make and gdb).
0894:             *
0895:             * @param name The name of the tool (no directory information)
0896:             * @param path The absolute path of the tool
0897:             */
0898:            private void postVersionInfo(String name, String path) {
0899:                postVersionInfo(CompilerFlavor.Unknown, name, path);
0900:            }
0901:
0902:            /**
0903:             * Display version information for a program pointed to by "path".
0904:             *
0905:             * @param flavor The type of CompilerSet (unknown if we don't care)
0906:             * @param name The name of the tool (no directory information)
0907:             * @param path The absolute path of the tool
0908:             */
0909:            private void postVersionInfo(CompilerFlavor flavor, String name,
0910:                    String path) {
0911:                File file = new File(path);
0912:                if (file.exists()) {
0913:                    try {
0914:                        FileObject fo = FileUtil.toFileObject(file
0915:                                .getCanonicalFile());
0916:                        if (fo != null) {
0917:                            String mime = fo.getMIMEType();
0918:                            if (mime.startsWith("application/x-exe")
0919:                                    || mime.equals(MIMENames.SHELL_MIME_TYPE)) { // NOI18N
0920:                                RequestProcessor.getDefault().post(
0921:                                        new VersionCommand(flavor, name, path));
0922:                            }
0923:                        }
0924:                    } catch (IOException ex) {
0925:                    }
0926:                }
0927:            }
0928:
0929:            private void addRemoveUserTool(JComboBox jc, Tool selected, int kind) {
0930:                CompilerSet cs = (CompilerSet) cbCompilerSet.getSelectedItem();
0931:                AddRemoveToolPanel panel = new AddRemoveToolPanel(jc, cs);
0932:                DialogDescriptor dd = new DialogDescriptor(panel, NbBundle
0933:                        .getMessage(ToolsPanel.class, "TITLE_AddRemoveCompiler"
0934:                                + kind));
0935:                Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
0936:                dialog.setVisible(true);
0937:                jc.removeItemListener(this ); // Remove or else we'll recurse setting the selection
0938:                if (dd.getValue() == NotifyDescriptor.OK_OPTION) {
0939:                    List<String> addList = panel.getModel().getAddList();
0940:                    List removeList = panel.getModel().getRemoveList();
0941:                    ArrayList<Tool> rmlist = new ArrayList();
0942:                    for (Object o : removeList) {
0943:                        for (Tool tool : cs.getTools()) {
0944:                            if (o == tool) {
0945:                                if (tool == selected) {
0946:                                    selected = null;
0947:                                }
0948:                                rmlist.add(tool);
0949:                                jc.removeItem(tool);
0950:                            }
0951:                        }
0952:                    }
0953:                    for (Tool tool : rmlist) {
0954:                        cs.getTools().remove(tool);
0955:                    }
0956:                    for (String name : addList) {
0957:                        Tool tool = cs.addTool(name, cs.getDirectory(), kind);
0958:                        jc.addItem(tool);
0959:                        jc.setSelectedItem(tool);
0960:                        selected = tool;
0961:                    }
0962:                }
0963:                if (selected != null && cs.getTools().contains(selected)) {
0964:                    jc.setSelectedItem(selected);
0965:                    setDefaultCompiler(kind, selected.getName());
0966:                    updatePath(selected, kind);
0967:                } else {
0968:                    jc.setSelectedIndex(0);
0969:                    if (jc.getItemAt(0) instanceof  String) {
0970:                        updatePath(null, kind);
0971:                    } else {
0972:                        updatePath((Tool) jc.getItemAt(0), kind);
0973:                    }
0974:                }
0975:                jc.addItemListener(this );
0976:            }
0977:
0978:            static Set<ChangeListener> listenerChanged = new HashSet();
0979:
0980:            public static void addCompilerSetChangeListener(ChangeListener l) {
0981:                listenerChanged.add(l);
0982:            }
0983:
0984:            public static void removeCompilerSetChangeListener(ChangeListener l) {
0985:                listenerChanged.remove(l);
0986:            }
0987:
0988:            public void fireCompilerSetChange() {
0989:                ChangeEvent ev = new ChangeEvent(currentCompilerSet);
0990:                for (ChangeListener l : listenerChanged) {
0991:                    l.stateChanged(ev);
0992:                }
0993:            }
0994:
0995:            static Set<ChangeListener> listenerModified = new HashSet();
0996:
0997:            public static void addCompilerSetModifiedListener(ChangeListener l) {
0998:                listenerModified.add(l);
0999:            }
1000:
1001:            public static void removeCompilerSetModifiedListener(
1002:                    ChangeListener l) {
1003:                listenerModified.remove(l);
1004:            }
1005:
1006:            public void fireCompilerSetModified() {
1007:                ChangeEvent ev = new ChangeEvent(currentCompilerSet);
1008:                for (ChangeListener l : listenerModified) {
1009:                    l.stateChanged(ev);
1010:                }
1011:            }
1012:
1013:            // implement ActionListener
1014:            public void actionPerformed(ActionEvent e) {
1015:                Object o = e.getSource();
1016:
1017:                if (o instanceof  JButton) {
1018:                    changed = true;
1019:                    if (o == btAdd) {
1020:                        addDirectory();
1021:                    } else if (o == btRemove) {
1022:                        removeDirectory();
1023:                    } else if (o == btUp) {
1024:                        moveDirectory(DIRECTORY_MOVE_UP);
1025:                    } else if (o == btDown) {
1026:                        moveDirectory(DIRECTORY_MOVE_DOWN);
1027:                    } else {
1028:                        CompilerFlavor flavor = ((CompilerSet) cbCompilerSet
1029:                                .getSelectedItem()).getCompilerFlavor();
1030:
1031:                        if (o == btMakeVersion) {
1032:                            postVersionInfo(tfMakePath.getText(), tfMakePath
1033:                                    .getText());
1034:                        } else if (o == btGdbVersion) {
1035:                            postVersionInfo(tfGdbPath.getText(), tfGdbPath
1036:                                    .getText());
1037:                        } else if (o == btCVersion
1038:                                && cbCCommand.getSelectedItem() != null) {
1039:                            postVersionInfo(flavor, cbCCommand
1040:                                    .getSelectedItem().toString(), tfCPath
1041:                                    .getText());
1042:                        } else if (o == btCppVersion
1043:                                && cbCppCommand.getSelectedItem() != null) {
1044:                            postVersionInfo(flavor, cbCppCommand
1045:                                    .getSelectedItem().toString(), tfCppPath
1046:                                    .getText());
1047:                        } else if (o == btFortranVersion
1048:                                && cbFortranCommand.getSelectedItem() != null) {
1049:                            postVersionInfo(flavor, cbFortranCommand
1050:                                    .getSelectedItem().toString(),
1051:                                    tfFortranPath.getText());
1052:                        }
1053:                    }
1054:                }
1055:            }
1056:
1057:            // implemet ItemListener
1058:            public void itemStateChanged(ItemEvent ev) {
1059:                Object o = ev.getSource();
1060:
1061:                if (!updating) {
1062:                    if (o instanceof  JComboBox
1063:                            && ev.getStateChange() == ItemEvent.SELECTED) {
1064:                        Object item = ev.getItem();
1065:                        changed = true;
1066:
1067:                        if (o == cbCompilerSet) {
1068:                            changeCompilerSet((CompilerSet) item);
1069:                        } else if (o == cbCCommand) {
1070:                            if (item instanceof  Tool) {
1071:                                cbCCommand.setToolTipText(((Tool) item)
1072:                                        .toString());
1073:                                setDefaultCompiler(Tool.CCompiler,
1074:                                        ((Tool) item).getName());
1075:                                updateCPath((Tool) item);
1076:                                cCommandSelection = (Tool) item;
1077:                            } else if (!changingCompilerSet) {
1078:                                addRemoveUserTool(cbCCommand,
1079:                                        cCommandSelection, Tool.CCompiler);
1080:                            }
1081:                        } else if (o == cbCppCommand) {
1082:                            if (item instanceof  Tool) {
1083:                                cbCppCommand.setToolTipText(((Tool) item)
1084:                                        .toString());
1085:                                setDefaultCompiler(Tool.CCCompiler,
1086:                                        ((Tool) item).getName());
1087:                                updateCppPath((Tool) item);
1088:                                cppCommandSelection = (Tool) item;
1089:                            } else if (!changingCompilerSet) {
1090:                                addRemoveUserTool(cbCppCommand,
1091:                                        cppCommandSelection, Tool.CCCompiler);
1092:                            }
1093:                        } else if (o == cbFortranCommand) {
1094:                            if (item instanceof  Tool) {
1095:                                cbFortranCommand.setToolTipText(((Tool) item)
1096:                                        .toString());
1097:                                setDefaultCompiler(Tool.FortranCompiler,
1098:                                        ((Tool) item).getName());
1099:                                updateFortranPath((Tool) item);
1100:                                fortranCommandSelection = (Tool) item;
1101:                            } else if (!changingCompilerSet) {
1102:                                addRemoveUserTool(cbFortranCommand,
1103:                                        fortranCommandSelection,
1104:                                        Tool.FortranCompiler);
1105:                            }
1106:                        }
1107:                    } else if (o instanceof  JCheckBox && !changingCompilerSet) {
1108:                        dataValid();
1109:                    }
1110:                }
1111:            }
1112:
1113:            // implement DocumentListener
1114:            public void changedUpdate(DocumentEvent ev) {
1115:            }
1116:
1117:            public void insertUpdate(DocumentEvent ev) {
1118:                String text;
1119:                if (!updating) {
1120:                    changed = true;
1121:                }
1122:                Document doc = ev.getDocument();
1123:                try {
1124:                    text = doc.getText(0, doc.getLength());
1125:                    String title = (String) doc
1126:                            .getProperty(Document.TitleProperty);
1127:                    if (title == MAKE_NAME) {
1128:                        validateMakePathField();
1129:                    } else if (title == GDB_NAME) {
1130:                        validateGdbPathField();
1131:                    }
1132:                } catch (BadLocationException ex) {
1133:                }
1134:                ;
1135:            }
1136:
1137:            public void removeUpdate(DocumentEvent ev) {
1138:                insertUpdate(ev);
1139:            }
1140:
1141:            // Implement List SelectionListener
1142:            public void valueChanged(ListSelectionEvent ev) {
1143:
1144:                if (!ev.getValueIsAdjusting()) { // we don't want the event until its finished
1145:                    if (ev.getSource() == lstDirlist) {
1146:                        btRemove.setEnabled(lstDirlist.getSelectedIndex() >= 0);
1147:                        btUp.setEnabled(lstDirlist.getSelectedIndex() > 0);
1148:                        btDown
1149:                                .setEnabled(lstDirlist.getSelectedIndex() < (dirlist
1150:                                        .size() - 1)
1151:                                        && lstDirlist.getSelectedIndex() >= 0);
1152:                    }
1153:                }
1154:            }
1155:
1156:            /** Document which suppresses '/' characters */
1157:            private static class NameOnlyDocument extends PlainDocument {
1158:
1159:                public void insertString(int offs, String str, AttributeSet a)
1160:                        throws BadLocationException {
1161:                    if (str.indexOf("/") == -1) { // NOI18N
1162:                        super .insertString(offs, str, a);
1163:                    }
1164:                }
1165:            }
1166:
1167:            private class ToolsComboBox extends JComboBox {
1168:
1169:                ToolsComboBox() {
1170:                    super (new ToolsComboBoxModel(NbBundle.getMessage(
1171:                            ToolsPanel.class, "LBL_AddRemove")));
1172:                }
1173:
1174:                public void removeAllItems() {
1175:                    super .removeAllItems();
1176:                    setSelectedIndex(0);
1177:                }
1178:
1179:                public void removeItem(Object o) {
1180:                    super .removeItem(o);
1181:                    if (getItemAt(0) instanceof  String) {
1182:                        setSelectedIndex(0);
1183:                    }
1184:                }
1185:            }
1186:
1187:            private class ToolsComboBoxModel extends DefaultComboBoxModel {
1188:
1189:                public ToolsComboBoxModel(String addRemove) {
1190:                    super ();
1191:                    super .addElement("");
1192:                    super .addElement(addRemove);
1193:                }
1194:
1195:                public void addElement(Object o) {
1196:                    if (getSize() == 2
1197:                            && super .getElementAt(0) instanceof  String
1198:                            && super .getElementAt(0).toString().length() == 0) {
1199:                        super .removeElementAt(0);
1200:                    }
1201:                    int size = getSize();
1202:                    super .insertElementAt(o, getSize() - 1);
1203:                }
1204:
1205:                public void removeElement(Object o) {
1206:                    if (o instanceof  Tool) {
1207:                        super .removeElement(o);
1208:                    }
1209:                    if (getSize() == 1) {
1210:                        super .insertElementAt("", 0);
1211:                    }
1212:                }
1213:
1214:                public void removeAllElements() {
1215:                    int size = getSize();
1216:                    for (int i = 1; i < size; i++) {
1217:                        super .removeElementAt(0);
1218:                    }
1219:                    super .insertElementAt("", 0);
1220:                }
1221:            }
1222:
1223:            /** This method is called from within the constructor to
1224:             * initialize the form.
1225:             * WARNING: Do NOT modify this code. The content of this method is
1226:             * always regenerated by the Form Editor.
1227:             */
1228:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
1229:            private void initComponents() {
1230:                java.awt.GridBagConstraints gridBagConstraints;
1231:
1232:                lbDirlist = new javax.swing.JLabel();
1233:                spDirlist = new JScrollPane(lstDirlist);
1234:                lstDirlist = new javax.swing.JList();
1235:                lbMakeCommand = new javax.swing.JLabel();
1236:                tfMakePath = new javax.swing.JTextField();
1237:                tfMakePath.getDocument().putProperty(Document.TitleProperty,
1238:                        MAKE_NAME);
1239:                tfMakePath.getDocument().addDocumentListener(this );
1240:                btMakeVersion = new javax.swing.JButton();
1241:                btMakeVersion.addActionListener(this );
1242:                lbGdbCommand = new javax.swing.JLabel();
1243:                tfGdbPath = new javax.swing.JTextField();
1244:                tfGdbPath.getDocument().putProperty(Document.TitleProperty,
1245:                        GDB_NAME);
1246:                tfGdbPath.getDocument().addDocumentListener(this );
1247:                btGdbVersion = new javax.swing.JButton();
1248:                btGdbVersion.addActionListener(this );
1249:                lbCCommand = new javax.swing.JLabel();
1250:                cbCCommand = new ToolsComboBox();
1251:                cbCCommand.addItemListener(this );
1252:                tfCPath = new javax.swing.JTextField();
1253:                tfColor = tfCPath.getForeground();
1254:                btCVersion = new javax.swing.JButton();
1255:                btCVersion.addActionListener(this );
1256:                lbCppCommand = new javax.swing.JLabel();
1257:                cbCppCommand = new ToolsComboBox();
1258:                cbCppCommand.addItemListener(this );
1259:                tfCppPath = new javax.swing.JTextField();
1260:                btCppVersion = new javax.swing.JButton();
1261:                btCppVersion.addActionListener(this );
1262:                lbFortranCommand = new javax.swing.JLabel();
1263:                cbFortranCommand = new ToolsComboBox();
1264:                cbFortranCommand.addItemListener(this );
1265:                tfFortranPath = new javax.swing.JTextField();
1266:                btFortranVersion = new javax.swing.JButton();
1267:                btFortranVersion.addActionListener(this );
1268:                lbCompilerCollection = new javax.swing.JLabel();
1269:                cbCompilerSet = new javax.swing.JComboBox();
1270:                cbCompilerSet.addItemListener(this );
1271:                btAdd = new javax.swing.JButton();
1272:                btAdd.addActionListener(this );
1273:                btRemove = new javax.swing.JButton();
1274:                btRemove.addActionListener(this );
1275:                btUp = new javax.swing.JButton();
1276:                btUp.addActionListener(this );
1277:                btDown = new javax.swing.JButton();
1278:                btDown.addActionListener(this );
1279:                jLabel1 = new javax.swing.JLabel();
1280:                jPanel1 = new javax.swing.JPanel();
1281:                cbMakeRequired = new javax.swing.JCheckBox();
1282:                cbGdbRequired = new javax.swing.JCheckBox();
1283:                cbGdbRequired.addItemListener(this );
1284:                cbCRequired = new javax.swing.JCheckBox();
1285:                cbCRequired.addItemListener(this );
1286:                cbCppRequired = new javax.swing.JCheckBox();
1287:                cbCppRequired.addItemListener(this );
1288:                cbFortranRequired = new javax.swing.JCheckBox();
1289:                cbFortranRequired.addItemListener(this );
1290:                jSeparator1 = new javax.swing.JSeparator();
1291:                errorScrollPane = new javax.swing.JScrollPane();
1292:                errorTextArea = new javax.swing.JTextArea();
1293:
1294:                setMinimumSize(new java.awt.Dimension(600, 650));
1295:                setLayout(new java.awt.GridBagLayout());
1296:
1297:                lbDirlist
1298:                        .setDisplayedMnemonic(java.util.ResourceBundle
1299:                                .getBundle(
1300:                                        "org/netbeans/modules/cnd/ui/options/Bundle")
1301:                                .getString("MNEM_DirlistLabel").charAt(0));
1302:                lbDirlist.setLabelFor(spDirlist);
1303:                java.util.ResourceBundle bundle = java.util.ResourceBundle
1304:                        .getBundle("org/netbeans/modules/cnd/ui/options/Bundle"); // NOI18N
1305:                lbDirlist.setText(bundle.getString("LBL_DirlistLabel")); // NOI18N
1306:                lbDirlist.setToolTipText(bundle.getString("HINT_DirListLabel")); // NOI18N
1307:                gridBagConstraints = new java.awt.GridBagConstraints();
1308:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
1309:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1310:                gridBagConstraints.weightx = 1.0;
1311:                gridBagConstraints.insets = new java.awt.Insets(8, 4, 0, 4);
1312:                add(lbDirlist, gridBagConstraints);
1313:                lbDirlist.getAccessibleContext().setAccessibleName(
1314:                        bundle.getString("ACSN_DirlistLabel")); // NOI18N
1315:                lbDirlist.getAccessibleContext().setAccessibleDescription(
1316:                        bundle.getString("ACSD_DirlistLabel")); // NOI18N
1317:
1318:                spDirlist.setMaximumSize(new java.awt.Dimension(200, 70));
1319:                spDirlist.setMinimumSize(new java.awt.Dimension(100, 70));
1320:                spDirlist.setPreferredSize(new java.awt.Dimension(150, 70));
1321:
1322:                lstDirlist
1323:                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
1324:                lstDirlist.setAutoscrolls(false);
1325:                lstDirlist.addListSelectionListener(this );
1326:                spDirlist.setViewportView(lstDirlist);
1327:
1328:                gridBagConstraints = new java.awt.GridBagConstraints();
1329:                gridBagConstraints.gridx = 0;
1330:                gridBagConstraints.gridy = 1;
1331:                gridBagConstraints.gridwidth = 4;
1332:                gridBagConstraints.gridheight = 4;
1333:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1334:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1335:                gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 6);
1336:                add(spDirlist, gridBagConstraints);
1337:
1338:                lbMakeCommand
1339:                        .setDisplayedMnemonic(java.util.ResourceBundle
1340:                                .getBundle(
1341:                                        "org/netbeans/modules/cnd/ui/options/Bundle")
1342:                                .getString("MNEM_MakeCommand").charAt(0));
1343:                lbMakeCommand.setText(bundle.getString("LBL_MakeCommand")); // NOI18N
1344:                lbMakeCommand.setToolTipText(bundle
1345:                        .getString("HINT_MakeCommand")); // NOI18N
1346:                gridBagConstraints = new java.awt.GridBagConstraints();
1347:                gridBagConstraints.gridx = 0;
1348:                gridBagConstraints.gridy = 5;
1349:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1350:                gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0);
1351:                add(lbMakeCommand, gridBagConstraints);
1352:                lbMakeCommand.getAccessibleContext().setAccessibleName(
1353:                        bundle.getString("ACSN_MakeCommand")); // NOI18N
1354:                lbMakeCommand.getAccessibleContext().setAccessibleDescription(
1355:                        bundle.getString("ACSD_MakeCommand")); // NOI18N
1356:
1357:                tfMakePath
1358:                        .setMaximumSize(new java.awt.Dimension(2147483647, 20));
1359:                tfMakePath.setMinimumSize(new java.awt.Dimension(50, 20));
1360:                tfMakePath.setPreferredSize(new java.awt.Dimension(100, 20));
1361:                gridBagConstraints = new java.awt.GridBagConstraints();
1362:                gridBagConstraints.gridx = 1;
1363:                gridBagConstraints.gridy = 5;
1364:                gridBagConstraints.gridwidth = 3;
1365:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1366:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1367:                gridBagConstraints.weightx = 100.0;
1368:                gridBagConstraints.insets = new java.awt.Insets(6, 2, 0, 0);
1369:                add(tfMakePath, gridBagConstraints);
1370:
1371:                btMakeVersion.setText(bundle.getString("LBL_MakeVersion")); // NOI18N
1372:                gridBagConstraints = new java.awt.GridBagConstraints();
1373:                gridBagConstraints.gridx = 4;
1374:                gridBagConstraints.gridy = 5;
1375:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1376:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
1377:                add(btMakeVersion, gridBagConstraints);
1378:                btMakeVersion.getAccessibleContext().setAccessibleName(
1379:                        bundle.getString("ACSN_MakeVersion")); // NOI18N
1380:                btMakeVersion.getAccessibleContext().setAccessibleDescription(
1381:                        bundle.getString("ACSD_MakeVersion")); // NOI18N
1382:
1383:                lbGdbCommand
1384:                        .setDisplayedMnemonic(java.util.ResourceBundle
1385:                                .getBundle(
1386:                                        "org/netbeans/modules/cnd/ui/options/Bundle")
1387:                                .getString("MNEM_GdbCommand").charAt(0));
1388:                lbGdbCommand.setText(bundle.getString("LBL_GdbCommand")); // NOI18N
1389:                lbGdbCommand
1390:                        .setToolTipText(bundle.getString("HINT_GdbCommand")); // NOI18N
1391:                gridBagConstraints = new java.awt.GridBagConstraints();
1392:                gridBagConstraints.gridx = 0;
1393:                gridBagConstraints.gridy = 6;
1394:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1395:                gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0);
1396:                add(lbGdbCommand, gridBagConstraints);
1397:                lbGdbCommand.getAccessibleContext().setAccessibleName(
1398:                        bundle.getString("ACSN_GdbCommand")); // NOI18N
1399:                lbGdbCommand.getAccessibleContext().setAccessibleDescription(
1400:                        bundle.getString("ACSD_GdbCommand")); // NOI18N
1401:
1402:                tfGdbPath.setMinimumSize(new java.awt.Dimension(50, 20));
1403:                tfGdbPath.setPreferredSize(new java.awt.Dimension(100, 20));
1404:                gridBagConstraints = new java.awt.GridBagConstraints();
1405:                gridBagConstraints.gridx = 1;
1406:                gridBagConstraints.gridy = 6;
1407:                gridBagConstraints.gridwidth = 3;
1408:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1409:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1410:                gridBagConstraints.weightx = 100.0;
1411:                gridBagConstraints.insets = new java.awt.Insets(6, 2, 0, 0);
1412:                add(tfGdbPath, gridBagConstraints);
1413:
1414:                btGdbVersion.setText(bundle.getString("LBL_GdbVersion")); // NOI18N
1415:                gridBagConstraints = new java.awt.GridBagConstraints();
1416:                gridBagConstraints.gridx = 4;
1417:                gridBagConstraints.gridy = 6;
1418:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1419:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
1420:                add(btGdbVersion, gridBagConstraints);
1421:                btGdbVersion.getAccessibleContext().setAccessibleName(
1422:                        bundle.getString("ACSN_GdbVersion")); // NOI18N
1423:                btGdbVersion.getAccessibleContext().setAccessibleDescription(
1424:                        bundle.getString("ACSD_GdbVersion")); // NOI18N
1425:
1426:                lbCCommand
1427:                        .setDisplayedMnemonic(java.util.ResourceBundle
1428:                                .getBundle(
1429:                                        "org/netbeans/modules/cnd/ui/options/Bundle")
1430:                                .getString("MNEM_CCommand").charAt(0));
1431:                lbCCommand.setLabelFor(cbCCommand);
1432:                lbCCommand.setText(bundle.getString("LBL_CCommand")); // NOI18N
1433:                lbCCommand.setToolTipText(bundle.getString("HINT_CCommand")); // NOI18N
1434:                gridBagConstraints = new java.awt.GridBagConstraints();
1435:                gridBagConstraints.gridx = 0;
1436:                gridBagConstraints.gridy = 8;
1437:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1438:                gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0);
1439:                add(lbCCommand, gridBagConstraints);
1440:                lbCCommand.getAccessibleContext().setAccessibleName(
1441:                        bundle.getString("ACSN_CCommand")); // NOI18N
1442:                lbCCommand.getAccessibleContext().setAccessibleDescription(
1443:                        bundle.getString("ACSD_CCommand")); // NOI18N
1444:
1445:                cbCCommand.setMinimumSize(new java.awt.Dimension(100, 18));
1446:                cbCCommand.setPreferredSize(new java.awt.Dimension(100, 20));
1447:                gridBagConstraints = new java.awt.GridBagConstraints();
1448:                gridBagConstraints.gridx = 1;
1449:                gridBagConstraints.gridy = 8;
1450:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1451:                gridBagConstraints.insets = new java.awt.Insets(6, 2, 0, 0);
1452:                add(cbCCommand, gridBagConstraints);
1453:
1454:                tfCPath.setEditable(false);
1455:                tfCPath.setMinimumSize(new java.awt.Dimension(50, 20));
1456:                tfCPath.setPreferredSize(new java.awt.Dimension(100, 20));
1457:                gridBagConstraints = new java.awt.GridBagConstraints();
1458:                gridBagConstraints.gridx = 2;
1459:                gridBagConstraints.gridy = 8;
1460:                gridBagConstraints.gridwidth = 2;
1461:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1462:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1463:                gridBagConstraints.weightx = 100.0;
1464:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
1465:                add(tfCPath, gridBagConstraints);
1466:
1467:                btCVersion.setText(bundle.getString("LBL_CVersion")); // NOI18N
1468:                gridBagConstraints = new java.awt.GridBagConstraints();
1469:                gridBagConstraints.gridx = 4;
1470:                gridBagConstraints.gridy = 8;
1471:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1472:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
1473:                add(btCVersion, gridBagConstraints);
1474:                btCVersion.getAccessibleContext().setAccessibleName(
1475:                        bundle.getString("ACSN_CVersion")); // NOI18N
1476:                btCVersion.getAccessibleContext().setAccessibleDescription(
1477:                        bundle.getString("ACSD_CVersion")); // NOI18N
1478:
1479:                lbCppCommand
1480:                        .setDisplayedMnemonic(java.util.ResourceBundle
1481:                                .getBundle(
1482:                                        "org/netbeans/modules/cnd/ui/options/Bundle")
1483:                                .getString("MNEM_CppCommand").charAt(0));
1484:                lbCppCommand.setLabelFor(cbCppCommand);
1485:                lbCppCommand.setText(bundle.getString("LBL_CppCommand")); // NOI18N
1486:                lbCppCommand
1487:                        .setToolTipText(bundle.getString("HINT_CppCommand")); // NOI18N
1488:                gridBagConstraints = new java.awt.GridBagConstraints();
1489:                gridBagConstraints.gridx = 0;
1490:                gridBagConstraints.gridy = 9;
1491:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1492:                gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0);
1493:                add(lbCppCommand, gridBagConstraints);
1494:                lbCppCommand.getAccessibleContext().setAccessibleName(
1495:                        bundle.getString("ACSN_CppCommand")); // NOI18N
1496:                lbCppCommand.getAccessibleContext().setAccessibleDescription(
1497:                        bundle.getString("ACSD_CppCommand")); // NOI18N
1498:
1499:                cbCppCommand.setMinimumSize(new java.awt.Dimension(100, 18));
1500:                cbCppCommand.setPreferredSize(new java.awt.Dimension(100, 20));
1501:                gridBagConstraints = new java.awt.GridBagConstraints();
1502:                gridBagConstraints.gridx = 1;
1503:                gridBagConstraints.gridy = 9;
1504:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1505:                gridBagConstraints.insets = new java.awt.Insets(6, 2, 0, 0);
1506:                add(cbCppCommand, gridBagConstraints);
1507:
1508:                tfCppPath.setEditable(false);
1509:                tfCppPath.setMinimumSize(new java.awt.Dimension(50, 20));
1510:                tfCppPath.setPreferredSize(new java.awt.Dimension(100, 20));
1511:                gridBagConstraints = new java.awt.GridBagConstraints();
1512:                gridBagConstraints.gridx = 2;
1513:                gridBagConstraints.gridy = 9;
1514:                gridBagConstraints.gridwidth = 2;
1515:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1516:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1517:                gridBagConstraints.weightx = 100.0;
1518:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
1519:                add(tfCppPath, gridBagConstraints);
1520:
1521:                btCppVersion.setText(bundle.getString("LBL_CppVersion")); // NOI18N
1522:                gridBagConstraints = new java.awt.GridBagConstraints();
1523:                gridBagConstraints.gridx = 4;
1524:                gridBagConstraints.gridy = 9;
1525:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1526:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
1527:                add(btCppVersion, gridBagConstraints);
1528:                btCppVersion.getAccessibleContext().setAccessibleName(
1529:                        bundle.getString("ACSN_CppVersion")); // NOI18N
1530:                btCppVersion.getAccessibleContext().setAccessibleDescription(
1531:                        bundle.getString("ACSD_CppVersion")); // NOI18N
1532:
1533:                lbFortranCommand
1534:                        .setDisplayedMnemonic(java.util.ResourceBundle
1535:                                .getBundle(
1536:                                        "org/netbeans/modules/cnd/ui/options/Bundle")
1537:                                .getString("MNEM_FortranCommand").charAt(0));
1538:                lbFortranCommand.setLabelFor(cbFortranCommand);
1539:                lbFortranCommand
1540:                        .setText(bundle.getString("LBL_FortranCommand")); // NOI18N
1541:                lbFortranCommand.setToolTipText(bundle
1542:                        .getString("HINT_FortranCommand")); // NOI18N
1543:                gridBagConstraints = new java.awt.GridBagConstraints();
1544:                gridBagConstraints.gridx = 0;
1545:                gridBagConstraints.gridy = 10;
1546:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1547:                gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0);
1548:                add(lbFortranCommand, gridBagConstraints);
1549:                lbFortranCommand.getAccessibleContext().setAccessibleName(
1550:                        bundle.getString("ACSN_FortranCommand")); // NOI18N
1551:                lbFortranCommand.getAccessibleContext()
1552:                        .setAccessibleDescription(
1553:                                bundle.getString("ACSD_FortranCommand")); // NOI18N
1554:
1555:                cbFortranCommand
1556:                        .setMinimumSize(new java.awt.Dimension(100, 18));
1557:                cbFortranCommand.setPreferredSize(new java.awt.Dimension(100,
1558:                        20));
1559:                gridBagConstraints = new java.awt.GridBagConstraints();
1560:                gridBagConstraints.gridx = 1;
1561:                gridBagConstraints.gridy = 10;
1562:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1563:                gridBagConstraints.insets = new java.awt.Insets(6, 2, 0, 0);
1564:                add(cbFortranCommand, gridBagConstraints);
1565:
1566:                tfFortranPath.setEditable(false);
1567:                tfFortranPath.setMinimumSize(new java.awt.Dimension(50, 20));
1568:                tfFortranPath.setPreferredSize(new java.awt.Dimension(100, 20));
1569:                gridBagConstraints = new java.awt.GridBagConstraints();
1570:                gridBagConstraints.gridx = 2;
1571:                gridBagConstraints.gridy = 10;
1572:                gridBagConstraints.gridwidth = 2;
1573:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1574:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1575:                gridBagConstraints.weightx = 100.0;
1576:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
1577:                add(tfFortranPath, gridBagConstraints);
1578:
1579:                btFortranVersion
1580:                        .setText(bundle.getString("LBL_FortranVersion")); // NOI18N
1581:                gridBagConstraints = new java.awt.GridBagConstraints();
1582:                gridBagConstraints.gridx = 4;
1583:                gridBagConstraints.gridy = 10;
1584:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1585:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 6);
1586:                add(btFortranVersion, gridBagConstraints);
1587:                btFortranVersion.getAccessibleContext().setAccessibleName(
1588:                        bundle.getString("ACSN_FortranVersion")); // NOI18N
1589:                btFortranVersion.getAccessibleContext()
1590:                        .setAccessibleDescription(
1591:                                bundle.getString("ACSD_FortranVersion")); // NOI18N
1592:
1593:                lbCompilerCollection
1594:                        .setDisplayedMnemonic(java.util.ResourceBundle
1595:                                .getBundle(
1596:                                        "org/netbeans/modules/cnd/ui/options/Bundle")
1597:                                .getString("MNEM_CompilerCollection").charAt(0));
1598:                lbCompilerCollection.setLabelFor(cbCompilerSet);
1599:                lbCompilerCollection.setText(bundle
1600:                        .getString("LBL_CompilerCollection")); // NOI18N
1601:                lbCompilerCollection.setToolTipText(bundle
1602:                        .getString("HINT_CompilerCollection")); // NOI18N
1603:                gridBagConstraints = new java.awt.GridBagConstraints();
1604:                gridBagConstraints.gridx = 0;
1605:                gridBagConstraints.gridy = 7;
1606:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1607:                gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0);
1608:                add(lbCompilerCollection, gridBagConstraints);
1609:                lbCompilerCollection.getAccessibleContext().setAccessibleName(
1610:                        bundle.getString("ACSN_CompilerCollection")); // NOI18N
1611:                lbCompilerCollection.getAccessibleContext()
1612:                        .setAccessibleDescription(
1613:                                bundle.getString("ACSD_CompilerCollection")); // NOI18N
1614:
1615:                gridBagConstraints = new java.awt.GridBagConstraints();
1616:                gridBagConstraints.gridx = 1;
1617:                gridBagConstraints.gridy = 7;
1618:                gridBagConstraints.gridwidth = 3;
1619:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1620:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1621:                gridBagConstraints.weightx = 1.0;
1622:                gridBagConstraints.insets = new java.awt.Insets(12, 2, 0, 0);
1623:                add(cbCompilerSet, gridBagConstraints);
1624:
1625:                btAdd.setMnemonic(java.util.ResourceBundle.getBundle(
1626:                        "org/netbeans/modules/cnd/ui/options/Bundle")
1627:                        .getString("MNEM_AddButton").charAt(0));
1628:                btAdd.setText(bundle.getString("LBL_AddButton")); // NOI18N
1629:                gridBagConstraints = new java.awt.GridBagConstraints();
1630:                gridBagConstraints.gridx = 4;
1631:                gridBagConstraints.gridy = 1;
1632:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1633:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 6);
1634:                add(btAdd, gridBagConstraints);
1635:                btAdd.getAccessibleContext().setAccessibleName(
1636:                        bundle.getString("ACSN_AddButton")); // NOI18N
1637:                btAdd.getAccessibleContext().setAccessibleDescription(
1638:                        bundle.getString("ACSD_AddButton")); // NOI18N
1639:
1640:                btRemove.setMnemonic(java.util.ResourceBundle.getBundle(
1641:                        "org/netbeans/modules/cnd/ui/options/Bundle")
1642:                        .getString("MNEM_RemoveButton").charAt(0));
1643:                btRemove.setText(bundle.getString("LBL_RemoveButton")); // NOI18N
1644:                btRemove.setEnabled(false);
1645:                gridBagConstraints = new java.awt.GridBagConstraints();
1646:                gridBagConstraints.gridx = 4;
1647:                gridBagConstraints.gridy = 2;
1648:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1649:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 6);
1650:                add(btRemove, gridBagConstraints);
1651:                btRemove.getAccessibleContext().setAccessibleName(
1652:                        bundle.getString("ACSN_RemoveButton")); // NOI18N
1653:                btRemove.getAccessibleContext().setAccessibleDescription(
1654:                        bundle.getString("ACSD_RemoveButton")); // NOI18N
1655:
1656:                btUp.setMnemonic(java.util.ResourceBundle.getBundle(
1657:                        "org/netbeans/modules/cnd/ui/options/Bundle")
1658:                        .getString("MNEM_UpButton").charAt(0));
1659:                btUp.setText(bundle.getString("LBL_UpButton")); // NOI18N
1660:                btUp.setEnabled(false);
1661:                gridBagConstraints = new java.awt.GridBagConstraints();
1662:                gridBagConstraints.gridx = 4;
1663:                gridBagConstraints.gridy = 3;
1664:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1665:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 6);
1666:                add(btUp, gridBagConstraints);
1667:                btUp.getAccessibleContext().setAccessibleName(
1668:                        bundle.getString("ACSN_UpButton")); // NOI18N
1669:                btUp.getAccessibleContext().setAccessibleDescription(
1670:                        bundle.getString("ACSD_UpButton")); // NOI18N
1671:
1672:                btDown.setMnemonic(java.util.ResourceBundle.getBundle(
1673:                        "org/netbeans/modules/cnd/ui/options/Bundle")
1674:                        .getString("MNEM_DownButton").charAt(0));
1675:                btDown.setText(bundle.getString("LBL_DownButton")); // NOI18N
1676:                btDown.setEnabled(false);
1677:                gridBagConstraints = new java.awt.GridBagConstraints();
1678:                gridBagConstraints.gridx = 4;
1679:                gridBagConstraints.gridy = 4;
1680:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1681:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 6);
1682:                add(btDown, gridBagConstraints);
1683:                btDown.getAccessibleContext().setAccessibleName(
1684:                        bundle.getString("ACSN_DownButton")); // NOI18N
1685:                btDown.getAccessibleContext().setAccessibleDescription(
1686:                        bundle.getString("ACSD_DownButton")); // NOI18N
1687:
1688:                jLabel1
1689:                        .setDisplayedMnemonic(java.util.ResourceBundle
1690:                                .getBundle(
1691:                                        "org/netbeans/modules/cnd/ui/options/Bundle")
1692:                                .getString("MNEM_RequiredTools").charAt(0));
1693:                jLabel1.setLabelFor(cbMakeRequired);
1694:                jLabel1.setText(bundle.getString("LBL_RequiredTools")); // NOI18N
1695:                gridBagConstraints = new java.awt.GridBagConstraints();
1696:                gridBagConstraints.gridx = 0;
1697:                gridBagConstraints.gridy = 11;
1698:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1699:                gridBagConstraints.insets = new java.awt.Insets(8, 4, 0, 0);
1700:                add(jLabel1, gridBagConstraints);
1701:
1702:                jPanel1.setLayout(new java.awt.GridBagLayout());
1703:
1704:                cbMakeRequired.setSelected(true);
1705:                cbMakeRequired.setText(bundle.getString("LBL_RequiredMake")); // NOI18N
1706:                cbMakeRequired.setEnabled(false);
1707:                cbMakeRequired.setMargin(new java.awt.Insets(0, 0, 0, 0));
1708:                gridBagConstraints = new java.awt.GridBagConstraints();
1709:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1710:                gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
1711:                jPanel1.add(cbMakeRequired, gridBagConstraints);
1712:
1713:                cbGdbRequired.setText(bundle.getString("LBL_RequiredGdb")); // NOI18N
1714:                cbGdbRequired.setEnabled(false);
1715:                cbGdbRequired.setMargin(new java.awt.Insets(0, 0, 0, 0));
1716:                gridBagConstraints = new java.awt.GridBagConstraints();
1717:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1718:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
1719:                jPanel1.add(cbGdbRequired, gridBagConstraints);
1720:
1721:                cbCRequired.setText(bundle.getString("LBL_RequiredCompiler_C")); // NOI18N
1722:                cbCRequired.setMargin(new java.awt.Insets(0, 0, 0, 0));
1723:                gridBagConstraints = new java.awt.GridBagConstraints();
1724:                gridBagConstraints.gridx = 0;
1725:                gridBagConstraints.gridy = 1;
1726:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1727:                gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0);
1728:                jPanel1.add(cbCRequired, gridBagConstraints);
1729:
1730:                cbCppRequired.setText(bundle
1731:                        .getString("LBL_RequiredCompiler_Cpp")); // NOI18N
1732:                cbCppRequired.setMargin(new java.awt.Insets(0, 0, 0, 0));
1733:                gridBagConstraints = new java.awt.GridBagConstraints();
1734:                gridBagConstraints.gridx = 1;
1735:                gridBagConstraints.gridy = 1;
1736:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1737:                gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
1738:                jPanel1.add(cbCppRequired, gridBagConstraints);
1739:
1740:                cbFortranRequired.setText(bundle
1741:                        .getString("LBL_RequiredCompiler_Fortran")); // NOI18N
1742:                cbFortranRequired.setMargin(new java.awt.Insets(0, 0, 0, 0));
1743:                gridBagConstraints = new java.awt.GridBagConstraints();
1744:                gridBagConstraints.gridx = 2;
1745:                gridBagConstraints.gridy = 1;
1746:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1747:                gridBagConstraints.insets = new java.awt.Insets(6, 2, 0, 0);
1748:                jPanel1.add(cbFortranRequired, gridBagConstraints);
1749:
1750:                gridBagConstraints = new java.awt.GridBagConstraints();
1751:                gridBagConstraints.gridx = 1;
1752:                gridBagConstraints.gridy = 11;
1753:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
1754:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
1755:                gridBagConstraints.insets = new java.awt.Insets(4, 2, 0, 0);
1756:                add(jPanel1, gridBagConstraints);
1757:                gridBagConstraints = new java.awt.GridBagConstraints();
1758:                gridBagConstraints.gridx = 0;
1759:                gridBagConstraints.gridy = 12;
1760:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
1761:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1762:                gridBagConstraints.weightx = 1.0;
1763:                gridBagConstraints.weighty = 1.0;
1764:                add(jSeparator1, gridBagConstraints);
1765:
1766:                errorScrollPane.setBorder(null);
1767:
1768:                errorTextArea.setEditable(false);
1769:                errorTextArea.setForeground(new java.awt.Color(255, 0, 0));
1770:                errorTextArea.setLineWrap(true);
1771:                errorTextArea.setRows(3);
1772:                errorTextArea.setBorder(null);
1773:                errorScrollPane.setViewportView(errorTextArea);
1774:
1775:                gridBagConstraints = new java.awt.GridBagConstraints();
1776:                gridBagConstraints.gridwidth = 5;
1777:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1778:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
1779:                gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
1780:                add(errorScrollPane, gridBagConstraints);
1781:            }// </editor-fold>//GEN-END:initComponents
1782:
1783:            // Variables declaration - do not modify//GEN-BEGIN:variables
1784:            private javax.swing.JButton btAdd;
1785:            private javax.swing.JButton btCVersion;
1786:            private javax.swing.JButton btCppVersion;
1787:            private javax.swing.JButton btDown;
1788:            private javax.swing.JButton btFortranVersion;
1789:            private javax.swing.JButton btGdbVersion;
1790:            private javax.swing.JButton btMakeVersion;
1791:            private javax.swing.JButton btRemove;
1792:            private javax.swing.JButton btUp;
1793:            private javax.swing.JComboBox cbCCommand;
1794:            private javax.swing.JCheckBox cbCRequired;
1795:            private javax.swing.JComboBox cbCompilerSet;
1796:            private javax.swing.JComboBox cbCppCommand;
1797:            private javax.swing.JCheckBox cbCppRequired;
1798:            private javax.swing.JComboBox cbFortranCommand;
1799:            private javax.swing.JCheckBox cbFortranRequired;
1800:            private javax.swing.JCheckBox cbGdbRequired;
1801:            private javax.swing.JCheckBox cbMakeRequired;
1802:            private javax.swing.JScrollPane errorScrollPane;
1803:            private javax.swing.JTextArea errorTextArea;
1804:            private javax.swing.JLabel jLabel1;
1805:            private javax.swing.JPanel jPanel1;
1806:            private javax.swing.JSeparator jSeparator1;
1807:            private javax.swing.JLabel lbCCommand;
1808:            private javax.swing.JLabel lbCompilerCollection;
1809:            private javax.swing.JLabel lbCppCommand;
1810:            private javax.swing.JLabel lbDirlist;
1811:            private javax.swing.JLabel lbFortranCommand;
1812:            private javax.swing.JLabel lbGdbCommand;
1813:            private javax.swing.JLabel lbMakeCommand;
1814:            private javax.swing.JList lstDirlist;
1815:            private javax.swing.JScrollPane spDirlist;
1816:            private javax.swing.JTextField tfCPath;
1817:            private javax.swing.JTextField tfCppPath;
1818:            private javax.swing.JTextField tfFortranPath;
1819:            private javax.swing.JTextField tfGdbPath;
1820:            private javax.swing.JTextField tfMakePath;
1821:            // End of variables declaration//GEN-END:variables
1822:
1823:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.