Interface Dialogs


  • public interface Dialogs
    A simple dialog handler for prompting for an input string from the user, displaying a message to the user, or showing a set of errors and warnings. These methods can be called on any thread.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Progress createProgress​(java.lang.String title)
      Create a progress monitor
      void errors​(java.lang.String message, aQute.service.reporter.Reporter reporter)
      Display a list of errors and warnings.
      org.osgi.util.promise.Promise<java.lang.Integer> message​(java.lang.String title, java.lang.String message, java.lang.String[] buttons, int defaultIndex)
      Display a message and optionally a set of buttons.
      org.osgi.util.promise.Promise<java.lang.String> prompt​(java.lang.String title, java.lang.String query, java.lang.String initialValue, java.util.regex.Pattern validator)
      Display a dialog where the user can input a string.
    • Method Detail

      • message

        org.osgi.util.promise.Promise<java.lang.Integer> message​(java.lang.String title,
                                                                 java.lang.String message,
                                                                 java.lang.String[] buttons,
                                                                 int defaultIndex)
                                                          throws java.lang.Exception
        Display a message and optionally a set of buttons. Return the index of the selected button or -1 if the dialog was canceled.
        Parameters:
        title - The title of the dialog, must not be null
        message - The message displayed, must not be null
        buttons - A list of buttons, may be null
        defaultIndex - The default index. Must be -1 for none or between 0..n, where n is the number of buttons specified.
        Returns:
        -1 if canceled, otherwise the index of the given button that was pressed.
        Throws:
        java.lang.Exception
      • prompt

        org.osgi.util.promise.Promise<java.lang.String> prompt​(java.lang.String title,
                                                               java.lang.String query,
                                                               java.lang.String initialValue,
                                                               java.util.regex.Pattern validator)
                                                        throws java.lang.Exception
        Display a dialog where the user can input a string. An initial value can be supplied and a validator can optionally beused to validate any input. Either null is returned when the user cancels or a string with valid input.
        Parameters:
        title - The title of the dialog, must not be null
        query - The query displayed, must not be null
        initialValue - The initial value, can be null
        validator - A pattern that must match the input, can be null if no validator is necessary
        Returns:
        A string object or null if no input was given
        Throws:
        java.lang.Exception
      • errors

        void errors​(java.lang.String message,
                    aQute.service.reporter.Reporter reporter)
             throws java.lang.Exception
        Display a list of errors and warnings. This method will return immediately, it will not wait for the user to dismiss this window. Multiple calls might actually be aggregated into a single dialog
        Parameters:
        message - The message displayed, must not be null
        reporter - Contains the errors and warnings
        Throws:
        java.lang.Exception
      • createProgress

        Progress createProgress​(java.lang.String title)
                         throws java.lang.Exception
        Create a progress monitor
        Throws:
        java.lang.Exception