private void configDelActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_configDelActionPerformed String config = (String) configCombo.getSelectedItem(); assert config != null; configs.put(config, null); configChanged(null); uiProperties.activeConfig = null; } // GEN-LAST:event_configDelActionPerformed
private void configComboActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_configComboActionPerformed String config = (String) configCombo.getSelectedItem(); if (config.length() == 0) { config = null; } configChanged(config); uiProperties.activeConfig = config; } // GEN-LAST:event_configComboActionPerformed
private void configNewActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_configNewActionPerformed NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine( NbBundle.getMessage(CustomizerRun.class, "CustomizerRun.input.prompt"), // NOI18N NbBundle.getMessage(CustomizerRun.class, "CustomizerRun.input.title")); // NOI18N if (DialogDisplayer.getDefault().notify(d) != NotifyDescriptor.OK_OPTION) { return; } String name = d.getInputText(); String config = name.replaceAll("[^a-zA-Z0-9_.-]", "_"); // NOI18N if (config.trim().length() == 0) { // #143764 DialogDisplayer.getDefault() .notify( new NotifyDescriptor.Message( NbBundle.getMessage( CustomizerRun.class, "CustomizerRun.input.empty", config), // NOI18N NotifyDescriptor.WARNING_MESSAGE)); return; } if (configs.get(config) != null) { DialogDisplayer.getDefault() .notify( new NotifyDescriptor.Message( NbBundle.getMessage( CustomizerRun.class, "CustomizerRun.input.duplicate", config), // NOI18N NotifyDescriptor.WARNING_MESSAGE)); return; } Map<String, String> m = new HashMap<String, String>(); if (!name.equals(config)) { m.put("$label", name); // NOI18N } configs.put(config, m); configChanged(config); uiProperties.activeConfig = config; } // GEN-LAST:event_configNewActionPerformed
public CustomizerRun(J2SEProjectProperties uiProperties) { this.uiProperties = uiProperties; initComponents(); this.project = uiProperties.getProject(); nextExtensionYPos = 0; // BEGIN Deprecated compProviderDeprecated = Lookup.getDefault().lookup(J2SERunConfigProvider.class); initExtPanel(project); // END Deprecated for (J2SECategoryExtensionProvider compProvider : project.getLookup().lookupAll(J2SECategoryExtensionProvider.class)) { if (compProvider.getCategory() == J2SECategoryExtensionProvider.ExtensibleCategory.RUN) { if (addExtPanel(project, compProvider, nextExtensionYPos)) { compProviders.add(compProvider); nextExtensionYPos++; } } } addPanelFiller(nextExtensionYPos); configs = uiProperties.RUN_CONFIGS; data = new JTextField[] { jTextFieldMainClass, jTextFieldArgs, jTextVMOptions, jTextWorkingDirectory, }; dataLabels = new JLabel[] { jLabelMainClass, jLabelArgs, jLabelVMOptions, jLabelWorkingDirectory, }; keys = new String[] { ProjectProperties.MAIN_CLASS, ProjectProperties.APPLICATION_ARGS, ProjectProperties.RUN_JVM_ARGS, ProjectProperties.RUN_WORK_DIR, }; assert data.length == keys.length; configChanged(uiProperties.activeConfig); configCombo.setRenderer(new ConfigListCellRenderer()); for (int i = 0; i < data.length; i++) { final JTextField field = data[i]; final String prop = keys[i]; final JLabel label = dataLabels[i]; field .getDocument() .addDocumentListener( new DocumentListener() { Font basefont = label.getFont(); Font boldfont = basefont.deriveFont(Font.BOLD); { updateFont(); } public void insertUpdate(DocumentEvent e) { changed(); } public void removeUpdate(DocumentEvent e) { changed(); } public void changedUpdate(DocumentEvent e) {} void changed() { String config = (String) configCombo.getSelectedItem(); if (config.length() == 0) { config = null; } String v = field.getText(); if (v != null && config != null && v.equals(configs.get(null).get(prop))) { // default value, do not store as such v = null; } configs.get(config).put(prop, v); updateFont(); } void updateFont() { String v = field.getText(); String config = (String) configCombo.getSelectedItem(); if (config.length() == 0) { config = null; } String def = configs.get(null).get(prop); label.setFont( config != null && !Utilities.compareObjects( v != null ? v : "", def != null ? def : "") ? boldfont : basefont); } }); } jButtonMainClass.addActionListener( new MainClassListener(project.getSourceRoots(), jTextFieldMainClass)); }