Source Code Cross Referenced for JBWizardPanel.java in  » IDE-Netbeans » project.ant » org » netbeans » modules » projectimport » jbuilder » 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 » project.ant » org.netbeans.modules.projectimport.jbuilder.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.projectimport.jbuilder.ui;
043:
044:        import java.awt.Color;
045:        import java.io.File;
046:        import java.util.Collection;
047:        import java.util.Iterator;
048:        import javax.swing.JFileChooser;
049:        import javax.swing.JTextField;
050:        import javax.swing.SwingUtilities;
051:        import javax.swing.UIManager;
052:        import javax.swing.event.DocumentEvent;
053:        import javax.swing.event.DocumentListener;
054:        import javax.swing.filechooser.FileFilter;
055:        import org.netbeans.api.project.ProjectManager;
056:        import org.netbeans.modules.projectimport.j2seimport.AbstractProject;
057:        import org.netbeans.modules.projectimport.j2seimport.ui.BasicWizardIterator;
058:        import org.netbeans.modules.projectimport.jbuilder.parsing.ProjectBuilder;
059:        import org.netbeans.modules.projectimport.jbuilder.parsing.UserLibrarySupport;
060:        import org.openide.WizardDescriptor;
061:        import org.openide.filesystems.FileUtil;
062:        import org.openide.util.HelpCtx;
063:        import org.openide.util.NbBundle;
064:        import org.openide.util.RequestProcessor;
065:
066:        /**
067:         * Represent "Selection" step(panel) in the JBuilder importer wizard.
068:         *
069:         * @author  Radek Matous
070:         */
071:        public final class JBWizardPanel extends BasicWizardIterator.Panel {
072:            private JBWizardData data = null;
073:
074:            private boolean projectFileValid = false;
075:            private Collection allPrjDefs = null;
076:            private DocumentListener documentListener;
077:
078:            /** Creates new form ProjectSelectionPanel */
079:            JBWizardPanel(WizardDescriptor wiz, JBWizardData data) {
080:                super (wiz);
081:                this .data = data;
082:                initComponents();
083:                initAccessibility();
084:            }
085:
086:            private static String getMessage(String key) {
087:                return NbBundle.getMessage(JBWizardPanel.class, key);
088:            }
089:
090:            private void initAccessibility() {
091:                prjFileBrowse.getAccessibleContext().setAccessibleDescription(
092:                        getMessage("ACS_BrowseProjectFile"));
093:                prjFileTextField.getAccessibleContext()
094:                        .setAccessibleDescription(getMessage("ACS_Project"));
095:                destDirTextField.getAccessibleContext()
096:                        .setAccessibleDescription(
097:                                getMessage("ACS_ProjectDestination"));
098:                userHomeTextField.getAccessibleContext()
099:                        .setAccessibleDescription(getMessage("ACS_UserHome"));
100:                userHomeBrowse.getAccessibleContext().setAccessibleDescription(
101:                        getMessage("ACS_BrowseUserHome"));
102:                destDirBrowse.getAccessibleContext().setAccessibleDescription(
103:                        getMessage("ACS_BrowseDestDir"));
104:                jbDirBrowse.getAccessibleContext().setAccessibleDescription(
105:                        getMessage("ACS_BrowseInstallDir"));
106:                jbDirTextField.getAccessibleContext().setAccessibleDescription(
107:                        getMessage("ACS_InstallDir"));
108:            }
109:
110:            private void addListeners() {
111:                if (documentListener == null) {
112:                    documentListener = new DocumentListener() {
113:                        public void removeUpdate(DocumentEvent e) {
114:                            insertUpdate(null);
115:                        }
116:
117:                        public void changedUpdate(DocumentEvent e) {
118:                            insertUpdate(null);
119:                        }
120:
121:                        public void insertUpdate(DocumentEvent e) {
122:                            fieldUpdate();
123:                        }
124:                    };
125:
126:                    prjFileTextField.getDocument().addDocumentListener(
127:                            documentListener);
128:                    destDirTextField.getDocument().addDocumentListener(
129:                            documentListener);
130:                    jbDirTextField.getDocument().addDocumentListener(
131:                            documentListener);
132:                    userHomeTextField.getDocument().addDocumentListener(
133:                            documentListener);
134:                }
135:            }
136:
137:            private void removeListeners() {
138:                if (documentListener != null) {
139:                    prjFileTextField.getDocument().removeDocumentListener(
140:                            documentListener);
141:                    destDirTextField.getDocument().removeDocumentListener(
142:                            documentListener);
143:                    jbDirTextField.getDocument().removeDocumentListener(
144:                            documentListener);
145:                    userHomeTextField.getDocument().removeDocumentListener(
146:                            documentListener);
147:                }
148:            }
149:
150:            public void addNotify() {
151:                super .addNotify();
152:                addListeners();
153:                fieldUpdate();
154:                Color lblBgr = UIManager.getColor("Label.background"); // NOI18N
155:                prjFileTextArea.setBackground(lblBgr);
156:                jSpanTextArea.setBackground(lblBgr);
157:            }
158:
159:            public void removeNotify() {
160:                super .removeNotify();
161:                removeListeners();
162:            }
163:
164:            private void changedInstallDir() {
165:                File libFolder = null;
166:                if (UserLibrarySupport.getInstallDirLib() == null) {
167:                    File installDir = getInstallationDir();
168:                    if (installDir.exists()) {
169:                        if (!installDir.getName().equals("lib")) { //NOI18N
170:                            libFolder = new File(installDir, "lib");//NOI18N
171:                            libFolder = (libFolder.exists()) ? libFolder : null;
172:                        }
173:                    }
174:                }
175:
176:                if (libFolder != null) {
177:                    Iterator it = Utils.getInvalidUserLibraries(allPrjDefs)
178:                            .iterator();
179:                    while (it.hasNext()) {
180:                        AbstractProject.UserLibrary uLib = (AbstractProject.UserLibrary) it
181:                                .next();
182:                        UserLibrarySupport usInstance;
183:
184:                        if (UserLibrarySupport.getInstance(uLib.getName(),
185:                                libFolder) != null) {
186:                            UserLibrarySupport.setInstallDirLib(libFolder);
187:                            if (projectFileValid) {
188:                                parseProjectFile(getProjectFile());
189:                            }
190:                            break;
191:                        }
192:                    }
193:                }
194:            }
195:
196:            private void fieldUpdate() {
197:                String errorMessage = null;
198:                boolean isUserHomeInvalid = false;
199:                File destFolder = (isEmpty(destDirTextField)) ? null
200:                        : getFile(destDirTextField);
201:                boolean isDesttDirValid = false;
202:                for (File tempFolder = destFolder; tempFolder != null; tempFolder = tempFolder
203:                        .getParentFile()) {
204:                    if (tempFolder == null || tempFolder.isFile()) {
205:                        break;
206:                    }
207:                    if (tempFolder.canWrite()) {
208:                        isDesttDirValid = true;
209:                        break;
210:                    }
211:                }
212:                if (!isDesttDirValid) {
213:                    errorMessage = NbBundle.getMessage(JBWizardPanel.class,
214:                            "MSG_NotRegularDestinationDir", destDirTextField
215:                                    .getText()); // NOI18N;
216:                }
217:                File projectFile = (isEmpty(prjFileTextField)) ? null
218:                        : getFile(prjFileTextField);
219:                boolean unresolvedReferences = Utils
220:                        .checkNotFoundUserLibraries(allPrjDefs);
221:                if (projectFile != null
222:                        && ProjectBuilder.isProjectFile(projectFile)) {
223:                    if (!projectFileValid) {
224:                        projectFileValid = true;
225:                        parseProjectFile(projectFile);
226:                        return;
227:                    } else {
228:                        if (unresolvedReferences) {
229:                            File userHomeDir = UserLibrarySupport
230:                                    .getUserHomeLib();
231:                            File f = getFile(userHomeTextField);
232:                            if (isDesttDirValid) {
233:                                if (!isEmpty(userHomeTextField) && f.exists()
234:                                        && !f.equals(userHomeDir)) {
235:                                    UserLibrarySupport.setUserHomeLib(f);
236:                                    parseProjectFile(projectFile);
237:                                    return;
238:                                } else if (isEmpty(userHomeTextField)
239:                                        || !f.exists()
240:                                        || f.getName().indexOf("jbuilder") == -1) {
241:                                    //errorMessage = NbBundle.getMessage(JBWizardPanel.class, "MSG_NotRegularUserHome", userHomeTextField.getText()); // NOI18N
242:                                    isUserHomeInvalid = true;
243:                                } else if (jbDirTextField.isEnabled()) {
244:                                    changedInstallDir();
245:                                }
246:                            }
247:                        }
248:                    }
249:                    enableAdditionalComponents(unresolvedReferences);
250:                } else {
251:                    projectFileValid = false;
252:                    enableAdditionalComponents(false);
253:                    errorMessage = NbBundle
254:                            .getMessage(JBWizardPanel.class,
255:                                    "MSG_NotRegularProject", prjFileTextField
256:                                            .getText()); // NOI18N;
257:                }
258:
259:                if (errorMessage == null) {
260:                    markValid();
261:                    if (jbDirTextField.isEnabled() || isUserHomeInvalid) {
262:                        setWarning(getMessage("LBL_Warning"));
263:                    }
264:                } else {
265:                    setError(errorMessage);
266:                }
267:            }
268:
269:            protected String getPanelName() {
270:                return NbBundle
271:                        .getMessage(JBWizardPanel.class, "CTL_FirstStep");
272:            }
273:
274:            protected void storeToDataModel() {
275:                removeListeners();
276:                fieldUpdate();
277:
278:                this .data.setDestinationDir(getFile(destDirTextField));
279:                this .data.setProjectFile(getFile(prjFileTextField));
280:                this .data.setProjectDefinition(this .allPrjDefs);
281:                this .data.setIncludeDependencies((Utils.getDependencyErrors(
282:                        allPrjDefs, getDestinationDir()) == null));
283:            }
284:
285:            protected void readFromDataModel() {
286:                addListeners();
287:                enableAdditionalComponents(false);
288:                if (data.getDestinationDir() != null) {
289:                    destDirTextField.setText(data.getDestinationDir()
290:                            .getAbsolutePath());
291:                } else {
292:                    destDirTextField.setText("");//NOPI18N
293:                }
294:                if (data.getProjectFile() != null) {
295:                    prjFileTextField.setText(data.getProjectFile()
296:                            .getAbsolutePath());
297:                } else {
298:                    prjFileTextField.setText("");//NOPI18N
299:                }
300:                File uLib = UserLibrarySupport.getUserHomeLib();
301:                if (uLib != null && uLib.exists()) {
302:                    userHomeTextField.setText(uLib.getAbsolutePath());
303:                }
304:
305:                File iLib = UserLibrarySupport.getInstallDirLib();
306:                if (iLib != null && iLib.exists()) {
307:                    if (iLib.getName().equals("lib")
308:                            && iLib.getParentFile() != null) {//NOI18N
309:                        iLib = iLib.getParentFile();
310:                    }
311:                    jbDirTextField.setText(iLib.getAbsolutePath());
312:                }
313:
314:                this .allPrjDefs = data.getProjectDefinition();
315:            }
316:
317:            protected HelpCtx getHelp() {
318:                return new HelpCtx(JBWizardPanel.class);
319:            }
320:
321:            private void parseProjectFile(final File projectFile) {
322:                RequestProcessor.getDefault().post(new Runnable() {
323:                    public void run() {
324:                        ProjectManager.mutex().writeAccess(new Runnable() {
325:                            public void run() {
326:                                Collection result = ProjectBuilder
327:                                        .buildProjectModels(projectFile);
328:                                if (result != null
329:                                        && result.size() > 0
330:                                        && projectFileValid
331:                                        && projectFile
332:                                                .equals(getFile(prjFileTextField))) {
333:                                    allPrjDefs = result;
334:                                    SwingUtilities.invokeLater(new Runnable() {
335:                                        public void run() {
336:                                            fieldUpdate();
337:                                        }
338:                                    });
339:                                }
340:                            }
341:                        });
342:                    }
343:                });
344:            }
345:
346:            private void enableAdditionalComponents(boolean enable) {
347:                jbDirTextField.setEnabled(enable);
348:                jbDirBrowse.setEnabled(enable);
349:                jbDirLabel.setEnabled(enable);
350:            }
351:
352:            public static File getFile(JTextField textField) {
353:                return new File(textField.getText().trim());
354:            }
355:
356:            public static boolean isEmpty(JTextField textField) {
357:                return textField.getText().trim().length() == 0;
358:            }
359:
360:            public File getDestinationDir() {
361:                return getFile(destDirTextField);
362:            }
363:
364:            public File getProjectFile() {
365:                return getFile(prjFileTextField);
366:            }
367:
368:            public File getInstallationDir() {
369:                return getFile(jbDirTextField);
370:            }
371:
372:            private void browseActionPerformed(JTextField field,
373:                    boolean fileHidingEnabled) {
374:                String initValue = field.getText().trim();
375:                JFileChooser chooser = new JFileChooser(initValue);
376:                FileUtil.preventFileChooserSymlinkTraversal(chooser, chooser
377:                        .getCurrentDirectory());
378:                chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
379:                chooser.setFileHidingEnabled(fileHidingEnabled);
380:                int ret = chooser.showOpenDialog(this );
381:                if (ret == JFileChooser.APPROVE_OPTION) {
382:                    field.setText(chooser.getSelectedFile().getAbsolutePath());
383:                }
384:            }
385:
386:            /** This method is called from within the constructor to
387:             * initialize the form.
388:             * WARNING: Do NOT modify this code. The content of this method is
389:             * always regenerated by the Form Editor.
390:             */
391:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
392:            private void initComponents() {
393:                java.awt.GridBagConstraints gridBagConstraints;
394:
395:                buttonGroup = new javax.swing.ButtonGroup();
396:                prjFileTextField = new javax.swing.JTextField();
397:                prjFileBrowse = new javax.swing.JButton();
398:                prjFileLabel = new javax.swing.JLabel();
399:                destDirLabel = new javax.swing.JLabel();
400:                destDirTextField = new javax.swing.JTextField();
401:                destDirBrowse = new javax.swing.JButton();
402:                prjFileTextArea = new javax.swing.JTextArea();
403:                jbDirTextField = new javax.swing.JTextField();
404:                jbDirBrowse = new javax.swing.JButton();
405:                jSpanTextArea = new javax.swing.JTextArea();
406:                jbDirLabel = new javax.swing.JLabel();
407:                userHomeLabel = new javax.swing.JLabel();
408:                userHomeTextField = new javax.swing.JTextField();
409:                userHomeBrowse = new javax.swing.JButton();
410:
411:                setLayout(new java.awt.GridBagLayout());
412:
413:                setPreferredSize(new java.awt.Dimension(500, 380));
414:                gridBagConstraints = new java.awt.GridBagConstraints();
415:                gridBagConstraints.gridx = 1;
416:                gridBagConstraints.gridy = 1;
417:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
418:                gridBagConstraints.weightx = 1.0;
419:                add(prjFileTextField, gridBagConstraints);
420:
421:                org.openide.awt.Mnemonics
422:                        .setLocalizedText(
423:                                prjFileBrowse,
424:                                java.util.ResourceBundle
425:                                        .getBundle(
426:                                                "org/netbeans/modules/projectimport/jbuilder/ui/Bundle")
427:                                        .getString("CTL_BrowseProjectFile"));
428:                prjFileBrowse
429:                        .addActionListener(new java.awt.event.ActionListener() {
430:                            public void actionPerformed(
431:                                    java.awt.event.ActionEvent evt) {
432:                                prjFileBrowseActionPerformed(evt);
433:                            }
434:                        });
435:
436:                gridBagConstraints = new java.awt.GridBagConstraints();
437:                gridBagConstraints.gridx = 2;
438:                gridBagConstraints.gridy = 1;
439:                gridBagConstraints.insets = new java.awt.Insets(0, 11, 0, 10);
440:                add(prjFileBrowse, gridBagConstraints);
441:
442:                prjFileLabel.setLabelFor(prjFileTextField);
443:                org.openide.awt.Mnemonics.setLocalizedText(prjFileLabel,
444:                        org.openide.util.NbBundle.getMessage(
445:                                JBWizardPanel.class, "LBL_Project"));
446:                gridBagConstraints = new java.awt.GridBagConstraints();
447:                gridBagConstraints.gridx = 0;
448:                gridBagConstraints.gridy = 1;
449:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
450:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
451:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
452:                add(prjFileLabel, gridBagConstraints);
453:
454:                destDirLabel.setLabelFor(destDirTextField);
455:                org.openide.awt.Mnemonics.setLocalizedText(destDirLabel,
456:                        org.openide.util.NbBundle.getMessage(
457:                                JBWizardPanel.class, "LBL_ProjectDestination"));
458:                gridBagConstraints = new java.awt.GridBagConstraints();
459:                gridBagConstraints.gridx = 0;
460:                gridBagConstraints.gridy = 2;
461:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
462:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
463:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12);
464:                add(destDirLabel, gridBagConstraints);
465:
466:                gridBagConstraints = new java.awt.GridBagConstraints();
467:                gridBagConstraints.gridx = 1;
468:                gridBagConstraints.gridy = 2;
469:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
470:                gridBagConstraints.weightx = 1.0;
471:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
472:                add(destDirTextField, gridBagConstraints);
473:
474:                org.openide.awt.Mnemonics
475:                        .setLocalizedText(
476:                                destDirBrowse,
477:                                java.util.ResourceBundle
478:                                        .getBundle(
479:                                                "org/netbeans/modules/projectimport/jbuilder/ui/Bundle")
480:                                        .getString("CTL_BrowseDestDir"));
481:                destDirBrowse
482:                        .addActionListener(new java.awt.event.ActionListener() {
483:                            public void actionPerformed(
484:                                    java.awt.event.ActionEvent evt) {
485:                                destDirBrowseActionPerformed(evt);
486:                            }
487:                        });
488:
489:                gridBagConstraints = new java.awt.GridBagConstraints();
490:                gridBagConstraints.gridx = 2;
491:                gridBagConstraints.gridy = 2;
492:                gridBagConstraints.insets = new java.awt.Insets(5, 11, 0, 10);
493:                add(destDirBrowse, gridBagConstraints);
494:
495:                prjFileTextArea.setEditable(false);
496:                prjFileTextArea.setLineWrap(true);
497:                prjFileTextArea
498:                        .setText(java.util.ResourceBundle
499:                                .getBundle(
500:                                        "org/netbeans/modules/projectimport/jbuilder/ui/Bundle")
501:                                .getString("LBL_SpecifyProjectDescription"));
502:                prjFileTextArea.setWrapStyleWord(true);
503:                gridBagConstraints = new java.awt.GridBagConstraints();
504:                gridBagConstraints.gridx = 0;
505:                gridBagConstraints.gridy = 0;
506:                gridBagConstraints.gridwidth = 3;
507:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
508:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 24, 0);
509:                add(prjFileTextArea, gridBagConstraints);
510:
511:                gridBagConstraints = new java.awt.GridBagConstraints();
512:                gridBagConstraints.gridx = 1;
513:                gridBagConstraints.gridy = 4;
514:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
515:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
516:                gridBagConstraints.weightx = 1.0;
517:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
518:                add(jbDirTextField, gridBagConstraints);
519:
520:                org.openide.awt.Mnemonics
521:                        .setLocalizedText(
522:                                jbDirBrowse,
523:                                java.util.ResourceBundle
524:                                        .getBundle(
525:                                                "org/netbeans/modules/projectimport/jbuilder/ui/Bundle")
526:                                        .getString("CTL_BrowseInstallDir"));
527:                jbDirBrowse
528:                        .addActionListener(new java.awt.event.ActionListener() {
529:                            public void actionPerformed(
530:                                    java.awt.event.ActionEvent evt) {
531:                                jbDirBrowseActionPerformed(evt);
532:                            }
533:                        });
534:
535:                gridBagConstraints = new java.awt.GridBagConstraints();
536:                gridBagConstraints.gridx = 2;
537:                gridBagConstraints.gridy = 4;
538:                gridBagConstraints.insets = new java.awt.Insets(5, 11, 0, 10);
539:                add(jbDirBrowse, gridBagConstraints);
540:
541:                jSpanTextArea.setEditable(false);
542:                jSpanTextArea.setLineWrap(true);
543:                jSpanTextArea.setWrapStyleWord(true);
544:                gridBagConstraints = new java.awt.GridBagConstraints();
545:                gridBagConstraints.gridx = 0;
546:                gridBagConstraints.gridy = 5;
547:                gridBagConstraints.gridwidth = 3;
548:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
549:                gridBagConstraints.weighty = 1.0;
550:                gridBagConstraints.insets = new java.awt.Insets(24, 0, 10, 0);
551:                add(jSpanTextArea, gridBagConstraints);
552:
553:                jbDirLabel.setLabelFor(jbDirTextField);
554:                org.openide.awt.Mnemonics
555:                        .setLocalizedText(
556:                                jbDirLabel,
557:                                java.util.ResourceBundle
558:                                        .getBundle(
559:                                                "org/netbeans/modules/projectimport/jbuilder/ui/Bundle")
560:                                        .getString("LBL_InstallDir"));
561:                gridBagConstraints = new java.awt.GridBagConstraints();
562:                gridBagConstraints.gridx = 0;
563:                gridBagConstraints.gridy = 4;
564:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
565:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
566:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12);
567:                add(jbDirLabel, gridBagConstraints);
568:
569:                userHomeLabel.setLabelFor(userHomeTextField);
570:                org.openide.awt.Mnemonics.setLocalizedText(userHomeLabel,
571:                        org.openide.util.NbBundle.getMessage(
572:                                JBWizardPanel.class, "LBL_UserHome"));
573:                gridBagConstraints = new java.awt.GridBagConstraints();
574:                gridBagConstraints.gridx = 0;
575:                gridBagConstraints.gridy = 3;
576:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
577:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
578:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 12);
579:                add(userHomeLabel, gridBagConstraints);
580:
581:                gridBagConstraints = new java.awt.GridBagConstraints();
582:                gridBagConstraints.gridx = 1;
583:                gridBagConstraints.gridy = 3;
584:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
585:                gridBagConstraints.weightx = 1.0;
586:                gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
587:                add(userHomeTextField, gridBagConstraints);
588:
589:                org.openide.awt.Mnemonics
590:                        .setLocalizedText(
591:                                userHomeBrowse,
592:                                java.util.ResourceBundle
593:                                        .getBundle(
594:                                                "org/netbeans/modules/projectimport/jbuilder/ui/Bundle")
595:                                        .getString("CTL_BrowseUserHome"));
596:                userHomeBrowse
597:                        .addActionListener(new java.awt.event.ActionListener() {
598:                            public void actionPerformed(
599:                                    java.awt.event.ActionEvent evt) {
600:                                userHomeBrowseActionPerformed(evt);
601:                            }
602:                        });
603:
604:                gridBagConstraints = new java.awt.GridBagConstraints();
605:                gridBagConstraints.gridx = 2;
606:                gridBagConstraints.gridy = 3;
607:                gridBagConstraints.insets = new java.awt.Insets(5, 11, 0, 10);
608:                add(userHomeBrowse, gridBagConstraints);
609:
610:            }// </editor-fold>//GEN-END:initComponents
611:
612:            private void userHomeBrowseActionPerformed(
613:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userHomeBrowseActionPerformed
614:                browseActionPerformed(userHomeTextField, false);
615:            }//GEN-LAST:event_userHomeBrowseActionPerformed
616:
617:            private void jbDirBrowseActionPerformed(
618:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbDirBrowseActionPerformed
619:                browseActionPerformed(jbDirTextField, true);
620:            }//GEN-LAST:event_jbDirBrowseActionPerformed
621:
622:            private void destDirBrowseActionPerformed(
623:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_destDirBrowseActionPerformed
624:                browseActionPerformed(destDirTextField, true);
625:            }//GEN-LAST:event_destDirBrowseActionPerformed
626:
627:            private void prjFileBrowseActionPerformed(
628:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prjFileBrowseActionPerformed
629:                String initValue = prjFileTextField.getText().trim();
630:                JFileChooser chooser = new JFileChooser(initValue);
631:                chooser.setFileFilter(new FileFilter() {
632:                    public boolean accept(File f) {
633:                        return f.isDirectory()
634:                                || ProjectBuilder.isProjectFile(f);
635:                    }
636:
637:                    public String getDescription() {
638:                        return NbBundle.getMessage(JBWizardPanel.class,
639:                                "ProjectFileDescription"); // NOI18N
640:                    }
641:
642:                });
643:                FileUtil.preventFileChooserSymlinkTraversal(chooser, chooser
644:                        .getCurrentDirectory());
645:                chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
646:                int ret = chooser.showOpenDialog(this );
647:                if (ret == JFileChooser.APPROVE_OPTION) {
648:                    prjFileTextField.setText(chooser.getSelectedFile()
649:                            .getAbsolutePath());
650:                }
651:            }//GEN-LAST:event_prjFileBrowseActionPerformed
652:
653:            // Variables declaration - do not modify//GEN-BEGIN:variables
654:            private javax.swing.ButtonGroup buttonGroup;
655:            private javax.swing.JButton destDirBrowse;
656:            private javax.swing.JLabel destDirLabel;
657:            private javax.swing.JTextField destDirTextField;
658:            private javax.swing.JTextArea jSpanTextArea;
659:            private javax.swing.JButton jbDirBrowse;
660:            private javax.swing.JLabel jbDirLabel;
661:            private javax.swing.JTextField jbDirTextField;
662:            private javax.swing.JButton prjFileBrowse;
663:            private javax.swing.JLabel prjFileLabel;
664:            private javax.swing.JTextArea prjFileTextArea;
665:            private javax.swing.JTextField prjFileTextField;
666:            private javax.swing.JButton userHomeBrowse;
667:            private javax.swing.JLabel userHomeLabel;
668:            private javax.swing.JTextField userHomeTextField;
669:            // End of variables declaration//GEN-END:variables
670:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.