Skip to content

Commit

Permalink
Fix use of Dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSNelson committed Apr 10, 2024
1 parent d8b8ac6 commit 2b4d10a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,5 +408,17 @@ class StitchingGUI {
}
}

static void showAlertDialog(String message) {
Alert alert = new Alert(Alert.AlertType.WARNING)
alert.setTitle("Warning!")
alert.setHeaderText(null)
alert.setContentText(message)

// This line makes the alert a modal dialog
alert.initModality(Modality.APPLICATION_MODAL)

alert.showAndWait()
}


}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package qupath.ext.basicstitching.stitching

import org.slf4j.LoggerFactory
import qupath.ext.basicstitching.functions.StitchingGUI
import qupath.ext.basicstitching.utilities.UtilityFunctions
import qupath.lib.common.GeneralTools
import qupath.lib.gui.QuPathGUI
import qupath.lib.gui.dialogs.Dialogs
import qupath.lib.images.servers.ImageServerProvider
import qupath.lib.images.servers.ImageServers
import qupath.lib.images.servers.SparseImageServer
Expand Down Expand Up @@ -598,7 +598,7 @@ class StitchingImplementations {
setStitchingStrategy(new TileConfigurationTxtStrategy())
break
default:
Dialogs.showWarningNotification("Warning", "Error with choosing a stitching method, code here should not be reached in StitchingImplementations.groovy")
StitchingGUI.showAlertDialog("Error with choosing a stitching method, code here should not be reached in StitchingImplementations.groovy")
return // Safely exit the method if the stitching type is not recognized
}

Expand All @@ -611,7 +611,7 @@ class StitchingImplementations {

// Check if valid file-region pairs were obtained
if (fileRegionPairs == null || fileRegionPairs.isEmpty()) {
Dialogs.showWarningNotification("Warning", "No valid folders found matching the criteria.")
StitchingGUI.showAlertDialog("No valid folders found matching the criteria.")
return // Exit the method if no valid file-region pairs are found
}

Expand Down

0 comments on commit 2b4d10a

Please sign in to comment.