本文整理汇总了Java中com.intellij.execution.process.ProcessHandler.destroyProcess方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessHandler.destroyProcess方法的具体用法?Java ProcessHandler.destroyProcess怎么用?Java ProcessHandler.destroyProcess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.process.ProcessHandler
的用法示例。
在下文中一共展示了ProcessHandler.destroyProcess方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopProcess
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
public static void stopProcess(@Nullable ProcessHandler processHandler) {
if (processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
// process termination was requested, but it's still alive
// in this case 'force quit' will be performed
((KillableProcess)processHandler).killProcess();
return;
}
if (processHandler != null) {
if (processHandler.detachIsDefault()) {
processHandler.detachProcess();
}
else {
processHandler.destroyProcess();
}
}
}
示例2: stop
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
private static void stop(@Nullable RunContentDescriptor descriptor) {
ProcessHandler processHandler = descriptor != null ? descriptor.getProcessHandler() : null;
if (processHandler == null) {
return;
}
if (processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
((KillableProcess)processHandler).killProcess();
return;
}
if (!processHandler.isProcessTerminated()) {
if (processHandler.detachIsDefault()) {
processHandler.detachProcess();
}
else {
processHandler.destroyProcess();
}
}
}
示例3: stop
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
@Override
public void stop() {
ProcessHandler processHandler = myDebugProcess.getProcessHandler();
if (processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) return;
if (processHandler.detachIsDefault()) {
processHandler.detachProcess();
}
else {
processHandler.destroyProcess();
}
}
示例4: stopProcess
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
private static void stopProcess(@Nullable RunContentDescriptor descriptor) {
ProcessHandler processHandler = descriptor != null ? descriptor.getProcessHandler() : null;
if (processHandler == null) return;
if (processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
((KillableProcess)processHandler).killProcess();
return;
}
if (processHandler.detachIsDefault()) {
processHandler.detachProcess();
}
else {
processHandler.destroyProcess();
}
}
示例5: createTimeLimitedExecutionProcess
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
private static Runnable createTimeLimitedExecutionProcess(final ProcessHandler processHandler,
final ExecutionMode mode,
@NotNull final String presentableCmdline) {
return new Runnable() {
private final Semaphore mySemaphore = new Semaphore();
private final Runnable myProcessThread = new Runnable() {
@Override
public void run() {
try {
final boolean finished = processHandler.waitFor(1000 * mode.getTimeout());
if (!finished) {
mode.getTimeoutCallback().consume(mode, presentableCmdline);
processHandler.destroyProcess();
}
}
finally {
mySemaphore.up();
}
}
};
@Override
public void run() {
mySemaphore.down();
ApplicationManager.getApplication().executeOnPooledThread(myProcessThread);
mySemaphore.waitFor();
}
};
}
示例6: closeQuery
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
private boolean closeQuery(boolean modal) {
final RunContentDescriptor descriptor = getRunContentDescriptorByContent(myContent);
if (descriptor == null) {
return true;
}
final ProcessHandler processHandler = descriptor.getProcessHandler();
if (processHandler == null || processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) {
return true;
}
final boolean destroyProcess;
//noinspection deprecation
if (processHandler.isSilentlyDestroyOnClose() || Boolean.TRUE.equals(processHandler.getUserData(ProcessHandler.SILENTLY_DESTROY_ON_CLOSE))) {
destroyProcess = true;
}
else {
//todo[nik] this is a temporary solution for the following problem: some configurations should not allow user to choose between 'terminating' and 'detaching'
final boolean useDefault = Boolean.TRUE.equals(processHandler.getUserData(ALWAYS_USE_DEFAULT_STOPPING_BEHAVIOUR_KEY));
final TerminateRemoteProcessDialog.TerminateOption option = new TerminateRemoteProcessDialog.TerminateOption(processHandler.detachIsDefault(), useDefault);
final int rc = TerminateRemoteProcessDialog.show(myProject, descriptor.getDisplayName(), option);
if (rc != DialogWrapper.OK_EXIT_CODE) return false;
destroyProcess = !option.isToBeShown();
}
if (destroyProcess) {
processHandler.destroyProcess();
}
else {
processHandler.detachProcess();
}
waitForProcess(descriptor, modal);
return true;
}
示例7: testRunEnded
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
@Override
public void testRunEnded(long elapsedTime, Map<String, String> runMetrics) {
if (myTestClassName != null) {
testSuiteFinished();
}
final ProcessHandler handler = getProcessHandler();
handler.notifyTextAvailable("Finish\n", ProcessOutputTypes.STDOUT);
handler.destroyProcess();
}
示例8: createCancelableExecutionProcess
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
private static Runnable createCancelableExecutionProcess(final ProcessHandler processHandler,
final Function<Object, Boolean> cancelableFun) {
return new Runnable() {
private ProgressIndicator myProgressIndicator;
private final Semaphore mySemaphore = new Semaphore();
private final Runnable myWaitThread = new Runnable() {
@Override
public void run() {
try {
processHandler.waitFor();
}
finally {
mySemaphore.up();
}
}
};
private final Runnable myCancelListener = new Runnable() {
@Override
public void run() {
while (true) {
if ((myProgressIndicator != null && (myProgressIndicator.isCanceled()
|| !myProgressIndicator.isRunning()))
|| (cancelableFun != null && cancelableFun.fun(null).booleanValue())
|| processHandler.isProcessTerminated()) {
if (!processHandler.isProcessTerminated()) {
try {
processHandler.destroyProcess();
}
finally {
mySemaphore.up();
}
}
break;
}
try {
synchronized (this) {
wait(1000);
}
}
catch (InterruptedException e) {
//Do nothing
}
}
}
};
@Override
public void run() {
myProgressIndicator = ProgressManager.getInstance().getProgressIndicator();
if (myProgressIndicator != null && StringUtil.isEmpty(myProgressIndicator.getText())) {
myProgressIndicator.setText("Please wait...");
}
LOG.assertTrue(myProgressIndicator != null || cancelableFun != null,
"Cancelable process must have an opportunity to be canceled!");
mySemaphore.down();
ApplicationManager.getApplication().executeOnPooledThread(myWaitThread);
ApplicationManager.getApplication().executeOnPooledThread(myCancelListener);
mySemaphore.waitFor();
}
};
}
示例9: disposeProcess
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
protected void disposeProcess(ProcessHandler h) throws InterruptedException {
h.destroyProcess();
if (!waitFor(h)) {
new Throwable("Can't stop process").printStackTrace();
}
}
示例10: testRunStopped
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
@Override
public void testRunStopped(long elapsedTime) {
ProcessHandler handler = getProcessHandler();
handler.notifyTextAvailable("Test running stopped\n", ProcessOutputTypes.STDOUT);
handler.destroyProcess();
}
示例11: testRunFailed
import com.intellij.execution.process.ProcessHandler; //导入方法依赖的package包/类
@Override
public void testRunFailed(String errorMessage) {
ProcessHandler handler = getProcessHandler();
handler.notifyTextAvailable("Test running failed: " + errorMessage + "\n", ProcessOutputTypes.STDERR);
handler.destroyProcess();
}