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