Source Code Cross Referenced for ReverseEngineerPanel.java in  » IDE-Netbeans » uml » org » netbeans » modules » uml » integration » netbeans » actions » 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 » uml » org.netbeans.modules.uml.integration.netbeans.actions.ui 
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.uml.integration.netbeans.actions.ui;
0043:
0044:        import java.awt.Component;
0045:        import java.awt.event.ActionEvent;
0046:        import java.awt.event.ActionListener;
0047:        import java.io.File;
0048:        import java.io.IOException;
0049:        import java.text.MessageFormat;
0050:        import java.util.ArrayList;
0051:        import javax.swing.DefaultComboBoxModel;
0052:        import javax.swing.JFileChooser;
0053:        import javax.swing.JLabel;
0054:        import javax.swing.JList;
0055:        import javax.swing.JTable;
0056:        import javax.swing.ListCellRenderer;
0057:        import javax.swing.event.ChangeEvent;
0058:        import javax.swing.event.ChangeListener;
0059:        import javax.swing.event.DocumentEvent;
0060:        import javax.swing.event.DocumentListener;
0061:        import javax.swing.event.TableModelEvent;
0062:        import javax.swing.event.TableModelListener;
0063:        import javax.swing.text.Document;
0064:        import org.netbeans.modules.uml.core.support.BundleSupport;
0065:
0066:        import org.openide.NotifyDescriptor;
0067:        import org.openide.DialogDescriptor;
0068:        import org.openide.filesystems.FileUtil;
0069:
0070:        import org.netbeans.api.project.Project;
0071:        import org.netbeans.api.project.ProjectInformation;
0072:        import org.netbeans.api.project.ProjectUtils;
0073:
0074:        import org.netbeans.modules.uml.project.ProjectUtil;
0075:        import org.netbeans.modules.uml.project.ui.common.JavaSourceRootsUI;
0076:        import org.netbeans.modules.uml.project.ui.common.JavaSourceRootsUI.JavaSourceRootsModel;
0077:        import org.openide.util.NbBundle;
0078:
0079:        /**
0080:         *
0081:         * @author  Craig Conover, craig.conover@sun.com
0082:         */
0083:        public class ReverseEngineerPanel extends javax.swing.JPanel implements 
0084:                ActionListener, DocumentListener, ChangeListener,
0085:                TableModelListener {
0086:
0087:            /**
0088:             *  Creates a new ReverseEngineerPanel based on 
0089:             *  a selected Java project node
0090:             */
0091:            public ReverseEngineerPanel(Project sourceProject) {
0092:                this (sourceProject, null);
0093:            }
0094:
0095:            public ReverseEngineerPanel(Project sourceProject,
0096:                    Project targetProject) {
0097:                javaProject = sourceProject;
0098:                umlProject = targetProject;
0099:                showSourceRoots = true;
0100:
0101:                initComponents();
0102:                initSourceRootsTable();
0103:                initListeners();
0104:                initValues();
0105:                initJavaProjectValues();
0106:            }
0107:
0108:            public ReverseEngineerPanel(Project sourceProject,
0109:                    ArrayList<String> sourceNodes, Project targetProject) {
0110:                javaProject = sourceProject;
0111:                selectedNodes = sourceNodes;
0112:                umlProject = targetProject;
0113:                showSourceRoots = false;
0114:
0115:                initComponents();
0116:                // source roots selection is N/A for non-project node selection
0117:                sourceRootsPanel.setVisible(false);
0118:                initSourceRootsTable();
0119:                initListeners();
0120:                initValues();
0121:                initJavaProjectValues();
0122:                initJavaFilesValues();
0123:            }
0124:
0125:            /** This method is called from within the constructor to
0126:             * initialize the form.
0127:             * WARNING: Do NOT modify this code. The content of this method is
0128:             * always regenerated by the Form Editor.
0129:             */
0130:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0131:            private void initComponents() {
0132:                projectTypeButtonGroup = new javax.swing.ButtonGroup();
0133:                selNodesPanel = new javax.swing.JPanel();
0134:                selectedNodesLabel = new javax.swing.JLabel();
0135:                selectedNodesText = new javax.swing.JTextField();
0136:                sourceRootsPanel = new javax.swing.JPanel();
0137:                sourceFoldersLabel = new javax.swing.JLabel();
0138:                sourceRootsScrollPane = new javax.swing.JScrollPane();
0139:                sourceRoots = new javax.swing.JTable();
0140:                existingProjectPanel = new javax.swing.JPanel();
0141:                existingProjectRadio = new javax.swing.JRadioButton();
0142:                targetProjectLabel = new javax.swing.JLabel();
0143:                targetProjectCombo = new javax.swing.JComboBox();
0144:                newProjectPanel = new javax.swing.JPanel();
0145:                newProjectRadio = new javax.swing.JRadioButton();
0146:                projectNameLabel = new javax.swing.JLabel();
0147:                projectNameText = new javax.swing.JTextField();
0148:                projectLocationLabel = new javax.swing.JLabel();
0149:                projectLocationText = new javax.swing.JTextField();
0150:                projectFolderLabel = new javax.swing.JLabel();
0151:                projectFolderText = new javax.swing.JTextField();
0152:                browseButton = new javax.swing.JButton();
0153:                statusLabel = new javax.swing.JLabel();
0154:
0155:                selectedNodesLabel.setLabelFor(selectedNodesText);
0156:                org.openide.awt.Mnemonics.setLocalizedText(selectedNodesLabel,
0157:                        org.openide.util.NbBundle
0158:                                .getMessage(ReverseEngineerPanel.class,
0159:                                        "LBL_SelectedNodes")); // NOI18N
0160:                selectedNodesLabel.getAccessibleContext().setAccessibleName("");
0161:                selectedNodesLabel.getAccessibleContext()
0162:                        .setAccessibleDescription("");
0163:
0164:                selectedNodesText.setEditable(false);
0165:                selectedNodesText.getAccessibleContext().setAccessibleName("");
0166:                selectedNodesText.getAccessibleContext()
0167:                        .setAccessibleDescription("");
0168:
0169:                org.jdesktop.layout.GroupLayout selNodesPanelLayout = new org.jdesktop.layout.GroupLayout(
0170:                        selNodesPanel);
0171:                selNodesPanel.setLayout(selNodesPanelLayout);
0172:                selNodesPanelLayout
0173:                        .setHorizontalGroup(selNodesPanelLayout
0174:                                .createParallelGroup(
0175:                                        org.jdesktop.layout.GroupLayout.LEADING)
0176:                                .add(
0177:                                        selNodesPanelLayout
0178:                                                .createSequentialGroup()
0179:                                                .addContainerGap()
0180:                                                .add(selectedNodesLabel)
0181:                                                .addPreferredGap(
0182:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0183:                                                .add(
0184:                                                        selectedNodesText,
0185:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0186:                                                        481, Short.MAX_VALUE)
0187:                                                .addContainerGap()));
0188:                selNodesPanelLayout
0189:                        .setVerticalGroup(selNodesPanelLayout
0190:                                .createParallelGroup(
0191:                                        org.jdesktop.layout.GroupLayout.LEADING)
0192:                                .add(
0193:                                        selNodesPanelLayout
0194:                                                .createSequentialGroup()
0195:                                                .addContainerGap()
0196:                                                .add(
0197:                                                        selNodesPanelLayout
0198:                                                                .createParallelGroup(
0199:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0200:                                                                .add(
0201:                                                                        selectedNodesLabel)
0202:                                                                .add(
0203:                                                                        selectedNodesText,
0204:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0205:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0206:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0207:                                                .addContainerGap(
0208:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0209:                                                        Short.MAX_VALUE)));
0210:
0211:                sourceFoldersLabel.setLabelFor(sourceRoots);
0212:                org.openide.awt.Mnemonics.setLocalizedText(sourceFoldersLabel,
0213:                        org.openide.util.NbBundle.getMessage(
0214:                                ReverseEngineerPanel.class,
0215:                                "LBL_JavaProjectSourcePackageFolders")); // NOI18N
0216:                sourceFoldersLabel.getAccessibleContext().setAccessibleName("");
0217:                sourceFoldersLabel
0218:                        .getAccessibleContext()
0219:                        .setAccessibleDescription(
0220:                                org.openide.util.NbBundle.getMessage(
0221:                                        ReverseEngineerPanel.class,
0222:                                        "ACSD_JavaProjectSourcePackageFolders")); // NOI18N
0223:
0224:                sourceRoots.setModel(new javax.swing.table.DefaultTableModel(
0225:                        new Object[][] { { new Boolean(true), null, null },
0226:                                { new Boolean(true), null, null } },
0227:                        new String[] { "Reverse Engineer", "Package Folder",
0228:                                "Package Folder Label" }) {
0229:                    Class[] types = new Class[] { java.lang.Boolean.class,
0230:                            java.lang.Object.class, java.lang.String.class };
0231:                    boolean[] canEdit = new boolean[] { true, false, false };
0232:
0233:                    public Class getColumnClass(int columnIndex) {
0234:                        return types[columnIndex];
0235:                    }
0236:
0237:                    public boolean isCellEditable(int rowIndex, int columnIndex) {
0238:                        return canEdit[columnIndex];
0239:                    }
0240:                });
0241:                sourceRootsScrollPane.setViewportView(sourceRoots);
0242:                sourceRoots.getAccessibleContext().setAccessibleName("");
0243:                sourceRoots.getAccessibleContext().setAccessibleDescription("");
0244:
0245:                org.jdesktop.layout.GroupLayout sourceRootsPanelLayout = new org.jdesktop.layout.GroupLayout(
0246:                        sourceRootsPanel);
0247:                sourceRootsPanel.setLayout(sourceRootsPanelLayout);
0248:                sourceRootsPanelLayout
0249:                        .setHorizontalGroup(sourceRootsPanelLayout
0250:                                .createParallelGroup(
0251:                                        org.jdesktop.layout.GroupLayout.LEADING)
0252:                                .add(
0253:                                        sourceRootsPanelLayout
0254:                                                .createSequentialGroup()
0255:                                                .addContainerGap()
0256:                                                .add(
0257:                                                        sourceRootsPanelLayout
0258:                                                                .createParallelGroup(
0259:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0260:                                                                .add(
0261:                                                                        sourceRootsScrollPane,
0262:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0263:                                                                        563,
0264:                                                                        Short.MAX_VALUE)
0265:                                                                .add(
0266:                                                                        sourceFoldersLabel))
0267:                                                .addContainerGap()));
0268:                sourceRootsPanelLayout
0269:                        .setVerticalGroup(sourceRootsPanelLayout
0270:                                .createParallelGroup(
0271:                                        org.jdesktop.layout.GroupLayout.LEADING)
0272:                                .add(
0273:                                        sourceRootsPanelLayout
0274:                                                .createSequentialGroup()
0275:                                                .add(sourceFoldersLabel)
0276:                                                .addPreferredGap(
0277:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0278:                                                .add(
0279:                                                        sourceRootsScrollPane,
0280:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0281:                                                        98, Short.MAX_VALUE)
0282:                                                .addContainerGap()));
0283:
0284:                projectTypeButtonGroup.add(existingProjectRadio);
0285:                existingProjectRadio.setSelected(true);
0286:                org.openide.awt.Mnemonics.setLocalizedText(
0287:                        existingProjectRadio, org.openide.util.NbBundle
0288:                                .getMessage(ReverseEngineerPanel.class,
0289:                                        "LBL_UseExistingUMLProject")); // NOI18N
0290:                existingProjectRadio.setBorder(javax.swing.BorderFactory
0291:                        .createEmptyBorder(0, 0, 0, 0));
0292:                existingProjectRadio.setMargin(new java.awt.Insets(0, 0, 0, 0));
0293:                existingProjectRadio
0294:                        .addChangeListener(new javax.swing.event.ChangeListener() {
0295:                            public void stateChanged(
0296:                                    javax.swing.event.ChangeEvent evt) {
0297:                                existingProjectRadioStateChanged(evt);
0298:                            }
0299:                        });
0300:
0301:                existingProjectRadio.getAccessibleContext().setAccessibleName(
0302:                        "");
0303:                existingProjectRadio.getAccessibleContext()
0304:                        .setAccessibleDescription(
0305:                                org.openide.util.NbBundle.getMessage(
0306:                                        ReverseEngineerPanel.class,
0307:                                        "ACSD_UseExistingUMLProject")); // NOI18N
0308:
0309:                targetProjectLabel.setLabelFor(targetProjectCombo);
0310:                org.openide.awt.Mnemonics.setLocalizedText(targetProjectLabel,
0311:                        org.openide.util.NbBundle
0312:                                .getMessage(ReverseEngineerPanel.class,
0313:                                        "LBL_TargetProject")); // NOI18N
0314:                targetProjectLabel.getAccessibleContext().setAccessibleName("");
0315:                targetProjectLabel.getAccessibleContext()
0316:                        .setAccessibleDescription(
0317:                                org.openide.util.NbBundle.getMessage(
0318:                                        ReverseEngineerPanel.class,
0319:                                        "ACSD_TargetProject")); // NOI18N
0320:
0321:                targetProjectCombo
0322:                        .addItemListener(new java.awt.event.ItemListener() {
0323:                            public void itemStateChanged(
0324:                                    java.awt.event.ItemEvent evt) {
0325:                                targetProjectComboItemStateChanged(evt);
0326:                            }
0327:                        });
0328:
0329:                targetProjectCombo.getAccessibleContext().setAccessibleName("");
0330:                targetProjectCombo.getAccessibleContext()
0331:                        .setAccessibleDescription(
0332:                                org.openide.util.NbBundle.getMessage(
0333:                                        ReverseEngineerPanel.class,
0334:                                        "ACSD_TargetProject")); // NOI18N
0335:
0336:                org.jdesktop.layout.GroupLayout existingProjectPanelLayout = new org.jdesktop.layout.GroupLayout(
0337:                        existingProjectPanel);
0338:                existingProjectPanel.setLayout(existingProjectPanelLayout);
0339:                existingProjectPanelLayout
0340:                        .setHorizontalGroup(existingProjectPanelLayout
0341:                                .createParallelGroup(
0342:                                        org.jdesktop.layout.GroupLayout.LEADING)
0343:                                .add(
0344:                                        existingProjectPanelLayout
0345:                                                .createSequentialGroup()
0346:                                                .add(
0347:                                                        existingProjectPanelLayout
0348:                                                                .createParallelGroup(
0349:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0350:                                                                .add(
0351:                                                                        existingProjectPanelLayout
0352:                                                                                .createSequentialGroup()
0353:                                                                                .add(
0354:                                                                                        27,
0355:                                                                                        27,
0356:                                                                                        27)
0357:                                                                                .add(
0358:                                                                                        targetProjectLabel)
0359:                                                                                .addPreferredGap(
0360:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0361:                                                                                .add(
0362:                                                                                        targetProjectCombo,
0363:                                                                                        0,
0364:                                                                                        469,
0365:                                                                                        Short.MAX_VALUE))
0366:                                                                .add(
0367:                                                                        existingProjectPanelLayout
0368:                                                                                .createSequentialGroup()
0369:                                                                                .addContainerGap()
0370:                                                                                .add(
0371:                                                                                        existingProjectRadio)))
0372:                                                .addContainerGap()));
0373:                existingProjectPanelLayout
0374:                        .setVerticalGroup(existingProjectPanelLayout
0375:                                .createParallelGroup(
0376:                                        org.jdesktop.layout.GroupLayout.LEADING)
0377:                                .add(
0378:                                        existingProjectPanelLayout
0379:                                                .createSequentialGroup()
0380:                                                .add(existingProjectRadio)
0381:                                                .addPreferredGap(
0382:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0383:                                                .add(
0384:                                                        existingProjectPanelLayout
0385:                                                                .createParallelGroup(
0386:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0387:                                                                .add(
0388:                                                                        targetProjectLabel)
0389:                                                                .add(
0390:                                                                        targetProjectCombo,
0391:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0392:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0393:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0394:                                                .addContainerGap(
0395:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0396:                                                        Short.MAX_VALUE)));
0397:
0398:                projectTypeButtonGroup.add(newProjectRadio);
0399:                org.openide.awt.Mnemonics.setLocalizedText(newProjectRadio,
0400:                        org.openide.util.NbBundle.getMessage(
0401:                                ReverseEngineerPanel.class,
0402:                                "LBL_CreateNewUMLProject")); // NOI18N
0403:                newProjectRadio.setBorder(javax.swing.BorderFactory
0404:                        .createEmptyBorder(0, 0, 0, 0));
0405:                newProjectRadio.setMargin(new java.awt.Insets(0, 0, 0, 0));
0406:                newProjectRadio
0407:                        .addChangeListener(new javax.swing.event.ChangeListener() {
0408:                            public void stateChanged(
0409:                                    javax.swing.event.ChangeEvent evt) {
0410:                                newProjectRadioStateChanged(evt);
0411:                            }
0412:                        });
0413:
0414:                newProjectRadio.getAccessibleContext().setAccessibleName("");
0415:                newProjectRadio.getAccessibleContext()
0416:                        .setAccessibleDescription(
0417:                                org.openide.util.NbBundle.getMessage(
0418:                                        ReverseEngineerPanel.class,
0419:                                        "ACSD_CreateNewUMLProject")); // NOI18N
0420:
0421:                projectNameLabel.setLabelFor(projectNameText);
0422:                org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel,
0423:                        org.openide.util.NbBundle.getMessage(
0424:                                ReverseEngineerPanel.class, "LBL_ProjectName")); // NOI18N
0425:                projectNameLabel.getAccessibleContext().setAccessibleName("");
0426:                projectNameLabel.getAccessibleContext()
0427:                        .setAccessibleDescription(
0428:                                org.openide.util.NbBundle.getMessage(
0429:                                        ReverseEngineerPanel.class,
0430:                                        "ACSD_ProjectName")); // NOI18N
0431:
0432:                projectNameText.getAccessibleContext().setAccessibleName("");
0433:                projectNameText.getAccessibleContext()
0434:                        .setAccessibleDescription("");
0435:
0436:                projectLocationLabel.setLabelFor(projectLocationText);
0437:                org.openide.awt.Mnemonics.setLocalizedText(
0438:                        projectLocationLabel, org.openide.util.NbBundle
0439:                                .getMessage(ReverseEngineerPanel.class,
0440:                                        "LBL_ProjectLocation")); // NOI18N
0441:                projectLocationLabel.getAccessibleContext()
0442:                        .setAccessibleDescription(
0443:                                org.openide.util.NbBundle.getMessage(
0444:                                        ReverseEngineerPanel.class,
0445:                                        "ACSD_ProjectLocation")); // NOI18N
0446:
0447:                projectLocationText.getAccessibleContext()
0448:                        .setAccessibleName("");
0449:                projectLocationText.getAccessibleContext()
0450:                        .setAccessibleDescription("");
0451:
0452:                projectFolderLabel.setLabelFor(projectFolderText);
0453:                org.openide.awt.Mnemonics.setLocalizedText(projectFolderLabel,
0454:                        org.openide.util.NbBundle
0455:                                .getMessage(ReverseEngineerPanel.class,
0456:                                        "LBL_ProjectFolder")); // NOI18N
0457:                projectFolderLabel.getAccessibleContext().setAccessibleName(
0458:                        null);
0459:                projectFolderLabel.getAccessibleContext()
0460:                        .setAccessibleDescription(
0461:                                org.openide.util.NbBundle.getMessage(
0462:                                        ReverseEngineerPanel.class,
0463:                                        "ASCD_ProjectFolder")); // NOI18N
0464:
0465:                projectFolderText.setEnabled(false);
0466:                projectFolderText.getAccessibleContext().setAccessibleName("");
0467:                projectFolderText.getAccessibleContext()
0468:                        .setAccessibleDescription("");
0469:
0470:                org.openide.awt.Mnemonics
0471:                        .setLocalizedText(browseButton,
0472:                                org.openide.util.NbBundle.getMessage(
0473:                                        ReverseEngineerPanel.class,
0474:                                        "LBL_BrowseButton")); // NOI18N
0475:                browseButton
0476:                        .addActionListener(new java.awt.event.ActionListener() {
0477:                            public void actionPerformed(
0478:                                    java.awt.event.ActionEvent evt) {
0479:                                browseButtonActionPerformed(evt);
0480:                            }
0481:                        });
0482:
0483:                browseButton.getAccessibleContext().setAccessibleName("");
0484:                browseButton.getAccessibleContext().setAccessibleDescription(
0485:                        org.openide.util.NbBundle
0486:                                .getMessage(ReverseEngineerPanel.class,
0487:                                        "ACSD_BrowseButton")); // NOI18N
0488:
0489:                org.jdesktop.layout.GroupLayout newProjectPanelLayout = new org.jdesktop.layout.GroupLayout(
0490:                        newProjectPanel);
0491:                newProjectPanel.setLayout(newProjectPanelLayout);
0492:                newProjectPanelLayout
0493:                        .setHorizontalGroup(newProjectPanelLayout
0494:                                .createParallelGroup(
0495:                                        org.jdesktop.layout.GroupLayout.LEADING)
0496:                                .add(
0497:                                        newProjectPanelLayout
0498:                                                .createSequentialGroup()
0499:                                                .add(
0500:                                                        newProjectPanelLayout
0501:                                                                .createParallelGroup(
0502:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0503:                                                                .add(
0504:                                                                        newProjectPanelLayout
0505:                                                                                .createSequentialGroup()
0506:                                                                                .addContainerGap()
0507:                                                                                .add(
0508:                                                                                        newProjectRadio))
0509:                                                                .add(
0510:                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
0511:                                                                        newProjectPanelLayout
0512:                                                                                .createSequentialGroup()
0513:                                                                                .add(
0514:                                                                                        27,
0515:                                                                                        27,
0516:                                                                                        27)
0517:                                                                                .add(
0518:                                                                                        newProjectPanelLayout
0519:                                                                                                .createParallelGroup(
0520:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0521:                                                                                                .add(
0522:                                                                                                        projectLocationLabel)
0523:                                                                                                .add(
0524:                                                                                                        projectNameLabel)
0525:                                                                                                .add(
0526:                                                                                                        projectFolderLabel))
0527:                                                                                .addPreferredGap(
0528:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0529:                                                                                .add(
0530:                                                                                        newProjectPanelLayout
0531:                                                                                                .createParallelGroup(
0532:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0533:                                                                                                .add(
0534:                                                                                                        projectFolderText,
0535:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0536:                                                                                                        376,
0537:                                                                                                        Short.MAX_VALUE)
0538:                                                                                                .add(
0539:                                                                                                        projectNameText,
0540:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0541:                                                                                                        376,
0542:                                                                                                        Short.MAX_VALUE)
0543:                                                                                                .add(
0544:                                                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
0545:                                                                                                        projectLocationText,
0546:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0547:                                                                                                        376,
0548:                                                                                                        Short.MAX_VALUE))
0549:                                                                                .addPreferredGap(
0550:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0551:                                                                                .add(
0552:                                                                                        browseButton)))
0553:                                                .addContainerGap()));
0554:                newProjectPanelLayout
0555:                        .setVerticalGroup(newProjectPanelLayout
0556:                                .createParallelGroup(
0557:                                        org.jdesktop.layout.GroupLayout.LEADING)
0558:                                .add(
0559:                                        newProjectPanelLayout
0560:                                                .createSequentialGroup()
0561:                                                .add(newProjectRadio)
0562:                                                .addPreferredGap(
0563:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0564:                                                .add(
0565:                                                        newProjectPanelLayout
0566:                                                                .createParallelGroup(
0567:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0568:                                                                .add(
0569:                                                                        projectNameLabel)
0570:                                                                .add(
0571:                                                                        projectNameText,
0572:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0573:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0574:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0575:                                                .addPreferredGap(
0576:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0577:                                                .add(
0578:                                                        newProjectPanelLayout
0579:                                                                .createParallelGroup(
0580:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0581:                                                                .add(
0582:                                                                        projectLocationLabel)
0583:                                                                .add(
0584:                                                                        browseButton)
0585:                                                                .add(
0586:                                                                        projectLocationText,
0587:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0588:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0589:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0590:                                                .addPreferredGap(
0591:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0592:                                                .add(
0593:                                                        newProjectPanelLayout
0594:                                                                .createParallelGroup(
0595:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0596:                                                                .add(
0597:                                                                        projectFolderLabel)
0598:                                                                .add(
0599:                                                                        projectFolderText,
0600:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0601:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0602:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0603:                                                .addContainerGap(11,
0604:                                                        Short.MAX_VALUE)));
0605:
0606:                statusLabel.setForeground(new java.awt.Color(0, 0, 255));
0607:                statusLabel.setText("<field validation status message>");
0608:                statusLabel.getAccessibleContext().setAccessibleName(
0609:                        "Dialog field validation message");
0610:                statusLabel
0611:                        .getAccessibleContext()
0612:                        .setAccessibleDescription(
0613:                                "Reports the validation messages for all of the input fields of this dialog.");
0614:
0615:                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
0616:                        this );
0617:                this .setLayout(layout);
0618:                layout.setHorizontalGroup(layout.createParallelGroup(
0619:                        org.jdesktop.layout.GroupLayout.LEADING).add(
0620:                        selNodesPanel,
0621:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0622:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0623:                        Short.MAX_VALUE).add(sourceRootsPanel,
0624:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0625:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0626:                        Short.MAX_VALUE).add(
0627:                        layout.createSequentialGroup().addContainerGap().add(
0628:                                statusLabel,
0629:                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0630:                                563, Short.MAX_VALUE).addContainerGap()).add(
0631:                        newProjectPanel,
0632:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0633:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0634:                        Short.MAX_VALUE).add(existingProjectPanel,
0635:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0636:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0637:                        Short.MAX_VALUE));
0638:                layout
0639:                        .setVerticalGroup(layout
0640:                                .createParallelGroup(
0641:                                        org.jdesktop.layout.GroupLayout.LEADING)
0642:                                .add(
0643:                                        layout
0644:                                                .createSequentialGroup()
0645:                                                .add(
0646:                                                        selNodesPanel,
0647:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0648:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0649:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
0650:                                                .addPreferredGap(
0651:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0652:                                                .add(
0653:                                                        sourceRootsPanel,
0654:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0655:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0656:                                                        Short.MAX_VALUE)
0657:                                                .addPreferredGap(
0658:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0659:                                                .add(
0660:                                                        existingProjectPanel,
0661:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0662:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0663:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
0664:                                                .addPreferredGap(
0665:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0666:                                                .add(
0667:                                                        newProjectPanel,
0668:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0669:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0670:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
0671:                                                .addPreferredGap(
0672:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0673:                                                .add(statusLabel)));
0674:            }// </editor-fold>//GEN-END:initComponents
0675:
0676:            private void targetProjectComboItemStateChanged(
0677:                    java.awt.event.ItemEvent evt)//GEN-FIRST:event_targetProjectComboItemStateChanged
0678:            {//GEN-HEADEREND:event_targetProjectComboItemStateChanged
0679:                umlProject = (Project) targetProjectCombo.getSelectedItem();
0680:            }//GEN-LAST:event_targetProjectComboItemStateChanged
0681:
0682:            private void newProjectRadioStateChanged(
0683:                    javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_newProjectRadioStateChanged
0684:            {//GEN-HEADEREND:event_newProjectRadioStateChanged
0685:                // updateValidStatus();
0686:            }//GEN-LAST:event_newProjectRadioStateChanged
0687:
0688:            private void existingProjectRadioStateChanged(
0689:                    javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_existingProjectRadioStateChanged
0690:            {//GEN-HEADEREND:event_existingProjectRadioStateChanged
0691:                // updateValidStatus();
0692:            }//GEN-LAST:event_existingProjectRadioStateChanged
0693:
0694:            private void browseButtonActionPerformed(
0695:                    java.awt.event.ActionEvent evt)//GEN-FIRST:event_browseButtonActionPerformed
0696:            {//GEN-HEADEREND:event_browseButtonActionPerformed
0697:                javax.swing.JFrame parentFrame = new javax.swing.JFrame();
0698:                parentFrame.setLocation(getLocationOnScreen());
0699:
0700:                if (chooser == null) {
0701:                    chooser = new ChooseLocationDialog(
0702:                            parentFrame,
0703:                            true,
0704:                            new File(retrieveProjectParentDirectory()),
0705:                            NbBundle
0706:                                    .getMessage(ReverseEngineerPanel.class,
0707:                                            "LBL_RevEngProjectLocationChooseDialog_Title")); // NOI18N);
0708:                }
0709:
0710:                else
0711:                    chooser.setFolderLocation(retrieveProjectParentDirectory());
0712:
0713:                chooser.getLocationChooser().addActionListener(
0714:                        new java.awt.event.ActionListener() {
0715:                            public void actionPerformed(
0716:                                    java.awt.event.ActionEvent evt) {
0717:                                locationChooserActionPerformed(evt);
0718:                            }
0719:                        });
0720:
0721:                chooser.setLocation(getLocationOnScreen());
0722:                chooser.setVisible(true);
0723:            }//GEN-LAST:event_browseButtonActionPerformed
0724:
0725:            public void locationChooserActionPerformed(ActionEvent evt) {
0726:                if (evt.getActionCommand().equals(
0727:                        JFileChooser.APPROVE_SELECTION)) {
0728:                    projectLocationText.setText(chooser.getFolderLocation()
0729:                            .getPath());
0730:                }
0731:            }
0732:
0733:            public void requestFocus() {
0734:                targetProjectCombo.requestFocus();
0735:                updateValidStatus();
0736:            }
0737:
0738:            private void initListeners() {
0739:                projectNameText.getDocument().addDocumentListener(this );
0740:                projectLocationText.getDocument().addDocumentListener(this );
0741:                projectTypeButtonGroup.getSelection().addChangeListener(this );
0742:                sourceRoots.getModel().addTableModelListener(this );
0743:            }
0744:
0745:            // DocumentListener interface implementation
0746:            ////////////////////////////////////////////
0747:
0748:            public void changedUpdate(DocumentEvent event) {
0749:                updateTexts(event);
0750:
0751:                if (projectNameText.getDocument() == event.getDocument()) {
0752:                    firePropertyChange(PROP_PROJECT_NAME, null, projectNameText
0753:                            .getText());
0754:                }
0755:            }
0756:
0757:            public void insertUpdate(DocumentEvent event) {
0758:                updateTexts(event);
0759:
0760:                if (projectNameText.getDocument() == event.getDocument()) {
0761:                    firePropertyChange(PROP_PROJECT_NAME, null, projectNameText
0762:                            .getText());
0763:                }
0764:            }
0765:
0766:            public void removeUpdate(DocumentEvent event) {
0767:                updateTexts(event);
0768:
0769:                if (projectNameText.getDocument() == event.getDocument()) {
0770:                    firePropertyChange(PROP_PROJECT_NAME, null, projectNameText
0771:                            .getText());
0772:                }
0773:            }
0774:
0775:            /** 
0776:             * Handles changes in the Project name and project directory
0777:             */
0778:            private void updateTexts(DocumentEvent event) {
0779:                Document doc = event.getDocument();
0780:
0781:                if (doc == projectNameText.getDocument()
0782:                        || doc == projectLocationText.getDocument()) {
0783:                    // Change in the project name
0784:                    String projectName = projectNameText.getText();
0785:                    String projectFolder = projectLocationText.getText();
0786:
0787:                    projectFolderText.setText(projectFolder
0788:                            + File.separatorChar + projectName);
0789:
0790:                    updateValidStatus();
0791:                }
0792:            }
0793:
0794:            private void initSourceRootsTable() {
0795:                JavaSourceRootsModel model = JavaSourceRootsUI
0796:                        .createModel(javaProject);
0797:
0798:                if (model != null)
0799:                    sourceRoots.setModel(model);
0800:
0801:                else
0802:                    sourceRoots.setModel(JavaSourceRootsUI.createEmptyModel());
0803:
0804:                sourceRoots.getTableHeader().setReorderingAllowed(false);
0805:                sourceRoots.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
0806:            }
0807:
0808:            private void initValues() {
0809:                populateProjectList();
0810:                enablePanelFields(targetProjectComboHasItems()
0811:                        && umlProject != null);
0812:                populateNewProjectFields();
0813:                statusLabel.setText(" "); // NOI18N
0814:            }
0815:
0816:            private void initJavaProjectValues() {
0817:                selectedNodesText.setText(retrieveJavaProjectName());
0818:            }
0819:
0820:            private void initJavaFilesValues() {
0821:                StringBuffer fileNames = new StringBuffer();
0822:
0823:                if (selectedNodes == null || selectedNodes.size() == 0)
0824:                    fileNames.append("<Error: no nodes selected>");
0825:
0826:                else {
0827:                    for (String fileName : selectedNodes)
0828:                        fileNames.append(fileName).append(", ");
0829:
0830:                    fileNames.delete(fileNames.lastIndexOf(", "), fileNames
0831:                            .length() - 1);
0832:                }
0833:
0834:                selectedNodesText.setText(fileNames.toString());
0835:            }
0836:
0837:            private void populateProjectList() {
0838:                ProjectCellRenderer projectCellRenderer = new ProjectCellRenderer();
0839:                targetProjectCombo.setRenderer(projectCellRenderer);
0840:
0841:                // Populate the combo box with list of open UML projects
0842:                Project[] openProjects = ProjectUtil.getOpenUMLProjects();
0843:
0844:                // no UML project open? then don't allow the Use Existing Project 
0845:                //  radio button to be selected at all
0846:                if (openProjects == null || openProjects.length < 1) {
0847:                    enableExistingProjectPanelComponents(false);
0848:                    existingProjectRadio.setEnabled(false);
0849:                }
0850:
0851:                else {
0852:                    DefaultComboBoxModel projectsModel = new DefaultComboBoxModel(
0853:                            openProjects);
0854:
0855:                    targetProjectCombo.setModel(projectsModel);
0856:                    selectTargetProject();
0857:                }
0858:            }
0859:
0860:            private void populateNewProjectFields() {
0861:                String prjParentDir = retrieveProjectParentDirectory();
0862:
0863:                projectNameText.setText(ProjectUtil.createUniqueProjectName(
0864:                        new File(prjParentDir), retrieveJavaProjectName()
0865:                                + NbBundle.getMessage(
0866:                                        ReverseEngineerPanel.class,
0867:                                        "TXT_RE_PROJECT_SUFFIX"), // NOI18N
0868:                        true));
0869:
0870:                projectLocationText.setText(retrieveProjectParentDirectory());
0871:            }
0872:
0873:            private String retrieveJavaProjectName() {
0874:                return ProjectUtils.getInformation(javaProject)
0875:                        .getDisplayName();
0876:            }
0877:
0878:            private void selectTargetProject() {
0879:                if (!targetProjectComboHasItems()) {
0880:                    targetProjectCombo.setEnabled(false);
0881:                    return;
0882:                }
0883:
0884:                if (umlProject != null)
0885:                    targetProjectCombo.setSelectedItem(umlProject);
0886:
0887:                else
0888:                    targetProjectCombo.setSelectedIndex(0);
0889:            }
0890:
0891:            // OK or Cancel button clicked
0892:            public void actionPerformed(ActionEvent event) {
0893:                //        if (event.getActionCommand().equals("OK")) // NOI18N
0894:                //        {
0895:                //            // TODO: do something ???
0896:                //        }
0897:            }
0898:
0899:            public void stateChanged(ChangeEvent event) {
0900:                enablePanelFields(existingProjectRadio.isSelected());
0901:                updateValidStatus();
0902:            }
0903:
0904:            private void enablePanelFields(boolean enable) {
0905:                enableExistingProjectPanelComponents(enable);
0906:                enableNewProjectPanelComponents(!enable);
0907:            }
0908:
0909:            private void enableExistingProjectPanelComponents(boolean enable) {
0910:                existingProjectRadio.setSelected(enable);
0911:                targetProjectLabel.setEnabled(enable);
0912:                targetProjectCombo.setEnabled(enable);
0913:
0914:                if (enable)
0915:                    umlProject = (Project) targetProjectCombo.getSelectedItem();
0916:
0917:                else
0918:                    umlProject = null;
0919:            }
0920:
0921:            private void enableNewProjectPanelComponents(boolean enable) {
0922:                newProjectRadio.setSelected(enable);
0923:                projectNameLabel.setEnabled(enable);
0924:                projectNameText.setEnabled(enable);
0925:
0926:                projectLocationLabel.setEnabled(enable);
0927:                projectLocationText.setEnabled(enable);
0928:                browseButton.setEnabled(enable);
0929:
0930:                projectFolderLabel.setEnabled(enable);
0931:            }
0932:
0933:            public String getProjectFolder() {
0934:                return projectFolderText.getText();
0935:            }
0936:
0937:            public String getProjectName() {
0938:                return projectNameText.getText();
0939:            }
0940:
0941:            public Project getJavaProject() {
0942:                return javaProject;
0943:            }
0944:
0945:            public JavaSourceRootsUI.JavaSourceRootsModel getSourceRoots() {
0946:                return (JavaSourceRootsUI.JavaSourceRootsModel) sourceRoots
0947:                        .getModel();
0948:            }
0949:
0950:            public boolean isUseExistingProject() {
0951:                return existingProjectRadio.isSelected();
0952:            }
0953:
0954:            public boolean isCreateNewProject() {
0955:                return newProjectRadio.isSelected();
0956:            }
0957:
0958:            public Project getUMLProject() {
0959:                return umlProject;
0960:            }
0961:
0962:            public boolean isShowSourceRoots() {
0963:                return showSourceRoots;
0964:            }
0965:
0966:            private String retrieveProjectParentDirectory() {
0967:                try {
0968:                    return FileUtil.toFile(
0969:                            javaProject.getProjectDirectory().getParent())
0970:                            .getCanonicalFile().getAbsolutePath();
0971:                }
0972:
0973:                catch (IOException ex) {
0974:                    // TODO: conover - provide proper handling
0975:                    ex.printStackTrace();
0976:                    return "<Java project parent folder IOException>"; // NOI18N
0977:                }
0978:            }
0979:
0980:            private boolean targetProjectComboHasItems() {
0981:                return targetProjectCombo.getModel() != null
0982:                        && targetProjectCombo.getModel().getSize() > 0;
0983:            }
0984:
0985:            private boolean updateValidStatus() {
0986:                enable = true;
0987:                statusMsg = " "; // NOI18N
0988:
0989:                if (newProjectRadio.isSelected()) {
0990:                    if (!(new File(projectLocationText.getText()).exists())) {
0991:                        enable = Boolean.FALSE;
0992:                        statusMsg = "MSG_STATUS_ProjectLocationFolderDNE"; // NOI18N
0993:
0994:                        return notifyPropertyListeners();
0995:                    }
0996:
0997:                    else if (new File(projectFolderText.getText()).exists()) {
0998:                        enable = Boolean.FALSE;
0999:                        statusMsg = "MSG_STATUS_ProjectExists"; // NOI18N
1000:
1001:                        return notifyPropertyListeners();
1002:                    }
1003:                }
1004:
1005:                if (showSourceRoots) {
1006:                    boolean atLeastOne = false;
1007:
1008:                    for (int i = 0; i < sourceRoots.getModel().getRowCount(); i++) {
1009:                        if (((Boolean) sourceRoots.getModel().getValueAt(i, 0))
1010:                                .booleanValue()) {
1011:                            atLeastOne = true;
1012:                            break;
1013:                        }
1014:                    }
1015:
1016:                    if (!atLeastOne) {
1017:                        enable = Boolean.FALSE;
1018:                        statusMsg = "MSG_STATUS_NoSourceGroups"; // NOI18N
1019:
1020:                        return notifyPropertyListeners();
1021:                    }
1022:                }
1023:
1024:                return notifyPropertyListeners();
1025:            }
1026:
1027:            private boolean notifyPropertyListeners() {
1028:                //        if (enable == valid)
1029:                //            return valid;
1030:
1031:                firePropertyChange(NotifyDescriptor.PROP_VALID, valid, enable);
1032:
1033:                if (!statusMsg.equals(" "))
1034:                    statusMsg = NbBundle.getMessage(ReverseEngineerPanel.class,
1035:                            statusMsg);
1036:
1037:                statusLabel.setText(statusMsg);
1038:                valid = enable;
1039:                return valid;
1040:            }
1041:
1042:            public void tableChanged(TableModelEvent e) {
1043:                updateValidStatus();
1044:            }
1045:
1046:            // Variables declaration - do not modify//GEN-BEGIN:variables
1047:            private javax.swing.JButton browseButton;
1048:            private javax.swing.JPanel existingProjectPanel;
1049:            private javax.swing.JRadioButton existingProjectRadio;
1050:            private javax.swing.JPanel newProjectPanel;
1051:            private javax.swing.JRadioButton newProjectRadio;
1052:            private javax.swing.JLabel projectFolderLabel;
1053:            private javax.swing.JTextField projectFolderText;
1054:            private javax.swing.JLabel projectLocationLabel;
1055:            private javax.swing.JTextField projectLocationText;
1056:            private javax.swing.JLabel projectNameLabel;
1057:            private javax.swing.JTextField projectNameText;
1058:            private javax.swing.ButtonGroup projectTypeButtonGroup;
1059:            private javax.swing.JPanel selNodesPanel;
1060:            private javax.swing.JLabel selectedNodesLabel;
1061:            private javax.swing.JTextField selectedNodesText;
1062:            private javax.swing.JLabel sourceFoldersLabel;
1063:            private javax.swing.JTable sourceRoots;
1064:            private javax.swing.JPanel sourceRootsPanel;
1065:            private javax.swing.JScrollPane sourceRootsScrollPane;
1066:            private javax.swing.JLabel statusLabel;
1067:            private javax.swing.JComboBox targetProjectCombo;
1068:            private javax.swing.JLabel targetProjectLabel;
1069:            // End of variables declaration//GEN-END:variables
1070:
1071:            private Project javaProject;
1072:            private Project umlProject;
1073:            private ArrayList<String> selectedNodes;
1074:            private boolean showSourceRoots = true;
1075:            private ChooseLocationDialog chooser;
1076:            private ReverseEngineerDescriptor descriptor;
1077:            private boolean valid = true;
1078:            private String statusMsg = " "; // NOI18N
1079:            private boolean enable = false;
1080:
1081:            private String PROP_PROJECT_NAME = "PROP_PROJECT_NAME"; // NOI18N
1082:
1083:            private static class ProjectCellRenderer extends JLabel implements 
1084:                    ListCellRenderer {
1085:                public ProjectCellRenderer() {
1086:                    setOpaque(true);
1087:                }
1088:
1089:                public Component getListCellRendererComponent(JList list,
1090:                        Object value, int index, boolean isSelected,
1091:                        boolean cellHasFocus) {
1092:
1093:                    if (value instanceof  Project) {
1094:                        ProjectInformation pi = ProjectUtils
1095:                                .getInformation((Project) value);
1096:
1097:                        setText(pi.getDisplayName());
1098:                        setIcon(pi.getIcon());
1099:                    }
1100:
1101:                    else {
1102:                        setText(value == null ? " " : value.toString()); // NOI18N
1103:                        setIcon(null);
1104:                    }
1105:
1106:                    if (isSelected) {
1107:                        setBackground(list.getSelectionBackground());
1108:                        setForeground(list.getSelectionForeground());
1109:                    }
1110:
1111:                    else {
1112:                        setBackground(list.getBackground());
1113:                        setForeground(list.getForeground());
1114:
1115:                    }
1116:
1117:                    return this;
1118:                }
1119:            }
1120:
1121:        }
w___w___w_._jav___a_2s__._c__om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.