Class Dialogs

java.lang.Object
org.esa.snap.rcp.util.Dialogs

public class Dialogs extends Object
Utility class which is used to display various commonly and frequently used message dialogs.
Since:
2.0
  • Field Details

  • Method Details

    • showInformation

      public static void showInformation(String message)
      Displays a modal dialog with the provided information message text.
      Parameters:
      message - The message text to be displayed.
    • showInformation

      public static void showInformation(String message, String preferencesKey)
      Displays a modal dialog with the provided information message text.
      Parameters:
      message - The message text to be displayed.
      preferencesKey - If not null, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer
    • showInformation

      public static void showInformation(String title, String message, String preferencesKey)
      Displays a modal dialog with the provided information message text.
      Parameters:
      title - The dialog title. May be null.
      message - The information message text to be displayed.
      preferencesKey - If not null, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer
    • showWarning

      public static void showWarning(String message)
      Displays a modal dialog with the provided warning message text.
      Parameters:
      message - The information message text to be displayed.
    • showWarning

      public static void showWarning(String title, String message, String preferencesKey)
      Displays a modal dialog with the provided warning message text.
      Parameters:
      title - The dialog title. May be null.
      message - The warning message text to be displayed.
      preferencesKey - If not null, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer
    • showError

      public static void showError(String message)
      Displays a modal dialog with the provided error message text.
      Parameters:
      message - The error message text to be displayed.
    • showError

      public static void showError(String title, String message)
      Displays a modal dialog with the provided error message text.
      Parameters:
      title - The dialog title. May be null.
      message - The error message text to be displayed.
    • showOutOfMemoryError

      public static void showOutOfMemoryError(String message)
      Displays a modal dialog indicating an 'Out of Memory'-error with the provided error message text. It also displays a hint how to solve the problem.
      Parameters:
      message - The error message text to be displayed.
    • showMessage

      public static void showMessage(String title, String message, int messageType, String preferencesKey)
      Displays a modal dialog with the provided message text.
      Parameters:
      title - The dialog title. May be null.
      message - The message text to be displayed.
      messageType - The type of the message.
      preferencesKey - If not null, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer
    • requestDecision

      public static Dialogs.Answer requestDecision(String title, String message, boolean allowCancel, String preferencesKey)
      Displays a modal dialog which requests a decision from the user.
      Parameters:
      title - The dialog title. May be null.
      message - The question text to be displayed.
      allowCancel - If true, the dialog also offers a cancel button.
      preferencesKey - If not null, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer
      Returns:
      Dialogs.Answer.YES, Dialogs.Answer.NO, or Dialogs.Answer.CANCELLED.
    • requestOverwriteDecision

      public static Boolean requestOverwriteDecision(String title, File file)
      Opens question dialog asking the user whether or not to overwrite an existing file. If the given file does not exists, the question dialog is not shown.
      Parameters:
      file - the file to check for existance
      Returns:
      True if the user confirms the dialog with 'yes' or the given file does not exist.
      False if the user does not want to overwrite the existing file.
      null if the user canceled the operation.
    • requestFileForOpen

      public static File requestFileForOpen(String title, boolean dirsOnly, FileFilter fileFilter, String preferencesKey)
      Opens a standard file-open dialog box.
      Parameters:
      title - a dialog-box title
      dirsOnly - whether or not to select only directories
      fileFilter - the file filter to be used, can be null
      preferencesKey - the key under which the last directory the user visited is stored
      Returns:
      the file selected by the user or null if the user canceled file selection
    • requestFileForSave

      public static File requestFileForSave(String title, boolean dirsOnly, FileFilter fileFilter, String defaultExtension, String fileName, JComponent accessory, String preferenceKey)
      Opens a standard save dialog box.
      Parameters:
      title - A dialog-box title.
      dirsOnly - Whether or not to select only directories.
      fileFilter - The file filter to be used, can be null.
      defaultExtension - The extension used as default.
      fileName - The initial filename.
      accessory - An accessory UI component to be shown in the file chooser, can be null.
      preferenceKey - The key under which the last directory the user visited is stored.
      Returns:
      The file selected by the user or null if the user cancelled the file selection.
    • getDialogTitle

      public static String getDialogTitle(String titleText)