Enum Class Terminal

java.lang.Object
java.lang.Enum<Terminal>
org.matwoess.jsourceprofiler.fxui.model.Terminal
All Implemented Interfaces:
Serializable, Comparable<Terminal>, Constable

public enum Terminal extends Enum<Terminal>
A class enumerating all supported terminal applications. Each terminal has its own way to wrap commands and how to call it.
  • Enum Constant Details

    • WINDOWS_CMD

      public static final Terminal WINDOWS_CMD
      The Windows Command Prompt.
    • WINDOWS_POWERSHELL

      public static final Terminal WINDOWS_POWERSHELL
      The Windows PowerShell.
    • GNOME_TERMINAL

      public static final Terminal GNOME_TERMINAL
      The GNOME Terminal.
    • GNOME_CONSOLE

      public static final Terminal GNOME_CONSOLE
      The GNOME Console.
    • KDE_KONSOLE

      public static final Terminal KDE_KONSOLE
      The KDE Konsole.
    • MACOS_TERMINAL

      public static final Terminal MACOS_TERMINAL
      The macOS Terminal.
  • Method Details

    • values

      public static Terminal[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Terminal valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • wrapWithTerminalCommand

      public String[] wrapWithTerminalCommand(String cmdString, Path pwd)
      Wraps the given cmdString into an OS and terminal dependent command line. The result can be passed to a ProcessBuilder to open a terminal and run the command, allowing user input and showing process output.
      Parameters:
      cmdString - the command to be executed in the terminal
      pwd - the directory the terminal should run in
      Returns:
      the array of strings forming the final executed command by the terminal
    • getSystemTerminalOptions

      public static Terminal[] getSystemTerminalOptions()
      Gets the available terminal application options, depending on the current OS.
      Returns:
      the array of available terminal applications
    • getDefaultSystemTerminal

      public static Terminal getDefaultSystemTerminal()
      Returns the default terminal application for the current operating system.
      Returns:
      the first entry of the available terminal applications
    • toString

      public String toString()
      Returns the string representation name of the terminal application.
      Overrides:
      toString in class Enum<Terminal>
      Returns:
      the string representation name of the terminal application