Interface Console

All Superinterfaces:
ProgressInterface

public interface Console extends ProgressInterface
A Console object allows you to display information to the user and request input when the installer or uninstaller is running in console mode. Installers or uninstallers must be started with the "-c" argument in order to run in console mode. A console object is passed to the handleConsole methods of screens and form components.
See Also:
  • Method Details

    • print

      void print(Object val)
      Print an object to the console by invoking its toString() method.
      Parameters:
      val - the object to be printed
    • println

      void println(Object val)
      Print an object to the console by invoking its toString() method and append a line feed.
      Parameters:
      val - the object to be printed
    • println

      void println()
      Print a line feed to the console.
    • more

      void more(@Nls String text) throws UserCanceledException
      Print a long text to the console and partition it into pages. Line breaks are introduced after 75 characters and a "more" notice is printed every 25 lines.
      Parameters:
      text - the text
      Throws:
      UserCanceledException - if the user cancels the "more" notice, typically with CTRL-C
    • readLine

      String readLine() throws UserCanceledException
      Read input from the console.
      Returns:
      the string that was entered by the user.
      Throws:
      UserCanceledException - if the user cancels the prompt, typically with CTRL-C
    • askYesNo

      boolean askYesNo(@Nls String message) throws UserCanceledException
      Ask the user a question that has to be answered with "Yes" or "No". There is no default value.
      Parameters:
      message - the question
      Returns:
      whether the user answered "Yes"
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C
    • askYesNo

      boolean askYesNo(@Nls String message, boolean defaultValue) throws UserCanceledException
      Ask the user a question that has to be answered with "Yes" or "No". The default value is configurable.
      Parameters:
      message - the question
      defaultValue - whether "Yes" is the default value
      Returns:
      whether the user answered "Yes"
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C
    • askOkCancel

      boolean askOkCancel(@Nls String message) throws UserCanceledException
      Ask the user a question that has to be answered with "OK" or "Cancel". There is no default value.
      Parameters:
      message - the question
      Returns:
      whether the user answered "OK"
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C. Note that this is different from a "Cancel" answer.
    • askOkCancel

      boolean askOkCancel(@Nls String message, boolean defaultValue) throws UserCanceledException
      Ask the user a question that has to be answered with "OK" or "Cancel". The default value is configurable.
      Parameters:
      message - the question
      defaultValue - whether "OK" is the default value
      Returns:
      whether the user answered "OK"
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C. Note that this is different from a "Cancel" answer.
    • askOption

      int askOption(@Nls String message, @Nls String[] descriptions, String[] keys) throws UserCanceledException
      Ask the user a question with a fixed set of answers. There is no default value.
      Parameters:
      message - the question
      descriptions - an array with a textual description for each option
      keys - an array with a short key for each option. Keys are what the user enters to select the desired option.
      Returns:
      the selected index of the option
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C.
    • askOption

      int askOption(@Nls String message, @Nls String[] descriptions, String[] keys, int defaultValue) throws UserCanceledException
      Ask the user a question with a fixed set of answers. The default value is configurable.
      Parameters:
      message - the question
      descriptions - an array with a textual description for each option
      keys - an array with a short key for each option. Keys are what the user enters to select the desired option.
      defaultValue - the index of the default option
      Returns:
      the selected index of the option
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C.
    • askOption

      int askOption(@Nls String message, @Nls String[] descriptions, String[] keys, int defaultValue, boolean allowNoSelection, boolean oneLinePerOption) throws UserCanceledException
      Ask the user a question with a fixed set of answers. The default value, the no-selection policy as well as the presentation of the options are configurable.
      Parameters:
      message - the question
      descriptions - an array with a textual description for each option
      keys - an array with a short key for each option. Keys are what the user enters to select the desired option.
      defaultValue - the index of the default option
      allowNoSelection - if the question should allow an empty answer, the return value is -1 in that case.
      oneLinePerOption - if the options should be presented on option per line. By default, all options are presented on the same line.
      Returns:
      the index of the selected option or -1 if no answer is given.
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C.
    • askOption

      int askOption(@Nls String message, @Nls String[] descriptions, String[] keys, @Nls String[] helpTexts, int defaultValue, boolean allowNoSelection, boolean oneLinePerOption) throws UserCanceledException
      Ask the user a question with a fixed set of answers. The default value, the help texts, the no-selection policy as well as the presentation of the options are configurable.
      Parameters:
      message - the question
      descriptions - an array with a textual description for each option
      keys - an array with a short key for each option. Keys are what the user enters to select the desired option.
      helpTexts - an array with help texts that can be shown by the user, array elements can be null for no help
      defaultValue - the index of the default option
      allowNoSelection - if the question should allow an empty answer, the return value is -1 in that case.
      oneLinePerOption - if the options should be presented on option per line. By default, all options are presented on the same line.
      Returns:
      the index of the selected option or -1 if no answer is given.
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C.
    • askMultipleSelection

      int[] askMultipleSelection(@Nls String message, @Nls String[] descriptions, String[] keys, int[] defaultValues, boolean oneLinePerOption) throws UserCanceledException
      Ask the user to select multiple elements from a list of options. The default selection, and the presentation of the options are configurable.
      Parameters:
      message - the question
      descriptions - an array with a textual description for each option
      keys - an array with a short key for each option. Keys are what the user enters to select the desired options.
      defaultValues - an array with the indices of the options that are selected by default
      oneLinePerOption - if the options should be presented on option per line. By default, all options are presented on the same line.
      Returns:
      an array with the indices of the selected options. The length of the array can be 0 if no options were selected.
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C.
    • askString

      String askString(@Nls String message, String defaultValue) throws UserCanceledException
      Ask the user to enter a string with a default string that can be accepted by the user.
      Parameters:
      message - the prompt before the input
      defaultValue - the default string
      Returns:
      the string entered by the user or the default value if the user hits the Enter key.
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C.
    • askPassword

      String askPassword(@Nls String message, String defaultValue) throws UserCanceledException
      Ask the user to enter a password.
      Parameters:
      message - the prompt before the input
      defaultValue - the default string
      Returns:
      the string entered by the user or the default value if the user hits the Enter key.
      Throws:
      UserCanceledException - if the user cancels the question, typically with CTRL-C.
    • waitForEnter

      void waitForEnter() throws UserCanceledException
      Print [Enter] to the console and wait for the user to hit the Enter key.
      Throws:
      UserCanceledException - if the user cancels the notice, typically with CTRL-C.
    • printHeader

      void printHeader(@Nls String title) throws UserCanceledException
      Print the header for a new screen. This invokes the "Console screen change handler" that is set for the application node on the Screens & Actions tab. If that script is not configured, nothing will be printed.
      Parameters:
      title - the title
      Throws:
      UserCanceledException - if the user cancels the notice, typically with CTRL-C.