Lines 55-60
Link Here
|
55 |
import java.util.Set; |
55 |
import java.util.Set; |
56 |
import javax.swing.ListSelectionModel; |
56 |
import javax.swing.ListSelectionModel; |
57 |
import javax.swing.SwingUtilities; |
57 |
import javax.swing.SwingUtilities; |
|
|
58 |
import javax.swing.event.TableModelEvent; |
59 |
import javax.swing.event.TableModelListener; |
60 |
import javax.swing.table.TableModel; |
58 |
import org.netbeans.api.java.project.JavaProjectConstants; |
61 |
import org.netbeans.api.java.project.JavaProjectConstants; |
59 |
import org.netbeans.api.project.Project; |
62 |
import org.netbeans.api.project.Project; |
60 |
import org.netbeans.api.project.ProjectUtils; |
63 |
import org.netbeans.api.project.ProjectUtils; |
Lines 155-170
Link Here
|
155 |
return ConfigFilesUIs.getSelectedFiles(configFileTable); |
158 |
return ConfigFilesUIs.getSelectedFiles(configFileTable); |
156 |
} |
159 |
} |
157 |
|
160 |
|
|
|
161 |
public List<File> getSelectableFiles() { |
162 |
return ConfigFilesUIs.getSelectableFiles(configFileTable); |
163 |
} |
164 |
|
158 |
private void cancelDetection() { |
165 |
private void cancelDetection() { |
159 |
if (detectTask != null) { |
166 |
if (detectTask != null) { |
160 |
detectTask.cancel(); |
167 |
detectTask.cancel(); |
161 |
} |
168 |
} |
162 |
} |
169 |
} |
|
|
170 |
private void updateSelectAllNonButtons() { |
171 |
final int maxSize = getSelectableFiles().size(); |
172 |
final int size = getSelectedFiles().size(); |
173 |
|
174 |
btnSelectAll.setEnabled(maxSize > 0 && size < maxSize); |
175 |
btnSelectNone.setEnabled(maxSize > 0 && size > 0); |
176 |
} |
163 |
|
177 |
|
164 |
private void updateAvailableFiles(List<File> availableFiles) { |
178 |
private void updateAvailableFiles(List<File> availableFiles) { |
165 |
this.availableFiles = availableFiles; |
179 |
this.availableFiles = availableFiles; |
166 |
configFileTable.setEnabled(true); |
180 |
configFileTable.setEnabled(true); |
167 |
ConfigFilesUIs.connectFilesSelectionTable(availableFiles, alreadySelectedFiles, configFileTable); |
181 |
ConfigFilesUIs.connectFilesSelectionTable(availableFiles, alreadySelectedFiles, configFileTable); |
|
|
182 |
configFileTable.getModel().addTableModelListener(new TableModelListener() { |
183 |
@Override |
184 |
public void tableChanged(TableModelEvent e) { |
185 |
updateSelectAllNonButtons(); |
186 |
} |
187 |
}); |
168 |
configFileTable.getColumnModel().getColumn(0).setMaxWidth(0); |
188 |
configFileTable.getColumnModel().getColumn(0).setMaxWidth(0); |
169 |
// In an attempt to hide the progress bar and label, but force |
189 |
// In an attempt to hide the progress bar and label, but force |
170 |
// the occupy the same space. |
190 |
// the occupy the same space. |
Lines 174-179
Link Here
|
174 |
progressBar.setBorderPainted(false); |
194 |
progressBar.setBorderPainted(false); |
175 |
progressBar.setBackground(getBackground()); |
195 |
progressBar.setBackground(getBackground()); |
176 |
descriptor.setValid(true); |
196 |
descriptor.setValid(true); |
|
|
197 |
|
198 |
updateSelectAllNonButtons(); |
177 |
} |
199 |
} |
178 |
|
200 |
|
179 |
/** This method is called from within the constructor to |
201 |
/** This method is called from within the constructor to |
Lines 190-197
Link Here
|
190 |
configFileTable = new javax.swing.JTable(); |
212 |
configFileTable = new javax.swing.JTable(); |
191 |
progressBar = new javax.swing.JProgressBar(); |
213 |
progressBar = new javax.swing.JProgressBar(); |
192 |
messageLabel = new javax.swing.JLabel(); |
214 |
messageLabel = new javax.swing.JLabel(); |
|
|
215 |
btnSelectAll = new javax.swing.JButton(); |
216 |
btnSelectNone = new javax.swing.JButton(); |
193 |
|
217 |
|
194 |
detectedFilesLabel.setText(org.openide.util.NbBundle.getMessage(SelectConfigFilesPanel.class, "LBL_ConfigFiles")); // NOI18N |
218 |
org.openide.awt.Mnemonics.setLocalizedText(detectedFilesLabel, org.openide.util.NbBundle.getMessage(SelectConfigFilesPanel.class, "LBL_ConfigFiles")); // NOI18N |
195 |
|
219 |
|
196 |
configFileTable.setIntercellSpacing(new java.awt.Dimension(0, 0)); |
220 |
configFileTable.setIntercellSpacing(new java.awt.Dimension(0, 0)); |
197 |
configFileTable.setShowHorizontalLines(false); |
221 |
configFileTable.setShowHorizontalLines(false); |
Lines 202-220
Link Here
|
202 |
progressBar.setString(" "); // NOI18N |
226 |
progressBar.setString(" "); // NOI18N |
203 |
progressBar.setStringPainted(true); |
227 |
progressBar.setStringPainted(true); |
204 |
|
228 |
|
205 |
messageLabel.setText(org.openide.util.NbBundle.getMessage(SelectConfigFilesPanel.class, "LBL_PleaseWait")); // NOI18N |
229 |
org.openide.awt.Mnemonics.setLocalizedText(messageLabel, org.openide.util.NbBundle.getMessage(SelectConfigFilesPanel.class, "LBL_PleaseWait")); // NOI18N |
|
|
230 |
|
231 |
org.openide.awt.Mnemonics.setLocalizedText(btnSelectAll, org.openide.util.NbBundle.getMessage(SelectConfigFilesPanel.class, "SelectConfigFilesPanel.btnSelectAll.text")); // NOI18N |
232 |
btnSelectAll.addActionListener(new java.awt.event.ActionListener() { |
233 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
234 |
btnSelectAllActionPerformed(evt); |
235 |
} |
236 |
}); |
237 |
|
238 |
btnSelectNone.setMnemonic('n'); |
239 |
org.openide.awt.Mnemonics.setLocalizedText(btnSelectNone, org.openide.util.NbBundle.getMessage(SelectConfigFilesPanel.class, "SelectConfigFilesPanel.btnSelectNone.text")); // NOI18N |
240 |
btnSelectNone.addActionListener(new java.awt.event.ActionListener() { |
241 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
242 |
btnSelectNoneActionPerformed(evt); |
243 |
} |
244 |
}); |
206 |
|
245 |
|
207 |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
246 |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
208 |
this.setLayout(layout); |
247 |
this.setLayout(layout); |
209 |
layout.setHorizontalGroup( |
248 |
layout.setHorizontalGroup( |
210 |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
249 |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
211 |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() |
250 |
.addGroup(layout.createSequentialGroup() |
212 |
.addContainerGap() |
251 |
.addContainerGap() |
213 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) |
252 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
214 |
.addComponent(configFileScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE) |
253 |
.addComponent(configFileScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE) |
215 |
.addComponent(progressBar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE) |
254 |
.addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE) |
216 |
.addComponent(detectedFilesLabel, javax.swing.GroupLayout.Alignment.LEADING) |
255 |
.addGroup(layout.createSequentialGroup() |
217 |
.addComponent(messageLabel, javax.swing.GroupLayout.Alignment.LEADING)) |
256 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
|
|
257 |
.addComponent(detectedFilesLabel) |
258 |
.addComponent(messageLabel)) |
259 |
.addGap(0, 0, Short.MAX_VALUE)) |
260 |
.addGroup(layout.createSequentialGroup() |
261 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
262 |
.addComponent(btnSelectAll) |
263 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
264 |
.addComponent(btnSelectNone))) |
218 |
.addContainerGap()) |
265 |
.addContainerGap()) |
219 |
); |
266 |
); |
220 |
layout.setVerticalGroup( |
267 |
layout.setVerticalGroup( |
Lines 223-229
Link Here
|
223 |
.addContainerGap() |
270 |
.addContainerGap() |
224 |
.addComponent(detectedFilesLabel) |
271 |
.addComponent(detectedFilesLabel) |
225 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
272 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
226 |
.addComponent(configFileScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE) |
273 |
.addComponent(configFileScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE) |
|
|
274 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
275 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
276 |
.addComponent(btnSelectAll) |
277 |
.addComponent(btnSelectNone)) |
227 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
278 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
228 |
.addComponent(messageLabel) |
279 |
.addComponent(messageLabel) |
229 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
280 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
Lines 232-239
Link Here
|
232 |
); |
283 |
); |
233 |
}// </editor-fold>//GEN-END:initComponents |
284 |
}// </editor-fold>//GEN-END:initComponents |
234 |
|
285 |
|
|
|
286 |
private void btnSelectNoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectNoneActionPerformed |
287 |
if (configFileTable.getModel() instanceof ConfigFilesUIs.SelectAllNoneModel) { |
288 |
((ConfigFilesUIs.SelectAllNoneModel) configFileTable.getModel()).selectNone(); |
289 |
configFileTable.repaint(); |
290 |
} |
291 |
}//GEN-LAST:event_btnSelectNoneActionPerformed |
292 |
|
293 |
private void btnSelectAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectAllActionPerformed |
294 |
if (configFileTable.getModel() instanceof ConfigFilesUIs.SelectAllNoneModel) { |
295 |
((ConfigFilesUIs.SelectAllNoneModel) configFileTable.getModel()).selectAll(); |
296 |
configFileTable.repaint(); |
297 |
} |
298 |
}//GEN-LAST:event_btnSelectAllActionPerformed |
299 |
|
235 |
|
300 |
|
236 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
301 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
|
|
302 |
private javax.swing.JButton btnSelectAll; |
303 |
private javax.swing.JButton btnSelectNone; |
237 |
private javax.swing.JScrollPane configFileScrollPane; |
304 |
private javax.swing.JScrollPane configFileScrollPane; |
238 |
private javax.swing.JTable configFileTable; |
305 |
private javax.swing.JTable configFileTable; |
239 |
private javax.swing.JLabel detectedFilesLabel; |
306 |
private javax.swing.JLabel detectedFilesLabel; |