use of au.gov.asd.tac.constellation.views.attributeeditor.editors.operations.ModifyAttributeEditOperation in project constellation by constellation-app.
the class AttributeEditorPanel method modifyAttributeAction.
private void modifyAttributeAction(final AttributeData attr) {
final EditOperation editOperation = new ModifyAttributeEditOperation(attr);
final List<String> extantAttributeNames = currentAttributeNames.get(attr.getElementType());
final ValueValidator<AttributePrototype> validator = v -> extantAttributeNames.contains(v.getAttributeName()) && !attr.getAttributeName().equals(v.getAttributeName()) ? "An attribute with that name already exists." : null;
final AbstractEditor<AttributePrototype> editor = ATTRIBUTE_EDITOR_FACTORY.createEditor(editOperation, validator, String.format("Modify %s attribute %s", attr.getElementType().getShortLabel(), attr.getAttributeName()), attr);
((AttributeEditor) editor).setGraphElementType(attr.getElementType());
((AttributeEditor) editor).setTypeModifiable(false);
final AttributeEditorDialog dialog = new AttributeEditorDialog(false, editor);
dialog.showDialog();
}
Aggregations