Lines 25-41
Link Here
|
25 |
import java.awt.event.ActionEvent; |
25 |
import java.awt.event.ActionEvent; |
26 |
import java.awt.event.ActionListener; |
26 |
import java.awt.event.ActionListener; |
27 |
import java.awt.event.MouseEvent; |
27 |
import java.awt.event.MouseEvent; |
|
|
28 |
import java.beans.PropertyChangeEvent; |
29 |
import java.beans.PropertyChangeListener; |
28 |
import java.io.File; |
30 |
import java.io.File; |
29 |
import java.text.Collator; |
31 |
import java.text.Collator; |
30 |
import java.util.Comparator; |
32 |
import java.util.Comparator; |
31 |
import java.util.HashMap; |
33 |
import java.util.HashMap; |
32 |
import java.util.Iterator; |
34 |
import java.util.Iterator; |
33 |
import java.util.Map; |
35 |
import java.util.Map; |
|
|
36 |
import java.util.Set; |
34 |
import java.util.SortedSet; |
37 |
import java.util.SortedSet; |
35 |
import java.util.TreeSet; |
38 |
import java.util.TreeSet; |
36 |
import javax.swing.DefaultComboBoxModel; |
39 |
import javax.swing.DefaultComboBoxModel; |
37 |
import javax.swing.DefaultListCellRenderer; |
40 |
import javax.swing.DefaultListCellRenderer; |
38 |
import javax.swing.JButton; |
41 |
import javax.swing.JButton; |
|
|
42 |
import javax.swing.JComponent; |
39 |
import javax.swing.JFileChooser; |
43 |
import javax.swing.JFileChooser; |
40 |
import javax.swing.JLabel; |
44 |
import javax.swing.JLabel; |
41 |
import javax.swing.JList; |
45 |
import javax.swing.JList; |
Lines 45-58
Link Here
|
45 |
import javax.swing.event.ChangeListener; |
49 |
import javax.swing.event.ChangeListener; |
46 |
import javax.swing.event.DocumentEvent; |
50 |
import javax.swing.event.DocumentEvent; |
47 |
import javax.swing.event.DocumentListener; |
51 |
import javax.swing.event.DocumentListener; |
|
|
52 |
import org.netbeans.api.project.Project; |
48 |
import org.netbeans.modules.java.j2seproject.J2SEProject; |
53 |
import org.netbeans.modules.java.j2seproject.J2SEProject; |
49 |
import org.netbeans.modules.java.j2seproject.SourceRoots; |
54 |
import org.netbeans.modules.java.j2seproject.SourceRoots; |
|
|
55 |
import org.netbeans.modules.java.j2seproject.api.ConfigComponentProvider; |
50 |
import org.openide.DialogDescriptor; |
56 |
import org.openide.DialogDescriptor; |
51 |
import org.openide.DialogDisplayer; |
57 |
import org.openide.DialogDisplayer; |
52 |
import org.openide.NotifyDescriptor; |
58 |
import org.openide.NotifyDescriptor; |
53 |
import org.openide.awt.MouseUtils; |
59 |
import org.openide.awt.MouseUtils; |
54 |
import org.openide.filesystems.FileUtil; |
60 |
import org.openide.filesystems.FileUtil; |
55 |
import org.openide.util.HelpCtx; |
61 |
import org.openide.util.HelpCtx; |
|
|
62 |
import org.openide.util.Lookup; |
56 |
import org.openide.util.NbBundle; |
63 |
import org.openide.util.NbBundle; |
57 |
import org.openide.util.Utilities; |
64 |
import org.openide.util.Utilities; |
58 |
|
65 |
|
Lines 66-77
Link Here
|
66 |
private Map<String/*|null*/,Map<String,String/*|null*/>/*|null*/> configs; |
73 |
private Map<String/*|null*/,Map<String,String/*|null*/>/*|null*/> configs; |
67 |
J2SEProjectProperties uiProperties; |
74 |
J2SEProjectProperties uiProperties; |
68 |
|
75 |
|
|
|
76 |
private ConfigComponentProvider compProvider; |
77 |
|
69 |
public CustomizerRun( J2SEProjectProperties uiProperties ) { |
78 |
public CustomizerRun( J2SEProjectProperties uiProperties ) { |
70 |
this.uiProperties = uiProperties; |
79 |
this.uiProperties = uiProperties; |
71 |
initComponents(); |
80 |
initComponents(); |
72 |
|
81 |
|
73 |
this.project = uiProperties.getProject(); |
82 |
this.project = uiProperties.getProject(); |
74 |
|
83 |
|
|
|
84 |
compProvider = Lookup.getDefault().lookup(ConfigComponentProvider.class); |
85 |
initExtPanel(project); |
86 |
|
75 |
configs = uiProperties.RUN_CONFIGS; |
87 |
configs = uiProperties.RUN_CONFIGS; |
76 |
|
88 |
|
77 |
data = new JTextField[] { |
89 |
data = new JTextField[] { |
Lines 192-200
Link Here
|
192 |
jLabelVMOptions = new javax.swing.JLabel(); |
204 |
jLabelVMOptions = new javax.swing.JLabel(); |
193 |
jTextVMOptions = new javax.swing.JTextField(); |
205 |
jTextVMOptions = new javax.swing.JTextField(); |
194 |
jLabelVMOptionsExample = new javax.swing.JLabel(); |
206 |
jLabelVMOptionsExample = new javax.swing.JLabel(); |
|
|
207 |
extPanel = new javax.swing.JPanel(); |
195 |
|
208 |
|
196 |
setLayout(new java.awt.GridBagLayout()); |
209 |
setLayout(new java.awt.GridBagLayout()); |
197 |
|
|
|
198 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
210 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
199 |
gridBagConstraints.gridx = 0; |
211 |
gridBagConstraints.gridx = 0; |
200 |
gridBagConstraints.gridy = 1; |
212 |
gridBagConstraints.gridy = 1; |
Lines 218-224
Link Here
|
218 |
configComboActionPerformed(evt); |
230 |
configComboActionPerformed(evt); |
219 |
} |
231 |
} |
220 |
}); |
232 |
}); |
221 |
|
|
|
222 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
233 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
223 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
234 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
224 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
235 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
Lines 232-238
Link Here
|
232 |
configNewActionPerformed(evt); |
243 |
configNewActionPerformed(evt); |
233 |
} |
244 |
} |
234 |
}); |
245 |
}); |
235 |
|
|
|
236 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
246 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
237 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
247 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
238 |
gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 0); |
248 |
gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 0); |
Lines 244-250
Link Here
|
244 |
configDelActionPerformed(evt); |
254 |
configDelActionPerformed(evt); |
245 |
} |
255 |
} |
246 |
}); |
256 |
}); |
247 |
|
|
|
248 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
257 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
249 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
258 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
250 |
gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 0); |
259 |
gridBagConstraints.insets = new java.awt.Insets(2, 6, 2, 0); |
Lines 264-270
Link Here
|
264 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
273 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
265 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0); |
274 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0); |
266 |
mainPanel.add(jLabelMainClass, gridBagConstraints); |
275 |
mainPanel.add(jLabelMainClass, gridBagConstraints); |
267 |
|
|
|
268 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
276 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
269 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
277 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
270 |
gridBagConstraints.weightx = 1.0; |
278 |
gridBagConstraints.weightx = 1.0; |
Lines 286-292
Link Here
|
286 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
294 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
287 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0); |
295 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0); |
288 |
mainPanel.add(jLabelArgs, gridBagConstraints); |
296 |
mainPanel.add(jLabelArgs, gridBagConstraints); |
289 |
|
|
|
290 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
297 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
291 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
298 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
292 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
299 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
Lines 302-308
Link Here
|
302 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
309 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
303 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0); |
310 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0); |
304 |
mainPanel.add(jLabelWorkingDirectory, gridBagConstraints); |
311 |
mainPanel.add(jLabelWorkingDirectory, gridBagConstraints); |
305 |
|
|
|
306 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
312 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
307 |
gridBagConstraints.gridy = 2; |
313 |
gridBagConstraints.gridy = 2; |
308 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
314 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
Lines 319-325
Link Here
|
319 |
jButtonWorkingDirectoryBrowseActionPerformed(evt); |
325 |
jButtonWorkingDirectoryBrowseActionPerformed(evt); |
320 |
} |
326 |
} |
321 |
}); |
327 |
}); |
322 |
|
|
|
323 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
328 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
324 |
gridBagConstraints.gridy = 2; |
329 |
gridBagConstraints.gridy = 2; |
325 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
330 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
Lines 334-340
Link Here
|
334 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
339 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
335 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0); |
340 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0); |
336 |
mainPanel.add(jLabelVMOptions, gridBagConstraints); |
341 |
mainPanel.add(jLabelVMOptions, gridBagConstraints); |
337 |
|
|
|
338 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
342 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
339 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
343 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
340 |
gridBagConstraints.weightx = 1.0; |
344 |
gridBagConstraints.weightx = 1.0; |
Lines 347-354
Link Here
|
347 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
351 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
348 |
gridBagConstraints.gridx = 1; |
352 |
gridBagConstraints.gridx = 1; |
349 |
gridBagConstraints.gridy = 4; |
353 |
gridBagConstraints.gridy = 4; |
350 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
|
|
351 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; |
352 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
354 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
353 |
gridBagConstraints.weighty = 1.0; |
355 |
gridBagConstraints.weighty = 1.0; |
354 |
gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0); |
356 |
gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 0); |
Lines 361-372
Link Here
|
361 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
363 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
362 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
364 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
363 |
gridBagConstraints.weightx = 1.0; |
365 |
gridBagConstraints.weightx = 1.0; |
364 |
gridBagConstraints.weighty = 1.0; |
|
|
365 |
gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0); |
366 |
gridBagConstraints.insets = new java.awt.Insets(6, 0, 6, 0); |
366 |
add(mainPanel, gridBagConstraints); |
367 |
add(mainPanel, gridBagConstraints); |
367 |
|
368 |
|
|
|
369 |
extPanel.setLayout(new java.awt.GridBagLayout()); |
370 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
371 |
gridBagConstraints.gridx = 0; |
372 |
gridBagConstraints.gridy = 3; |
373 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
374 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; |
375 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
376 |
gridBagConstraints.weightx = 1.0; |
377 |
gridBagConstraints.weighty = 1.0; |
378 |
add(extPanel, gridBagConstraints); |
368 |
}// </editor-fold>//GEN-END:initComponents |
379 |
}// </editor-fold>//GEN-END:initComponents |
369 |
|
380 |
|
|
|
381 |
private void initExtPanel(Project p) { |
382 |
if (compProvider != null) { |
383 |
ConfigComponentProvider.ConfigChangedListener ccl = new ConfigComponentProvider.ConfigChangedListener() { |
384 |
public void propertiesChanged(Map<String, String> updates) { |
385 |
// update active configuration |
386 |
Map<String,String> m = configs.get(uiProperties.activeConfig); |
387 |
m.putAll(updates); |
388 |
} |
389 |
}; |
390 |
JComponent comp = compProvider.createComponent(p, ccl); |
391 |
if (comp != null) { |
392 |
java.awt.GridBagConstraints constraints = new java.awt.GridBagConstraints(); |
393 |
constraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
394 |
constraints.gridx = 0; |
395 |
constraints.gridy = 0; |
396 |
constraints.weightx = 1.0; |
397 |
constraints.weighty = 1.0; |
398 |
extPanel.add(comp, constraints); |
399 |
} |
400 |
} |
401 |
} |
402 |
|
370 |
private void configDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configDelActionPerformed |
403 |
private void configDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configDelActionPerformed |
371 |
String config = (String) configCombo.getSelectedItem(); |
404 |
String config = (String) configCombo.getSelectedItem(); |
372 |
assert config != null; |
405 |
assert config != null; |
Lines 454-459
Link Here
|
454 |
Map<String,String> m = configs.get(activeConfig); |
487 |
Map<String,String> m = configs.get(activeConfig); |
455 |
Map<String,String> def = configs.get(null); |
488 |
Map<String,String> def = configs.get(null); |
456 |
if (m != null) { |
489 |
if (m != null) { |
|
|
490 |
compProvider.configUpdated(m); |
457 |
for (int i = 0; i < data.length; i++) { |
491 |
for (int i = 0; i < data.length; i++) { |
458 |
String v = m.get(keys[i]); |
492 |
String v = m.get(keys[i]); |
459 |
if (v == null) { |
493 |
if (v == null) { |
Lines 474-479
Link Here
|
474 |
private javax.swing.JButton configNew; |
508 |
private javax.swing.JButton configNew; |
475 |
private javax.swing.JPanel configPanel; |
509 |
private javax.swing.JPanel configPanel; |
476 |
private javax.swing.JSeparator configSep; |
510 |
private javax.swing.JSeparator configSep; |
|
|
511 |
private javax.swing.JPanel extPanel; |
477 |
private javax.swing.JButton jButtonMainClass; |
512 |
private javax.swing.JButton jButtonMainClass; |
478 |
private javax.swing.JButton jButtonWorkingDirectoryBrowse; |
513 |
private javax.swing.JButton jButtonWorkingDirectoryBrowse; |
479 |
private javax.swing.JLabel jLabelArgs; |
514 |
private javax.swing.JLabel jLabelArgs; |