站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

CommandProcessor (NetBeans VCS API) - NetBeans API Javadoc 4.1.0

 

org.netbeans.modules.vcscore.commands
Class CommandProcessor

java.lang.Object
  extended byorg.netbeans.modules.vcscore.commands.CommandProcessor

public class CommandProcessor
extends Object

This class is used as a container of all external commands which are either running or finished.


Field Summary
static int PREPROCESS_CANCELLED
          The preprocessing of the command was cancelled.
static int PREPROCESS_DONE
          The preprocessing is done.
static int PREPROCESS_NEXT_FILE
          When there are more files selected, the preprocessing needs to be done for next files again.
 
Method Summary
 void addCommandProcessListener(CommandProcessListener listener)
          Add a command listener.
 void cleanup()
          This stops the execution starter loop.
protected  void finalize()
           
 long getExecutionTime(CommandTask task)
          The execution time of the command or zero, when the command did not finish yet or can not be found.
static String getExitStatusString(int exit)
          Get the localized string representation of the command exit status.
 long getFinishTime(CommandTask task)
          The finish time of the command or zero, when the command did not finish yet or can not be found.
static CommandProcessor getInstance()
          Get the instance of CommandProcessor.
 CommandTask getParentTask(CommandTask task)
          Get the parent task if any.
 String[] getRunningCommandsLabels()
          Get display names of running commands.
 long getStartTime(CommandTask task)
          The start time of the command or zero, when the command was not started yet or can not be found.
 long getTaskID(CommandTask task)
          Get the task's ID.
 boolean isRunning(CommandTask task)
          Tells whether the executor is still running.
 boolean isSomeRunning()
          Whether some command is still running.
 boolean isWaiting(CommandTask task)
          Tells whether a task is waiting.
 void kill(CommandTask task)
          Kill the executor if it is running.
 void killAll()
          Kill all running executors.
 void preprocess(Command cmd)
          Pre-process the task.
 boolean preprocessSynchronous(Command cmd)
          Pre-process the task.
 void process(CommandTaskInfo info)
          Process the task.
 void removeCommandProcessListener(CommandProcessListener listener)
          Remove a command listener.
 void waitToFinish(Command cmd, Set files)
          Wait to finish the execution of command on a set of files.
 void waitToFinish(CommandTask task)
          Wait to finish the task.
 void waitToFinish(long taskID)
          Wait to finish the task of a specific ID.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREPROCESS_CANCELLED

public static final int PREPROCESS_CANCELLED
The preprocessing of the command was cancelled. The command will not be executed.

See Also:
Constant Field Values

PREPROCESS_NEXT_FILE

public static final int PREPROCESS_NEXT_FILE
When there are more files selected, the preprocessing needs to be done for next files again. The command will run on the first file, preprocessing will be done for the rest.

See Also:
Constant Field Values

PREPROCESS_DONE

public static final int PREPROCESS_DONE
The preprocessing is done. When more files are selected, the command will not be preprocessed for the rest of them.

See Also:
Constant Field Values
Method Detail

getInstance

public static CommandProcessor getInstance()
Get the instance of CommandProcessor.


finalize

protected void finalize()

cleanup

public void cleanup()
This stops the execution starter loop. You will not be able to execute any command by CommandProcessor after this method finishes !


getTaskID

public long getTaskID(CommandTask task)
Get the task's ID. It's a unique task identification number.

Parameters:
task - The task
Returns:
the ID or -1 if the task does not have one.

getParentTask

public CommandTask getParentTask(CommandTask task)
Get the parent task if any. Parent task is the task that executed the child task.

Parameters:
task - The task.
Returns:
It's parent task or null when there is no parent task.

preprocessSynchronous

public boolean preprocessSynchronous(Command cmd)
Pre-process the task. This will show the command's customizer (if any) and return the status. This method will block until the customization process is finished. This was made to be called from AWT thread. Use preprocess(org.netbeans.api.vcs.commands.Command) method in other cases.


preprocess

public void preprocess(Command cmd)
Pre-process the task. This will do the preprocess in the background. It will show the command's customizer, if any.


process

public void process(CommandTaskInfo info)
Process the task. This will schedule the task for execution.


isSomeRunning

public boolean isSomeRunning()
Whether some command is still running.

Returns:
true when at least one command is running, false otherwise.

isWaiting

public boolean isWaiting(CommandTask task)
Tells whether a task is waiting. It can either wait till preprocessing finishes or till other commands which can not run in parallel with it finish.

Parameters:
task - The task

isRunning

public boolean isRunning(CommandTask task)
Tells whether the executor is still running.

Parameters:
task - The task

getRunningCommandsLabels

public String[] getRunningCommandsLabels()
Get display names of running commands.


waitToFinish

public void waitToFinish(Command cmd,
                         Set files)
                  throws InterruptedException
Wait to finish the execution of command on a set of files. This methods blocks the current thread untill no task of the command is running on any of provided files.

Parameters:
cmd - the command we wait for to finish
files - the set of files of type FileObject
Throws:
InterruptedException

waitToFinish

public void waitToFinish(CommandTask task)
                  throws InterruptedException
Wait to finish the task. This methods blocks the current thread untill the task finishes.

Parameters:
task - the command task
Throws:
InterruptedException

waitToFinish

public void waitToFinish(long taskID)
                  throws InterruptedException
Wait to finish the task of a specific ID. This methods blocks the current thread untill the task finishes.

Parameters:
taskID - the command task ID.
Throws:
InterruptedException

killAll

public void killAll()
Kill all running executors. It tries to interrupt them, it is up to executor implementations if they will terminate or not.


kill

public void kill(CommandTask task)
Kill the executor if it is running. It tries to interrupt it, it is up to executor implementation if it will terminate or not.


addCommandProcessListener

public void addCommandProcessListener(CommandProcessListener listener)
Add a command listener.


removeCommandProcessListener

public void removeCommandProcessListener(CommandProcessListener listener)
Remove a command listener.


getStartTime

public long getStartTime(CommandTask task)
The start time of the command or zero, when the command was not started yet or can not be found.


getFinishTime

public long getFinishTime(CommandTask task)
The finish time of the command or zero, when the command did not finish yet or can not be found.


getExecutionTime

public long getExecutionTime(CommandTask task)
The execution time of the command or zero, when the command did not finish yet or can not be found.


getExitStatusString

public static String getExitStatusString(int exit)
Get the localized string representation of the command exit status.

Parameters:
exit - the exit status, that will be converted to the string.

 

Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.