1 19 20 package org.netbeans.modules.project.uiapi; 21 import java.awt.CardLayout ; 22 import javax.swing.event.ChangeListener ; 23 import org.netbeans.api.progress.ProgressHandle; 24 import org.netbeans.api.progress.ProgressHandleFactory; 25 import org.netbeans.modules.project.uiapi.DefaultProjectOperationsImplementation.InvalidablePanel; 26 import org.openide.util.NbBundle; 27 28 32 final class DefaultProjectDeletePanel extends javax.swing.JPanel implements InvalidablePanel { 33 34 private String projectDisplaName; 35 private String projectFolder; 36 private boolean enableCheckbox; 37 private ProgressHandle handle; 38 39 42 public DefaultProjectDeletePanel(ProgressHandle handle, String projectDisplaName, String projectFolder, boolean enableCheckbox) { 43 this.projectDisplaName = projectDisplaName; 44 this.projectFolder = projectFolder; 45 this.enableCheckbox = enableCheckbox; 46 this.handle = handle; 47 initComponents(); 48 49 if (Boolean.getBoolean("org.netbeans.modules.project.uiapi.DefaultProjectOperations.showProgress")) { 50 ((CardLayout ) progress.getLayout()).show(progress, "progress"); 51 } 52 } 53 54 59 private void initComponents() { 61 java.awt.GridBagConstraints gridBagConstraints; 62 63 warningText = new javax.swing.JTextArea (); 64 deleteSourcesCheckBox = new javax.swing.JCheckBox (); 65 progress = new javax.swing.JPanel (); 66 jPanel4 = new javax.swing.JPanel (); 67 progressImpl = new javax.swing.JPanel (); 68 jLabel5 = new javax.swing.JLabel (); 69 jPanel3 = new javax.swing.JPanel (); 70 71 setLayout(new java.awt.GridBagLayout ()); 72 73 getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(DefaultProjectDeletePanel.class, "ACSD_Delete_Panel", new Object [] {})); 74 warningText.setEditable(false); 75 warningText.setFont(javax.swing.UIManager.getFont("Label.font")); 76 warningText.setText(org.openide.util.NbBundle.getMessage(DefaultProjectDeletePanel.class, "LBL_Pre_Delete_Warning", new Object [] {projectDisplaName})); 77 warningText.setDisabledTextColor(javax.swing.UIManager.getColor("Label.foreground")); 78 warningText.setOpaque(false); 79 gridBagConstraints = new java.awt.GridBagConstraints (); 80 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 81 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 82 gridBagConstraints.weightx = 1.0; 83 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 12); 84 add(warningText, gridBagConstraints); 85 warningText.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(DefaultProjectDeletePanel.class, "ASCN_Pre_Delete_Warning", new Object [] {})); 86 warningText.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(DefaultProjectDeletePanel.class, "ACSD_Pre_Delete_Warning", new Object [] {projectDisplaName})); 87 88 org.openide.awt.Mnemonics.setLocalizedText(deleteSourcesCheckBox, org.openide.util.NbBundle.getMessage(DefaultProjectDeletePanel.class, "LBL_Delete_Also_Sources", new Object [] {projectFolder})); 89 deleteSourcesCheckBox.setEnabled(enableCheckbox); 90 gridBagConstraints = new java.awt.GridBagConstraints (); 91 gridBagConstraints.gridx = 0; 92 gridBagConstraints.gridy = 3; 93 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 94 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 12); 95 add(deleteSourcesCheckBox, gridBagConstraints); 96 deleteSourcesCheckBox.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(DefaultProjectDeletePanel.class, "ACSN_Delete_Also_Sources", new Object [] {projectFolder})); 97 deleteSourcesCheckBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(DefaultProjectDeletePanel.class, "ACSD_Delete_Also_Sources", new Object [] {})); 98 99 progress.setLayout(new java.awt.CardLayout ()); 100 101 progress.add(jPanel4, "not-progress"); 102 103 progressImpl.setLayout(new java.awt.GridBagLayout ()); 104 105 org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(DefaultProjectDeletePanel.class, "LBL_Deleting_Project", new Object [] {})); 106 gridBagConstraints = new java.awt.GridBagConstraints (); 107 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 108 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 109 gridBagConstraints.weightx = 1.0; 110 progressImpl.add(jLabel5, gridBagConstraints); 111 112 jPanel3.setLayout(new java.awt.BorderLayout ()); 113 114 jPanel3.add(ProgressHandleFactory.createProgressComponent(handle)); 115 gridBagConstraints = new java.awt.GridBagConstraints (); 116 gridBagConstraints.gridx = 0; 117 gridBagConstraints.gridy = 1; 118 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 119 gridBagConstraints.weightx = 1.0; 120 progressImpl.add(jPanel3, gridBagConstraints); 121 122 progress.add(progressImpl, "progress"); 123 124 gridBagConstraints = new java.awt.GridBagConstraints (); 125 gridBagConstraints.gridx = 0; 126 gridBagConstraints.gridy = 5; 127 gridBagConstraints.gridwidth = 2; 128 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 129 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 130 gridBagConstraints.weightx = 1.0; 131 gridBagConstraints.weighty = 1.0; 132 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 133 add(progress, gridBagConstraints); 134 135 } 136 138 139 private javax.swing.JCheckBox deleteSourcesCheckBox; 141 private javax.swing.JLabel jLabel5; 142 private javax.swing.JPanel jPanel3; 143 private javax.swing.JPanel jPanel4; 144 private javax.swing.JPanel progress; 145 private javax.swing.JPanel progressImpl; 146 private javax.swing.JTextArea warningText; 147 149 public boolean isDeleteSources() { 150 return deleteSourcesCheckBox.isSelected(); 151 } 152 153 void setDeleteSources(boolean value) { 154 deleteSourcesCheckBox.setSelected(value); 155 } 156 157 private String getCheckboxText() { 158 return NbBundle.getMessage(DefaultProjectDeletePanel.class, "LBL_Delete_Also_Sources", new Object [] {projectFolder}); 159 } 160 161 public void addChangeListener(ChangeListener l) { 162 } 164 165 public void removeChangeListener(ChangeListener l) { 166 } 168 169 public void showProgress() { 170 deleteSourcesCheckBox.setEnabled(false); 171 172 ((CardLayout ) progress.getLayout()).last(progress); 173 } 174 175 public boolean isPanelValid() { 176 return true; 177 } 178 179 } 180 | Popular Tags |