Carbide.c++

com.nokia.carbide.cdt.builder.builder
Class CarbideCommandLauncher

java.lang.Object
  extended by CommandLauncher
      extended by com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher

public class CarbideCommandLauncher
extends CommandLauncher

A utility class to handle windows process execution. This utility class handles all the execution, error processing, and console output.


Field Summary
protected  IConsole console
           
protected  ConsoleOutputStream consoleErrorStream
           
protected  ConsoleOutputStream consoleInfoStream
           
protected  ConsoleOutputStream consoleOutStream
           
protected  java.lang.String[] errorParserIds
           
protected  IMarkerGenerator markerGen
           
protected  IProgressMonitor monitor
           
protected  IProject project
           
protected  long startTime
           
protected  ErrorParserManager stderrStream
           
protected  ErrorParserManager stdoutStream
           
 
Constructor Summary
CarbideCommandLauncher(IProject project, IProgressMonitor monitor, IConsole console)
          Deprecated. use CarbideCommandLauncher(IProject, IProgressMonitor, String[], IPath) instead
CarbideCommandLauncher(IProject project, IProgressMonitor monitor, IConsole console, java.lang.String[] errorParserIds, IPath workingDir)
          Deprecated. don't pass in a console if you want to to get colored info/output/error streams. use CarbideCommandLauncher(IProject, IProgressMonitor, String[], IPath) instead, or pass in CUIPlugin.getDefault().getConsoleManager().getConsole(project)
CarbideCommandLauncher(IProject project, IProgressMonitor monitor, java.lang.String[] errorParserIds, IPath workingDir)
          Create an instance of the CarbideCommandLauncher with error parsing
 
Method Summary
 void addMarker(IResource file, int lineNumber, java.lang.String errorDesc, int severity, java.lang.String errorVar)
           
 void addMarker(ProblemMarkerInfo problemMarkerInfo)
           
 int executeCommand(IPath command, java.lang.String[] args, java.lang.String[] env, IPath workingDir)
          Executes a single command.
static IPath getCmdExeLocation()
          Deprecated. don't use cmd.exe for calling executeCommand. just use the process you want to call, e.g. abld.bat. There have been intermittent problems canceling the cmd.exe process.
 ConsoleOutputStream getConsoleOutputStream()
          Get the output stream for the console
 java.lang.String getTimingStats()
          Get a formatted string of total time since timer was started.
 IPath getWorkingDirectory()
          Returns the current working directory
 void init()
          Initialize variables.
 void setErrorParserManager(IPath workingDir, java.lang.String[] parserIDs)
          Sets up the core ErrorParserManager
 void startTimingStats()
          Sets the current system time as the starting time.
 void writeToConsole(java.lang.String msg)
          Write a message to the console
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

monitor

protected IProgressMonitor monitor

console

protected IConsole console

stdoutStream

protected ErrorParserManager stdoutStream

stderrStream

protected ErrorParserManager stderrStream

consoleOutStream

protected ConsoleOutputStream consoleOutStream

consoleErrorStream

protected ConsoleOutputStream consoleErrorStream

consoleInfoStream

protected ConsoleOutputStream consoleInfoStream

project

protected IProject project

errorParserIds

protected java.lang.String[] errorParserIds

markerGen

protected IMarkerGenerator markerGen

startTime

protected long startTime
Constructor Detail

CarbideCommandLauncher

public CarbideCommandLauncher(IProject project,
                              IProgressMonitor monitor,
                              IConsole console,
                              java.lang.String[] errorParserIds,
                              IPath workingDir)
Deprecated. don't pass in a console if you want to to get colored info/output/error streams. use CarbideCommandLauncher(IProject, IProgressMonitor, String[], IPath) instead, or pass in CUIPlugin.getDefault().getConsoleManager().getConsole(project)

Create an instance of the CarbideCommandLauncher with error parsing

Parameters:
carbideProjectInfo - - A valid ICarbideProjectInfo object interface
monitor - - The IProgressMonitor
console - - The console where output streams are written.
errorParserIds - - The list of error parser IDs used to parse the output streams. Can be null or empty array if no error parsing is required.
workingDir - - Location of program execution. Used init the ErrorParserManager

CarbideCommandLauncher

public CarbideCommandLauncher(IProject project,
                              IProgressMonitor monitor,
                              java.lang.String[] errorParserIds,
                              IPath workingDir)
Create an instance of the CarbideCommandLauncher with error parsing

Parameters:
carbideProjectInfo - - A valid ICarbideProjectInfo object interface
monitor - - The IProgressMonitor
errorParserIds - - The list of error parser IDs used to parse the output streams. Can be null or empty array if no error parsing is required.
workingDir - - Location of program execution. Used init the ErrorParserManager

CarbideCommandLauncher

public CarbideCommandLauncher(IProject project,
                              IProgressMonitor monitor,
                              IConsole console)
Deprecated. use CarbideCommandLauncher(IProject, IProgressMonitor, String[], IPath) instead

Create an instance of the CarbideCommandLauncher. No error parsing is done.

Parameters:
carbideProjectInfo - - A valid IProject object interface
monitor - - The IProgressMonitor
console - - The console where output streams are written.
Method Detail

init

public void init()
Initialize variables. Called by the constructor


setErrorParserManager

public void setErrorParserManager(IPath workingDir,
                                  java.lang.String[] parserIDs)
Sets up the core ErrorParserManager

Parameters:
workingDir - - Location where file paths will be computed from (e.g. relative paths)
parserIDs - - The ID of plugin.xml parser extension IDs to be called on the process execution for stderr and stdout

getConsoleOutputStream

public ConsoleOutputStream getConsoleOutputStream()
Get the output stream for the console

Returns:
ConcoleOutputStream object

writeToConsole

public void writeToConsole(java.lang.String msg)
Write a message to the console


executeCommand

public int executeCommand(IPath command,
                          java.lang.String[] args,
                          java.lang.String[] env,
                          IPath workingDir)
Executes a single command. Note that multiple calls of the same instance of this object to executeCommand should be followed by setErrorParserManager so that the console output stream is re-opened

Parameters:
command - - The tool to call
args - - argument array that 'command' consumes
env - - Full list of environment variables
workingDir - - The current working directory the command is to be invoked in.
Returns:
0 (zero) on success. returns the actual tool return status

startTimingStats

public void startTimingStats()
Sets the current system time as the starting time.

See Also:
getTimingStats()

getTimingStats

public java.lang.String getTimingStats()
Get a formatted string of total time since timer was started.

Returns:
A formatted string with time in seconds. If time is 0 and empty string is returned.

addMarker

public void addMarker(IResource file,
                      int lineNumber,
                      java.lang.String errorDesc,
                      int severity,
                      java.lang.String errorVar)

addMarker

public void addMarker(ProblemMarkerInfo problemMarkerInfo)

getCmdExeLocation

public static IPath getCmdExeLocation()
Deprecated. don't use cmd.exe for calling executeCommand. just use the process you want to call, e.g. abld.bat. There have been intermittent problems canceling the cmd.exe process.

Get the location of cmd.exe by querying the COMSPEC variable.

Returns:
The full path to cmd.exe

getWorkingDirectory

public IPath getWorkingDirectory()
Returns the current working directory

Since:
2.0

Carbide.c++