private void includeExcludeButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_includeExcludeButtonActionPerformed IncludeExcludeVisualizer v = new IncludeExcludeVisualizer(); uiProperties.loadIncludesExcludes(v); DialogDescriptor dd = new DialogDescriptor( v.getVisualizerPanel(), NbBundle.getMessage(CustomizerSources.class, "CustomizerSources.title.includeExclude")); dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION); if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dd))) { uiProperties.storeIncludesExcludes(v); } } // GEN-LAST:event_includeExcludeButtonActionPerformed
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 CustomizerSources(J2SEProjectProperties uiProperties) { this.uiProperties = uiProperties; initComponents(); jScrollPane1.getViewport().setBackground(sourceRoots.getBackground()); jScrollPane2.getViewport().setBackground(testRoots.getBackground()); sourceRoots.setModel(uiProperties.SOURCE_ROOTS_MODEL); testRoots.setModel(uiProperties.TEST_ROOTS_MODEL); sourceRoots.getTableHeader().setReorderingAllowed(false); testRoots.getTableHeader().setReorderingAllowed(false); FileObject projectFolder = uiProperties.getProject().getProjectDirectory(); File pf = FileUtil.toFile(projectFolder); this.projectLocation.setText(pf == null ? "" : pf.getPath()); // NOI18N SourceRootsUi.EditMediator emSR = SourceRootsUi.registerEditMediator( uiProperties.getProject(), uiProperties.getProject().getSourceRoots(), sourceRoots, addSourceRoot, removeSourceRoot, upSourceRoot, downSourceRoot, new LabelCellEditor(sourceRoots, testRoots), true); SourceRootsUi.EditMediator emTSR = SourceRootsUi.registerEditMediator( uiProperties.getProject(), uiProperties.getProject().getTestSourceRoots(), testRoots, addTestRoot, removeTestRoot, upTestRoot, downTestRoot, new LabelCellEditor(sourceRoots, testRoots), true); emSR.setRelatedEditMediator(emTSR); emTSR.setRelatedEditMediator(emSR); this.sourceLevel.setEditable(false); this.sourceLevel.setModel(uiProperties.JAVAC_SOURCE_MODEL); this.sourceLevel.setRenderer(uiProperties.JAVAC_SOURCE_RENDERER); uiProperties.JAVAC_SOURCE_MODEL.addListDataListener( new ListDataListener() { public void intervalAdded(ListDataEvent e) { enableSourceLevel(); } public void intervalRemoved(ListDataEvent e) { enableSourceLevel(); } public void contentsChanged(ListDataEvent e) { enableSourceLevel(); } }); enableSourceLevel(); this.originalEncoding = this.uiProperties .getProject() .evaluator() .getProperty(J2SEProjectProperties.SOURCE_ENCODING); if (this.originalEncoding == null) { this.originalEncoding = Charset.defaultCharset().name(); } this.encoding.setModel(ProjectCustomizer.encodingModel(originalEncoding)); this.encoding.setRenderer(ProjectCustomizer.encodingRenderer()); final String lafid = UIManager.getLookAndFeel().getID(); if (!"Aqua".equals(lafid)) { // NOI18N this.encoding.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE); // NOI18N this.encoding.addItemListener( new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { javax.swing.JComboBox combo = (javax.swing.JComboBox) e.getSource(); combo.setPopupVisible(false); } }); } this.encoding.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { handleEncodingChange(); } }); initTableVisualProperties(sourceRoots); initTableVisualProperties(testRoots); uiProperties.addOptionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CellEditor cellEditor = sourceRoots.getCellEditor(); if (cellEditor != null) { cellEditor.stopCellEditing(); } cellEditor = testRoots.getCellEditor(); if (cellEditor != null) { cellEditor.stopCellEditing(); } } }); }
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)); }