Source Code Cross Referenced for BasicProjectInfoPanel.java in  » IDE-Netbeans » ant » org » netbeans » modules » ant » freeform » ui » 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 » ant » org.netbeans.modules.ant.freeform.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.ant.freeform.ui;
043:
044:        import java.io.File;
045:        import java.text.MessageFormat;
046:        import javax.swing.JFileChooser;
047:        import javax.swing.event.ChangeListener;
048:        import javax.swing.event.DocumentEvent;
049:        import javax.swing.event.DocumentListener;
050:        import org.netbeans.api.project.FileOwnerQuery;
051:        import org.netbeans.api.project.Project;
052:        import org.netbeans.api.project.ProjectInformation;
053:        import org.netbeans.modules.ant.freeform.Util;
054:        import org.netbeans.spi.project.ui.support.ProjectChooser;
055:        import org.openide.filesystems.FileObject;
056:        import org.openide.filesystems.FileUtil;
057:        import org.openide.util.HelpCtx;
058:        import org.openide.util.NbBundle;
059:
060:        /**
061:         * @author  David Konecny
062:         */
063:        public class BasicProjectInfoPanel extends javax.swing.JPanel implements 
064:                HelpCtx.Provider {
065:
066:            private DocumentListener documentListener;
067:            private ChangeListener listener;
068:            /** Was antScript property edited by user? */
069:            private boolean antScriptTouched = false;
070:            /** Was projectFolder property edited by user? */
071:            private boolean projectFolderTouched = false;
072:            /** Was projectName property edited by user? */
073:            private boolean projectNameTouched = false;
074:            /** Is choosen Ant script a valid one? */
075:            private boolean antScriptValidityChecked;
076:
077:            public BasicProjectInfoPanel(String projectLocation,
078:                    String antScript, String projectName, String projectFolder,
079:                    ChangeListener listener) {
080:                initComponents();
081:                this .projectLocation.setText(projectLocation);
082:                this .antScript.setText(antScript);
083:                this .projectName.setText(projectName);
084:                this .projectFolder.setText(projectFolder);
085:                this .listener = listener;
086:                documentListener = new DocumentListener() {
087:                    public void insertUpdate(DocumentEvent e) {
088:                        update(e);
089:                    }
090:
091:                    public void removeUpdate(DocumentEvent e) {
092:                        update(e);
093:                    }
094:
095:                    public void changedUpdate(DocumentEvent e) {
096:                        update(e);
097:                    }
098:                };
099:                this .projectLocation.getDocument().addDocumentListener(
100:                        documentListener);
101:                this .antScript.getDocument().addDocumentListener(
102:                        documentListener);
103:                this .projectName.getDocument().addDocumentListener(
104:                        documentListener);
105:                this .projectFolder.getDocument().addDocumentListener(
106:                        documentListener);
107:            }
108:
109:            public HelpCtx getHelpCtx() {
110:                return new HelpCtx(BasicProjectInfoPanel.class);
111:            }
112:
113:            public File getProjectLocation() {
114:                return getAsFile(projectLocation.getText());
115:            }
116:
117:            public File getAntScript() {
118:                return getAsFile(antScript.getText());
119:            }
120:
121:            public String getProjectName() {
122:                return projectName.getText();
123:            }
124:
125:            public File getProjectFolder() {
126:                return getAsFile(projectFolder.getText());
127:            }
128:
129:            public Boolean getMainProject() {
130:                return Boolean.valueOf(mainProject.isSelected());
131:            }
132:
133:            public String getError() {
134:                if (projectLocation.getText().length() == 0) {
135:                    return org.openide.util.NbBundle.getMessage(
136:                            BasicProjectInfoPanel.class,
137:                            "LBL_BasicProjectInfoPanel_Error_1");
138:                }
139:                if (!getProjectLocation().exists()) {
140:                    return org.openide.util.NbBundle.getMessage(
141:                            BasicProjectInfoPanel.class,
142:                            "LBL_BasicProjectInfoPanel_Error_2");
143:                }
144:                if (antScript.getText().length() == 0) {
145:                    return org.openide.util.NbBundle.getMessage(
146:                            BasicProjectInfoPanel.class,
147:                            "LBL_BasicProjectInfoPanel_Error_3");
148:                }
149:                if (!getAntScript().exists()) {
150:                    return org.openide.util.NbBundle.getMessage(
151:                            BasicProjectInfoPanel.class,
152:                            "LBL_BasicProjectInfoPanel_Error_4");
153:                }
154:                if (!antScriptValidityChecked) {
155:                    FileObject fo = FileUtil.toFileObject(getAntScript());
156:                    if (fo != null && Util.getAntScriptTargetNames(fo) != null) {
157:                        antScriptValidityChecked = true;
158:                    } else {
159:                        return org.openide.util.NbBundle.getMessage(
160:                                BasicProjectInfoPanel.class,
161:                                "LBL_BasicProjectInfoPanel_Error_5");
162:                    }
163:                }
164:                if (getProjectName().length() == 0) {
165:                    return org.openide.util.NbBundle.getMessage(
166:                            BasicProjectInfoPanel.class,
167:                            "LBL_BasicProjectInfoPanel_Error_6");
168:                }
169:                if (projectFolder.getText().length() == 0) {
170:                    return org.openide.util.NbBundle.getMessage(
171:                            BasicProjectInfoPanel.class,
172:                            "LBL_BasicProjectInfoPanel_Error_7");
173:                }
174:                if (getAsFile(
175:                        projectFolder.getText() + File.separatorChar
176:                                + "nbproject").exists()) { // NOI18N
177:                    return org.openide.util.NbBundle.getMessage(
178:                            BasicProjectInfoPanel.class,
179:                            "LBL_BasicProjectInfoPanel_Error_8");
180:                }
181:
182:                Project p;
183:                File projectFolder = getProjectFolder();
184:
185:                assert projectFolder != null;
186:
187:                if ((p = FileOwnerQuery.getOwner(projectFolder.toURI())) != null
188:                        && projectFolder.equals(FileUtil.toFile(p
189:                                .getProjectDirectory()))) {
190:                    ProjectInformation pi = p.getLookup().lookup(
191:                            ProjectInformation.class);
192:                    String displayName = (pi == null ? "" : pi.getDisplayName()); //NOI18N
193:                    return MessageFormat.format(org.openide.util.NbBundle
194:                            .getMessage(BasicProjectInfoPanel.class,
195:                                    "LBL_BasicProjectInfoPanel_Error_9"),
196:                            new Object[] { displayName });
197:                }
198:
199:                File projectLocation = getProjectLocation();
200:
201:                assert projectLocation != null;
202:
203:                if ((p = FileOwnerQuery.getOwner(projectLocation.toURI())) != null
204:                        && projectLocation.equals(FileUtil.toFile(p
205:                                .getProjectDirectory()))) {
206:                    ProjectInformation pi = p.getLookup().lookup(
207:                            ProjectInformation.class);
208:                    String displayName = (pi == null ? "" : pi.getDisplayName()); //NOI18N
209:                    return MessageFormat.format(org.openide.util.NbBundle
210:                            .getMessage(BasicProjectInfoPanel.class,
211:                                    "LBL_BasicProjectInfoPanel_Error_10"),
212:                            new Object[] { displayName });
213:                }
214:                return null;
215:            }
216:
217:            private File getAsFile(String filename) {
218:                return FileUtil.normalizeFile(new File(filename));
219:            }
220:
221:            private boolean ignoreEvent = false;
222:
223:            private void update(DocumentEvent e) {
224:                if (ignoreEvent) {
225:                    // side-effect of changes done in this handler
226:                    return;
227:                }
228:
229:                // start ignoring events
230:                ignoreEvent = true;
231:
232:                if (projectLocation.getDocument() == e.getDocument()) {
233:                    antScriptValidityChecked = false;
234:                    updateAntScriptLocation();
235:                    updateProjectName();
236:                    updateProjectFolder();
237:                }
238:                if (antScript.getDocument() == e.getDocument()) {
239:                    antScriptValidityChecked = false;
240:                    updateProjectName();
241:                }
242:
243:                // stop ignoring events
244:                ignoreEvent = false;
245:
246:                if (projectFolder.getDocument() == e.getDocument()) {
247:                    projectFolderTouched = !"".equals(projectFolder.getText());
248:                }
249:                if (antScript.getDocument() == e.getDocument()) {
250:                    antScriptTouched = !"".equals(antScript.getText());
251:                }
252:                if (projectName.getDocument() == e.getDocument()) {
253:                    projectNameTouched = !"".equals(projectName.getText());
254:                }
255:
256:                listener.stateChanged(null);
257:            }
258:
259:            private boolean isValidProjectLocation() {
260:                return (getProjectLocation().exists()
261:                        && getProjectLocation().isDirectory()
262:                        && projectLocation.getText().length() > 0 && (!projectLocation
263:                        .getText().endsWith(":"))); // NOI18N
264:            }
265:
266:            private void updateAntScriptLocation() {
267:                if (antScriptTouched) {
268:                    return;
269:                }
270:                if (isValidProjectLocation()) {
271:                    File as = new File(getProjectLocation().getAbsolutePath()
272:                            + File.separatorChar + "build.xml"); // NOI18N
273:                    if (as.exists()) {
274:                        antScript.setText(as.getAbsolutePath());
275:                        return;
276:                    }
277:                }
278:                antScript.setText(""); // NOI18N
279:            }
280:
281:            private void updateProjectName() {
282:                if (projectNameTouched) {
283:                    return;
284:                }
285:                if (getAntScript().exists()) {
286:                    File as = new File(getAntScript().getAbsolutePath());
287:                    if (as.exists()) {
288:                        FileObject fo = FileUtil.toFileObject(as);
289:                        assert fo != null : as;
290:                        String name = Util.getAntScriptName(fo);
291:                        if (name != null) {
292:                            projectName.setText(name);
293:                            return;
294:                        }
295:                    }
296:                }
297:                projectName.setText(""); // NOI18N
298:            }
299:
300:            private void updateProjectFolder() {
301:                if (projectFolderTouched) {
302:                    return;
303:                }
304:                if (isValidProjectLocation()) {
305:                    projectFolder.setText(getProjectLocation()
306:                            .getAbsolutePath());
307:                } else {
308:                    projectFolder.setText(""); // NOI18N
309:                }
310:            }
311:
312:            /**
313:             * This method is called from within the constructor to
314:             * initialize the form.
315:             * WARNING: Do NOT modify this code. The content of this method is
316:             * always regenerated by the Form Editor.
317:             */
318:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
319:            private void initComponents() {
320:                java.awt.GridBagConstraints gridBagConstraints;
321:
322:                jLabel1 = new javax.swing.JLabel();
323:                jLabel2 = new javax.swing.JLabel();
324:                jLabel3 = new javax.swing.JLabel();
325:                jLabel4 = new javax.swing.JLabel();
326:                jLabel5 = new javax.swing.JLabel();
327:                antScript = new javax.swing.JTextField();
328:                projectName = new javax.swing.JTextField();
329:                projectFolder = new javax.swing.JTextField();
330:                browseAntScript = new javax.swing.JButton();
331:                browseProjectFolder = new javax.swing.JButton();
332:                projectLocation = new javax.swing.JTextField();
333:                jLabel6 = new javax.swing.JLabel();
334:                browseProjectLocation = new javax.swing.JButton();
335:                jSeparator1 = new javax.swing.JSeparator();
336:                mainProject = new javax.swing.JCheckBox();
337:                jPanel2 = new javax.swing.JPanel();
338:                jLabel7 = new javax.swing.JLabel();
339:                jTextArea2 = new javax.swing.JTextArea();
340:
341:                setPreferredSize(new java.awt.Dimension(400, 360));
342:                setLayout(new java.awt.GridBagLayout());
343:
344:                org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
345:                        org.openide.util.NbBundle.getMessage(
346:                                BasicProjectInfoPanel.class,
347:                                "LBL_BasicProjectInfoPanel_jLabel1")); // NOI18N
348:                gridBagConstraints = new java.awt.GridBagConstraints();
349:                gridBagConstraints.gridwidth = 3;
350:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
351:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
352:                add(jLabel1, gridBagConstraints);
353:                jLabel1.getAccessibleContext().setAccessibleDescription(
354:                        org.openide.util.NbBundle.getMessage(
355:                                BasicProjectInfoPanel.class,
356:                                "ACSD_BasicProjectInfoPanel_jLabel1")); // NOI18N
357:
358:                jLabel2.setLabelFor(antScript);
359:                org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
360:                        org.openide.util.NbBundle.getMessage(
361:                                BasicProjectInfoPanel.class,
362:                                "LBL_BasicProjectInfoPanel_jLabel2")); // NOI18N
363:                gridBagConstraints = new java.awt.GridBagConstraints();
364:                gridBagConstraints.gridx = 0;
365:                gridBagConstraints.gridy = 2;
366:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
367:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12);
368:                add(jLabel2, gridBagConstraints);
369:                jLabel2.getAccessibleContext().setAccessibleDescription(
370:                        org.openide.util.NbBundle.getMessage(
371:                                BasicProjectInfoPanel.class,
372:                                "ACSD_BasicProjectInfoPanel_jLabel2")); // NOI18N
373:
374:                org.openide.awt.Mnemonics.setLocalizedText(jLabel3,
375:                        org.openide.util.NbBundle.getMessage(
376:                                BasicProjectInfoPanel.class,
377:                                "LBL_BasicProjectInfoPanel_jLabel3")); // NOI18N
378:                gridBagConstraints = new java.awt.GridBagConstraints();
379:                gridBagConstraints.gridx = 0;
380:                gridBagConstraints.gridy = 3;
381:                gridBagConstraints.gridwidth = 3;
382:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
383:                gridBagConstraints.insets = new java.awt.Insets(16, 0, 10, 0);
384:                add(jLabel3, gridBagConstraints);
385:                jLabel3.getAccessibleContext().setAccessibleDescription(
386:                        org.openide.util.NbBundle.getMessage(
387:                                BasicProjectInfoPanel.class,
388:                                "ACSD_BasicProjectInfoPanel_jLabel3")); // NOI18N
389:
390:                jLabel4.setLabelFor(projectName);
391:                org.openide.awt.Mnemonics.setLocalizedText(jLabel4,
392:                        org.openide.util.NbBundle.getMessage(
393:                                BasicProjectInfoPanel.class,
394:                                "LBL_BasicProjectInfoPanel_jLabel4")); // NOI18N
395:                gridBagConstraints = new java.awt.GridBagConstraints();
396:                gridBagConstraints.gridx = 0;
397:                gridBagConstraints.gridy = 4;
398:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
399:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
400:                add(jLabel4, gridBagConstraints);
401:                jLabel4.getAccessibleContext().setAccessibleDescription(
402:                        org.openide.util.NbBundle.getMessage(
403:                                BasicProjectInfoPanel.class,
404:                                "ACSD_BasicProjectInfoPanel_jLabel4")); // NOI18N
405:
406:                jLabel5.setLabelFor(projectFolder);
407:                org.openide.awt.Mnemonics.setLocalizedText(jLabel5,
408:                        org.openide.util.NbBundle.getMessage(
409:                                BasicProjectInfoPanel.class,
410:                                "LBL_BasicProjectInfoPanel_jLabel5")); // NOI18N
411:                gridBagConstraints = new java.awt.GridBagConstraints();
412:                gridBagConstraints.gridx = 0;
413:                gridBagConstraints.gridy = 5;
414:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
415:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12);
416:                add(jLabel5, gridBagConstraints);
417:                jLabel5.getAccessibleContext().setAccessibleDescription(
418:                        org.openide.util.NbBundle.getMessage(
419:                                BasicProjectInfoPanel.class,
420:                                "ACSD_BasicProjectInfoPanel_jLabel5")); // NOI18N
421:
422:                gridBagConstraints = new java.awt.GridBagConstraints();
423:                gridBagConstraints.gridx = 1;
424:                gridBagConstraints.gridy = 2;
425:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
426:                gridBagConstraints.weightx = 1.0;
427:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12);
428:                add(antScript, gridBagConstraints);
429:                gridBagConstraints = new java.awt.GridBagConstraints();
430:                gridBagConstraints.gridx = 1;
431:                gridBagConstraints.gridy = 4;
432:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
433:                gridBagConstraints.weightx = 1.0;
434:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
435:                add(projectName, gridBagConstraints);
436:                gridBagConstraints = new java.awt.GridBagConstraints();
437:                gridBagConstraints.gridx = 1;
438:                gridBagConstraints.gridy = 5;
439:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
440:                gridBagConstraints.weightx = 1.0;
441:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12);
442:                add(projectFolder, gridBagConstraints);
443:
444:                org.openide.awt.Mnemonics.setLocalizedText(browseAntScript,
445:                        org.openide.util.NbBundle.getMessage(
446:                                BasicProjectInfoPanel.class,
447:                                "BTN_BasicProjectInfoPanel_browseAntScript")); // NOI18N
448:                browseAntScript
449:                        .addActionListener(new java.awt.event.ActionListener() {
450:                            public void actionPerformed(
451:                                    java.awt.event.ActionEvent evt) {
452:                                browseAntScriptActionPerformed(evt);
453:                            }
454:                        });
455:                gridBagConstraints = new java.awt.GridBagConstraints();
456:                gridBagConstraints.gridx = 2;
457:                gridBagConstraints.gridy = 2;
458:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
459:                add(browseAntScript, gridBagConstraints);
460:                browseAntScript
461:                        .getAccessibleContext()
462:                        .setAccessibleDescription(
463:                                org.openide.util.NbBundle
464:                                        .getMessage(
465:                                                BasicProjectInfoPanel.class,
466:                                                "ACSD_BasicProjectInfoPanel_browseAntScript")); // NOI18N
467:
468:                org.openide.awt.Mnemonics
469:                        .setLocalizedText(
470:                                browseProjectFolder,
471:                                org.openide.util.NbBundle
472:                                        .getMessage(
473:                                                BasicProjectInfoPanel.class,
474:                                                "BTN_BasicProjectInfoPanel_browseProjectFolder")); // NOI18N
475:                browseProjectFolder
476:                        .addActionListener(new java.awt.event.ActionListener() {
477:                            public void actionPerformed(
478:                                    java.awt.event.ActionEvent evt) {
479:                                browseProjectFolderActionPerformed(evt);
480:                            }
481:                        });
482:                gridBagConstraints = new java.awt.GridBagConstraints();
483:                gridBagConstraints.gridx = 2;
484:                gridBagConstraints.gridy = 5;
485:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
486:                add(browseProjectFolder, gridBagConstraints);
487:                browseProjectFolder
488:                        .getAccessibleContext()
489:                        .setAccessibleDescription(
490:                                org.openide.util.NbBundle
491:                                        .getMessage(
492:                                                BasicProjectInfoPanel.class,
493:                                                "ACSD_BasicProjectInfoPanel_browseProjectFolder")); // NOI18N
494:
495:                gridBagConstraints = new java.awt.GridBagConstraints();
496:                gridBagConstraints.gridx = 1;
497:                gridBagConstraints.gridy = 1;
498:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
499:                gridBagConstraints.weightx = 1.0;
500:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
501:                add(projectLocation, gridBagConstraints);
502:
503:                jLabel6.setLabelFor(projectLocation);
504:                org.openide.awt.Mnemonics.setLocalizedText(jLabel6,
505:                        org.openide.util.NbBundle.getMessage(
506:                                BasicProjectInfoPanel.class,
507:                                "LBL_BasicProjectInfoPanel_jLabel6")); // NOI18N
508:                gridBagConstraints = new java.awt.GridBagConstraints();
509:                gridBagConstraints.gridx = 0;
510:                gridBagConstraints.gridy = 1;
511:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
512:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
513:                add(jLabel6, gridBagConstraints);
514:                jLabel6.getAccessibleContext().setAccessibleDescription(
515:                        org.openide.util.NbBundle.getMessage(
516:                                BasicProjectInfoPanel.class,
517:                                "ACSD_BasicProjectInfoPanel_jLabel6")); // NOI18N
518:
519:                org.openide.awt.Mnemonics
520:                        .setLocalizedText(
521:                                browseProjectLocation,
522:                                org.openide.util.NbBundle
523:                                        .getMessage(
524:                                                BasicProjectInfoPanel.class,
525:                                                "BTN_BasicProjectInfoPanel_browseProjectLocation")); // NOI18N
526:                browseProjectLocation
527:                        .addActionListener(new java.awt.event.ActionListener() {
528:                            public void actionPerformed(
529:                                    java.awt.event.ActionEvent evt) {
530:                                browseProjectLocationActionPerformed(evt);
531:                            }
532:                        });
533:                gridBagConstraints = new java.awt.GridBagConstraints();
534:                gridBagConstraints.gridx = 2;
535:                gridBagConstraints.gridy = 1;
536:                add(browseProjectLocation, gridBagConstraints);
537:                browseProjectLocation
538:                        .getAccessibleContext()
539:                        .setAccessibleDescription(
540:                                org.openide.util.NbBundle
541:                                        .getMessage(
542:                                                BasicProjectInfoPanel.class,
543:                                                "ACSD_BasicProjectInfoPanel_browseProjectLocation")); // NOI18N
544:
545:                gridBagConstraints = new java.awt.GridBagConstraints();
546:                gridBagConstraints.gridx = 0;
547:                gridBagConstraints.gridy = 6;
548:                gridBagConstraints.gridwidth = 3;
549:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
550:                gridBagConstraints.insets = new java.awt.Insets(12, 0, 10, 0);
551:                add(jSeparator1, gridBagConstraints);
552:
553:                mainProject.setSelected(true);
554:                org.openide.awt.Mnemonics.setLocalizedText(mainProject,
555:                        org.openide.util.NbBundle.getMessage(
556:                                BasicProjectInfoPanel.class,
557:                                "LBL_BasicProjectInfoPanel_mainProject")); // NOI18N
558:                gridBagConstraints = new java.awt.GridBagConstraints();
559:                gridBagConstraints.gridx = 0;
560:                gridBagConstraints.gridy = 7;
561:                gridBagConstraints.gridwidth = 3;
562:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
563:                add(mainProject, gridBagConstraints);
564:                mainProject.getAccessibleContext().setAccessibleDescription(
565:                        org.openide.util.NbBundle.getMessage(
566:                                BasicProjectInfoPanel.class,
567:                                "ACSD_BasicProjectInfoPanel_mainProject")); // NOI18N
568:
569:                jPanel2.setBorder(javax.swing.BorderFactory
570:                        .createLineBorder(javax.swing.UIManager.getDefaults()
571:                                .getColor("Label.disabledForeground")));
572:                jPanel2.setLayout(new java.awt.GridBagLayout());
573:
574:                jLabel7
575:                        .setIcon(new javax.swing.ImageIcon(
576:                                getClass()
577:                                        .getResource(
578:                                                "/org/netbeans/modules/ant/freeform/resources/alert_32.png"))); // NOI18N
579:                gridBagConstraints = new java.awt.GridBagConstraints();
580:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
581:                gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 0);
582:                jPanel2.add(jLabel7, gridBagConstraints);
583:
584:                jTextArea2.setBackground(javax.swing.UIManager.getDefaults()
585:                        .getColor("Panel.background"));
586:                jTextArea2.setEditable(false);
587:                jTextArea2.setLineWrap(true);
588:                jTextArea2.setText(org.openide.util.NbBundle
589:                        .getMessage(BasicProjectInfoPanel.class,
590:                                "Freeform_Warning_Message")); // NOI18N
591:                jTextArea2.setWrapStyleWord(true);
592:                gridBagConstraints = new java.awt.GridBagConstraints();
593:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
594:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
595:                gridBagConstraints.weightx = 1.0;
596:                gridBagConstraints.insets = new java.awt.Insets(4, 10, 4, 4);
597:                jPanel2.add(jTextArea2, gridBagConstraints);
598:                jTextArea2.getAccessibleContext().setAccessibleName(
599:                        org.openide.util.NbBundle.getMessage(
600:                                BasicProjectInfoPanel.class,
601:                                "ACSN_Freeform_Warning_Message")); // NOI18N
602:                jTextArea2.getAccessibleContext().setAccessibleDescription(
603:                        org.openide.util.NbBundle.getMessage(
604:                                BasicProjectInfoPanel.class,
605:                                "ACSD_Freeform_Warning_Message")); // NOI18N
606:
607:                gridBagConstraints = new java.awt.GridBagConstraints();
608:                gridBagConstraints.gridx = 0;
609:                gridBagConstraints.gridy = 8;
610:                gridBagConstraints.gridwidth = 3;
611:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
612:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
613:                gridBagConstraints.weightx = 1.0;
614:                gridBagConstraints.weighty = 1.0;
615:                gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0);
616:                add(jPanel2, gridBagConstraints);
617:            }// </editor-fold>//GEN-END:initComponents
618:
619:            private void browseProjectLocationActionPerformed(
620:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseProjectLocationActionPerformed
621:                JFileChooser chooser = new JFileChooser();
622:                FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
623:                chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
624:                if (projectLocation.getText().length() > 0
625:                        && getProjectLocation().exists()) {
626:                    chooser.setSelectedFile(getProjectLocation());
627:                } else {
628:                    chooser.setSelectedFile(ProjectChooser.getProjectsFolder());
629:                }
630:                chooser.setDialogTitle(NbBundle.getMessage(
631:                        BasicProjectInfoPanel.class, "LBL_Browse_Location"));
632:                if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this )) {
633:                    File projectLoc = FileUtil.normalizeFile(chooser
634:                            .getSelectedFile());
635:                    projectLocation.setText(projectLoc.getAbsolutePath());
636:                }
637:            }//GEN-LAST:event_browseProjectLocationActionPerformed
638:
639:            private void browseProjectFolderActionPerformed(
640:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseProjectFolderActionPerformed
641:                JFileChooser chooser = new JFileChooser();
642:                FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
643:                chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
644:                if (projectFolder.getText().length() > 0
645:                        && getProjectFolder().exists()) {
646:                    chooser.setSelectedFile(getProjectFolder());
647:                } else if (projectLocation.getText().length() > 0
648:                        && getProjectLocation().exists()) {
649:                    chooser.setSelectedFile(getProjectLocation());
650:                } else {
651:                    chooser.setSelectedFile(ProjectChooser.getProjectsFolder());
652:                }
653:                chooser.setDialogTitle(NbBundle.getMessage(
654:                        BasicProjectInfoPanel.class,
655:                        "LBL_Browse_Project_Folder"));
656:                if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this )) {
657:                    File projectDir = FileUtil.normalizeFile(chooser
658:                            .getSelectedFile());
659:                    projectFolder.setText(projectDir.getAbsolutePath());
660:                }
661:            }//GEN-LAST:event_browseProjectFolderActionPerformed
662:
663:            private void browseAntScriptActionPerformed(
664:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseAntScriptActionPerformed
665:                JFileChooser chooser = new JFileChooser();
666:                FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
667:                chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
668:                if (antScript.getText().length() > 0 && getAntScript().exists()) {
669:                    chooser.setSelectedFile(getAntScript());
670:                } else if (projectLocation.getText().length() > 0
671:                        && getProjectLocation().exists()) {
672:                    chooser.setSelectedFile(getProjectLocation());
673:                } else {
674:                    chooser.setSelectedFile(ProjectChooser.getProjectsFolder());
675:                }
676:                chooser
677:                        .setDialogTitle(NbBundle.getMessage(
678:                                BasicProjectInfoPanel.class,
679:                                "LBL_Browse_Build_Script"));
680:                if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this )) {
681:                    File script = FileUtil.normalizeFile(chooser
682:                            .getSelectedFile());
683:                    antScript.setText(script.getAbsolutePath());
684:                }
685:            }//GEN-LAST:event_browseAntScriptActionPerformed
686:
687:            // Variables declaration - do not modify//GEN-BEGIN:variables
688:            private javax.swing.JTextField antScript;
689:            private javax.swing.JButton browseAntScript;
690:            private javax.swing.JButton browseProjectFolder;
691:            private javax.swing.JButton browseProjectLocation;
692:            private javax.swing.JLabel jLabel1;
693:            private javax.swing.JLabel jLabel2;
694:            private javax.swing.JLabel jLabel3;
695:            private javax.swing.JLabel jLabel4;
696:            private javax.swing.JLabel jLabel5;
697:            private javax.swing.JLabel jLabel6;
698:            private javax.swing.JLabel jLabel7;
699:            private javax.swing.JPanel jPanel2;
700:            private javax.swing.JSeparator jSeparator1;
701:            private javax.swing.JTextArea jTextArea2;
702:            private javax.swing.JCheckBox mainProject;
703:            private javax.swing.JTextField projectFolder;
704:            private javax.swing.JTextField projectLocation;
705:            private javax.swing.JTextField projectName;
706:            // End of variables declaration//GEN-END:variables
707:
708:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.