void () { super.init(); if (myPropertyName != null) { updatePropertyValue(myPropertyName); } else { myPropertyNameBox.getEditor().setItem(""); } myPropertyNameBox.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { String name = getPropertyName(); updatePropertyValue(name); getOKAction().setEnabled(name != null && !name.trim().isEmpty()); } }); Component editor = myPropertyNameBox.getEditor().getEditorComponent(); if (editor instanceof JTextField jTextField) { jTextField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { String name = getPropertyName(); updatePropertyValue(name); getOKAction().setEnabled(name != null && !name.trim().isEmpty()); } }); } getOKAction().setEnabled(myPropertyName != null && !myPropertyName.trim().isEmpty()); }