Interface ICommandLauncher

  • All Known Implementing Classes:
    CommandLauncher

    public interface ICommandLauncher
    An interface for launchers of external commands.
    Since:
    5.1
    • Method Detail

      • setProject

        void setProject​(org.eclipse.core.resources.IProject project)
        Sets the project that this launcher is associated with, or null if there is no such project.
        Parameters:
        project -
      • getProject

        org.eclipse.core.resources.IProject getProject()
        Gets the project this launcher is associated with.
        Returns:
        IProject, or null if there is no such project.
      • showCommand

        void showCommand​(boolean show)
        Sets if the command should be printed out first before executing.
      • getErrorMessage

        String getErrorMessage()
        Returns a human readable error message corresponding to the last error encountered during command execution.
        Returns:
        A String corresponding to the error, or null if there has been no error. The message could be multi-line, however it is NOT guaranteed that it ends with end of line.
      • setErrorMessage

        void setErrorMessage​(String error)
        Sets the human readable error message corresponding to the last error encountered during command execution. A subsequent call to getErrorMessage() will return this string.
        Parameters:
        error - A String corresponding to the error message, or null if the error state is intended to be cleared.
      • getCommandArgs

        String[] getCommandArgs()
        Returns an array of the command line arguments that were last used to execute a command.
        Returns:
        an array of type String[] corresponding to the arguments. The array can be empty, but should not be null.
      • getEnvironment

        Properties getEnvironment()
        Returns the set of environment variables in the context of which this launcher will execute commands.
        Returns:
        Properties
      • getCommandLine

        String getCommandLine()
        Returns the constructed command line of the last command executed.
        Returns:
        String
      • execute

        Process execute​(org.eclipse.core.runtime.IPath commandPath,
                        String[] args,
                        String[] env,
                        org.eclipse.core.runtime.IPath workingDirectory,
                        org.eclipse.core.runtime.IProgressMonitor monitor)
                 throws org.eclipse.core.runtime.CoreException
        Execute a command
        Parameters:
        env - The list of environment variables in variable=value format.
        Throws:
        org.eclipse.core.runtime.CoreException - if there is an error executing the command.
      • waitAndRead

        int waitAndRead​(OutputStream output,
                        OutputStream err,
                        org.eclipse.core.runtime.IProgressMonitor monitor)
        Reads output form the process to the streams. A progress monitor is polled to test if the cancel button has been pressed. Destroys the process if the monitor becomes canceled override to implement a different way to read the process inputs