Skip to content

Commit 2cd0cba

Browse files
committed
Fix save&restore snapshot context menu
1 parent 3b509bb commit 2cd0cba

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/ContextMenuSnapshot.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public ContextMenuSnapshot(SaveAndRestoreController saveAndRestoreController,
8383
//
8484
setOnShowing(event -> {
8585
saveAndRestoreController.configureGoldenItem(tagGoldenMenuItem);
86+
runChecks();
8687
});
8788

8889
getItems().addAll(deleteNodesMenuItem,

app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/SaveAndRestoreController.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,17 @@ protected void compareSnapshot() {
413413
* @param node The snapshot used in the comparison.
414414
*/
415415
protected void compareSnapshot(Node node) {
416-
try {
417-
SnapshotTab currentTab = (SnapshotTab) tabPane.getSelectionModel().getSelectedItem();
418-
if (currentTab == null) {
419-
return;
416+
Tab tab = tabPane.getSelectionModel().getSelectedItem();
417+
if(tab == null){
418+
return;
419+
}
420+
if (tab instanceof SnapshotTab) {
421+
try {
422+
SnapshotTab currentTab = (SnapshotTab) tab;
423+
currentTab.addSnapshot(node);
424+
} catch (Exception e) {
425+
LOG.log(Level.WARNING, "Failed to compare snapshot", e);
420426
}
421-
currentTab.addSnapshot(node);
422-
} catch (Exception e) {
423-
LOG.log(Level.WARNING, "Failed to compare snapshot", e);
424427
}
425428
}
426429

0 commit comments

Comments
 (0)