本文整理汇总了Java中org.eclipse.debug.core.model.IProcess.terminate方法的典型用法代码示例。如果您正苦于以下问题:Java IProcess.terminate方法的具体用法?Java IProcess.terminate怎么用?Java IProcess.terminate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.debug.core.model.IProcess
的用法示例。
在下文中一共展示了IProcess.terminate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeConsoleLaunch
import org.eclipse.debug.core.model.IProcess; //导入方法依赖的package包/类
/**
* Removes a launch from a pydev console and stops the related process (may be called from a thread).
*
* @param launch the launch to be removed
*/
public void removeConsoleLaunch(ILaunch launch) {
boolean removed;
synchronized (consoleLaunchesLock) {
removed = consoleLaunches.remove(launch);
}
if (removed) {
IProcess[] processes = launch.getProcesses();
if (processes != null) {
for (IProcess p : processes) {
try {
p.terminate();
} catch (Exception e) {
Log.log(e);
}
}
}
}
}
示例2: terminate
import org.eclipse.debug.core.model.IProcess; //导入方法依赖的package包/类
@Override
public void terminate() throws DebugException {
for (Iterator<IProcess> iter = processes.iterator(); iter.hasNext(); iter.remove()) {
IProcess p = iter.next();
if (p.canTerminate()) {
p.terminate();
}
}
for (Iterator<IDebugTarget> iter = targets.iterator(); iter.hasNext(); iter.remove()) {
IDebugTarget t = iter.next();
if (t.canTerminate()) {
t.terminate();
}
}
}
示例3: execSync
import org.eclipse.debug.core.model.IProcess; //导入方法依赖的package包/类
/**
* Executes the given commands synchronously.
*
* <p>
* If the workingDirectory is null, the current directory for process is used.
* </p>
* @param command the command line can not be null or empty
* @param workingDirectory working directory for the executed command, can be null
* @param outStreamListener listener for output, can be null
* @param errorStreamListene listener for error output, can be null
* @param envp environment variables to set in the process, can be null
* @param launchConfiguration the launch to add as part of this call, can be null
* @return the exit code for the process
* @throws CoreException if the execution fails
*/
public int execSync ( String[] command, File workingDirectory,
IStreamListener outStreamListener,
IStreamListener errorStreamListener, IProgressMonitor monitor,
String[] envp, ILaunchConfiguration launchConfiguration) throws CoreException{
if(monitor == null){
monitor = new NullProgressMonitor();
}
HybridCore.trace("Sync Execute command line: "+Arrays.toString(command));
IProcess prcs = exec(command, workingDirectory, monitor, envp, launchConfiguration,outStreamListener,errorStreamListener);
if(prcs == null ){
return 0;
}
while (!prcs.isTerminated()) {
try {
if (monitor.isCanceled()) {
prcs.terminate();
break;
}
Thread.sleep(50);
} catch (InterruptedException e) {
HybridCore.log(IStatus.INFO, "Exception waiting for process to terminate", e);
}
}
return prcs.getExitValue();
}