@Override public void actionPerformed(java.awt.event.ActionEvent e) { try { PropertyEditor propEd = property.getPropertyEditor(); propEd.setValue(property.getValue()); final Component custEditor = propEd.getCustomEditor(); Object[] options = buttons(); DialogDescriptor descriptor = new DialogDescriptor( custEditor, (String) getValue(Action.NAME), true, options, DialogDescriptor.CANCEL_OPTION, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, (ActionEvent e1) -> { try { String action = e1.getActionCommand(); switch (action) { case OK_COMMAND: Object value = property.getPropertyEditor().getValue(); property.setValue(value); break; case RESTORE_COMMAND: property.restoreDefaultValue(); break; } dialog.dispose(); } catch (Exception ex) { NotifyDescriptor descriptor2 = new NotifyDescriptor.Message( NbBundle.getMessage(PropertyAction.class, "MSG_InvalidValue")); // NOI18N DialogDisplayer.getDefault().notify(descriptor2); } }); descriptor.setClosingOptions(new Object[0]); dialog = DialogDisplayer.getDefault().createDialog(descriptor); dialog.setVisible(true); dialog = null; } catch (Exception ex) { ErrorManager.getDefault().notify(ex); } }
public static PropertyAction createIfEditable(RADProperty<?> property) { PropertyEditor propEd = property.getPropertyEditor(); return propEd != null && propEd.supportsCustomEditor() ? new PropertyAction(property) : null; }