Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -757,13 +757,18 @@ public void takeSnapshot() {
*/
private void resetMetaData() {
tabTitleProperty.setValue(Messages.unnamedSnapshot);
snapshotNameProperty.setValue(null);
snapshotCommentProperty.setValue(null);
createdDateTextProperty.setValue(null);
lastModifiedDateTextProperty.setValue(null);
createdByTextProperty.setValue(null);
}

public static Throwable getRootCause(Throwable throwable) {
if (throwable.getCause() != null)
return getRootCause(throwable.getCause());

return throwable;
}

@SuppressWarnings("unused")
public void saveSnapshot(ActionEvent actionEvent) {
disabledUi.set(true);
Expand Down Expand Up @@ -795,7 +800,8 @@ public void saveSnapshot(ActionEvent actionEvent) {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(Messages.errorActionFailed);
alert.setContentText(e.getMessage());
// get root cause of exception because the nested exception names are not very friendly
alert.setContentText(getRootCause(e).getMessage());
alert.setHeaderText(Messages.saveSnapshotErrorContent);
DialogHelper.positionDialog(alert, borderPane, -150, -150);
alert.showAndWait();
Expand Down Expand Up @@ -1101,7 +1107,14 @@ private void takeSnapshotReadPVs(Consumer<Optional<Snapshot>> consumer) {
});
showTakeSnapshotResult(snapshotItems);
Snapshot snapshot = new Snapshot();
snapshot.setSnapshotNode(Node.builder().nodeType(NodeType.SNAPSHOT).build());
snapshot.setSnapshotNode(
Node.builder()
.nodeType(NodeType.SNAPSHOT)
// set name and description to preserve the name / comment fields
.name(snapshotNameProperty.getValue())
.description(snapshotCommentProperty.getValue())
.build()
);
SnapshotData snapshotData = new SnapshotData();
snapshotData.setSnapshotItems(snapshotItems);
snapshot.setSnapshotData(snapshotData);
Expand Down