use of de.catma.ui.module.main.ErrorHandler in project catma by forTEXT.
the class AnnotationDetailsPanel method handleEditAnnotationRequest.
private void handleEditAnnotationRequest(RendererClickEvent<AnnotationTreeItem> clickEvent) {
AnnotationDataItem item = (AnnotationDataItem) clickEvent.getItem();
final Annotation annotation = item.getAnnotation();
if (project.hasPermission(project.getRoleForCollection(annotation.getUserMarkupCollection().getUuid()), RBACPermission.COLLECTION_WRITE)) {
String tagId = annotation.getTagInstance().getTagDefinitionId();
TagDefinition tag = project.getTagManager().getTagLibrary().getTagDefinition(tagId);
if (tag.getUserDefinedPropertyDefinitions().isEmpty()) {
Notification.show("Info", "There are no Properties defined for the Tag of this Annotation!", Type.HUMANIZED_MESSAGE);
} else {
EditAnnotationPropertiesDialog editAnnotationPropertiesDialog = new EditAnnotationPropertiesDialog(project, annotation, new SaveCancelListener<List<Property>>() {
@Override
public void savePressed(List<Property> result) {
try {
collectionManager.updateProperty(annotation.getUserMarkupCollection(), annotation.getTagInstance(), result);
} catch (IOException e) {
((ErrorHandler) UI.getCurrent()).showAndLogError("error updating Annotation Properties", e);
}
}
});
editAnnotationPropertiesDialog.show();
}
} else {
Notification.show("Info", "You do not have the permission to make changes to the Collection of this Annotation, " + "please contact the Project maintainer!", Type.HUMANIZED_MESSAGE);
}
}
Aggregations