Module cli
Package de.grogra.cli

Class CLIApplication

All Implemented Interfaces:
RegistryContext, Command

public class CLIApplication extends UIApplication
  • Field Details

  • Constructor Details

    • CLIApplication

      public CLIApplication()
  • Method Details

    • getInstance

      public static CLIApplication getInstance()
    • getCurrentWorkbench

      public Workbench getCurrentWorkbench()
      Description copied from class: UIApplication
      Get the last selected workbench by the application
      Specified by:
      getCurrentWorkbench in class UIApplication
      Returns:
      The current workbench for this application
    • getCommandName

      public String getCommandName()
      Description copied from interface: Command
      Returns a name which can be used in the graphical user interface to represent this command.
      Returns:
      this commands's name
    • getWorkingDirectory

      public File getWorkingDirectory()
    • setWorkingDirectory

      public void setWorkingDirectory(File workingDirectory)
      requires a mainworkbench
      Parameters:
      workingDirectory -
    • run

      public static void run(Application app)
    • run

      public void run(Object arg, Context context)
      Description copied from interface: Command
      Performs the actions of this command. This method is invoked by the JobManager after the command has been submitted to the job manager by one of execute, runAt, or runLater-methods. The arguments info and context are the arguments which have been provided as arguments to the JobManager-methods.
      Specified by:
      run in interface Command
      Overrides:
      run in class UIApplication
      Parameters:
      arg - an argument
      context - a context
    • startUIApp

      protected void startUIApp()
    • println

      public void println(String out)
    • print

      public void print(String out)
    • println

      public void println(Object out)
    • print

      public void print(Object out)
    • flush

      public void flush()
    • updateLoadingPrompt

      public void updateLoadingPrompt(String rightPrompt)
    • updatePrompt

      public void updatePrompt()
    • updateCLICompleters

      public void updateCLICompleters()
    • setupCompleters

      public org.jline.reader.Completer setupCompleters()
    • updateReader

      public void updateReader()
    • setPROMPT

      public void setPROMPT(String s)
    • setFileToEdit

      public void setFileToEdit(File f, String n)
    • canReadValue

      public boolean canReadValue()
      Check if the thread is allowed to readlines for requesting values in the terminal Only the commands that blocks the terminal should be allowed to write value
    • exit

      public void exit()
      exit the application
      Specified by:
      exit in class UIApplication
    • getTerminalInput

      public Object getTerminalInput() throws org.jline.reader.UserInterruptException, org.jline.reader.EndOfFileException
      Throws:
      org.jline.reader.UserInterruptException
      org.jline.reader.EndOfFileException
    • startConsoleFileEditor

      public void startConsoleFileEditor() throws org.jline.reader.UserInterruptException, org.jline.reader.EndOfFileException
      Throws:
      org.jline.reader.UserInterruptException
      org.jline.reader.EndOfFileException
    • open

      public ProjectWorkbench open(Object info, Command afterCommand)
      Open a project in a new workbench.
      Parameters:
      info - : A String that is either the absolute path to a project to open, or a relative path using the working directory as base. See more #changeDirectory(Object).
    • open

      public ProjectWorkbench open(Object info)
      Specified by:
      open in class UIApplication
    • open

      public ProjectWorkbench open(FilterSource fs, Map initParams)
      Specified by:
      open in class UIApplication
    • selectWorkbench

      protected void selectWorkbench(Object info)
      Set a workbench as selected (i.e. current) from its id.
      Specified by:
      selectWorkbench in class UIApplication
      Parameters:
      info - : a String that represent the id of the workbench to select (i.e. select as current workbench).
    • listWorkbenches

      public void listWorkbenches(Object info)
      print the list of currently opened workbenches by the application.
      Specified by:
      listWorkbenches in class UIApplication
      Parameters:
      info - : not used -
    • listProjects

      public void listProjects(Object info)
      print the list of currently opened projects by the application.
      Specified by:
      listProjects in class UIApplication
      Parameters:
      info - : not used -
    • runXLConsole

      public static void runXLConsole(Item item, Object info, Context ctx)
    • close

      public void close(Object info)
      Close a workbench and deregister (disconnect) its project.
      Specified by:
      close in class UIApplication
    • closeWB

      public static void closeWB(Item item, Object info, Context ctx)
    • create

      public void create(Object info, Command afterCommand) throws IOException
      Throws:
      IOException
    • create

      public void create(Object info) throws IOException
      Create a new workbench with a new project.
      Specified by:
      create in class UIApplication
      Throws:
      IOException
    • loadExample

      public void loadExample(Object info, Command afterCommand)
    • loadExample

      public void loadExample(Object info)
      Specified by:
      loadExample in class UIApplication
    • listExamples

      public void listExamples(Object info)
      Specified by:
      listExamples in class UIApplication
    • listTemplates

      public void listTemplates(Object info)
      Specified by:
      listTemplates in class UIApplication
    • stop

      public void stop()
      Terminate the application. It closes all opened workbenches managed by its wbm. Close workbenches do not necessarily close the projects.
      Specified by:
      stop in class UIApplication
    • getSysFileCompleter

      public org.jline.reader.Completer getSysFileCompleter()
    • runScript

      public static void runScript(Item item, Object info, Context ctx)
    • isExecuting

      public boolean isExecuting()
    • getExecutionLock

      public Object getExecutionLock()