當前位置: 首頁>>代碼示例>>Java>>正文


Java ProcessHandler.isProcessTerminated方法代碼示例

本文整理匯總了Java中com.intellij.execution.process.ProcessHandler.isProcessTerminated方法的典型用法代碼示例。如果您正苦於以下問題:Java ProcessHandler.isProcessTerminated方法的具體用法?Java ProcessHandler.isProcessTerminated怎麽用?Java ProcessHandler.isProcessTerminated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.execution.process.ProcessHandler的用法示例。


在下文中一共展示了ProcessHandler.isProcessTerminated方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
public static void update(@NotNull Presentation presentation,
                          @NotNull Presentation templatePresentation,
                          @Nullable ProcessHandler processHandler) {
  boolean enable = false;
  Icon icon = templatePresentation.getIcon();
  String description = templatePresentation.getDescription();
  if (processHandler != null && !processHandler.isProcessTerminated()) {
    enable = true;
    if (processHandler.isProcessTerminating() && processHandler instanceof KillableProcess) {
      KillableProcess killableProcess = (KillableProcess) processHandler;
      if (killableProcess.canKillProcess()) {
        // 'force quite' action presentation
        icon = AllIcons.Debugger.KillProcess;
        description = "Kill process";
      }
    }
  }
  presentation.setEnabled(enable);
  presentation.setIcon(icon);
  presentation.setDescription(description);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:StopProcessAction.java

示例2: actionPerformed

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
  RunContentDescriptor descriptor = StopAction.getRecentlyStartedContentDescriptor(e.getDataContext());
  ProcessHandler activeProcessHandler = descriptor != null ? descriptor.getProcessHandler() : null;
  if (activeProcessHandler == null || activeProcessHandler.isProcessTerminated()) return;

  try {
    OutputStream input = activeProcessHandler.getProcessInput();
    if (input != null) {
      ConsoleView console = e.getData(LangDataKeys.CONSOLE_VIEW);
      if (console != null) {
        console.print("^D\n", ConsoleViewContentType.SYSTEM_OUTPUT);
      }
      input.close();
    }
  }
  catch (IOException ignored) {
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:EOFAction.java

示例3: 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();
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:ExecutionManagerImpl.java

示例4: disposeDebugProcess

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
@Override
protected void disposeDebugProcess() throws InterruptedException {
  if (myDebugProcess != null) {
    ProcessHandler processHandler = myDebugProcess.getProcessHandler();

    myDebugProcess.stop();

    waitFor(processHandler);

    if (!processHandler.isProcessTerminated()) {
      killDebugProcess();
      if (!waitFor(processHandler)) {
        new Throwable("Cannot stop debugger process").printStackTrace();
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:PyDebuggerTask.java

示例5: hasRunningProcess

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
private static boolean hasRunningProcess(Project project) {
  for (ProcessHandler handler : ExecutionManager.getInstance(project).getRunningProcesses()) {
    if (!handler.isProcessTerminated() && !ALLOW_AUTOMAKE.get(handler, Boolean.FALSE)) { // active process
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:BuildManager.java

示例6: restartIfActive

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
public static void restartIfActive(@NotNull RunContentDescriptor descriptor) {
  ProcessHandler processHandler = descriptor.getProcessHandler();
  if (processHandler != null
      && processHandler.isStartNotified()
      && !processHandler.isProcessTerminating()
      && !processHandler.isProcessTerminated()) {
    restart(descriptor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ExecutionUtil.java

示例7: restartAutoTest

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
private static void restartAutoTest(@NotNull RunContentDescriptor descriptor,
                                    int modificationStamp,
                                    @NotNull DelayedDocumentWatcher documentWatcher) {
  ProcessHandler processHandler = descriptor.getProcessHandler();
  if (processHandler != null && !processHandler.isProcessTerminated()) {
    scheduleRestartOnTermination(descriptor, processHandler, modificationStamp, documentWatcher);
  }
  else {
    restart(descriptor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:AutoTestManager.java

示例8: 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();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:XDebugSessionImpl.java

示例9: askForClosingDebugSessions

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
private static boolean askForClosingDebugSessions(@NotNull Project project) {
  final List<Pair<ProcessHandler, RunContentDescriptor>> pairs = new ArrayList<Pair<ProcessHandler, RunContentDescriptor>>();

  for (Project p : ProjectManager.getInstance().getOpenProjects()) {
    final ProcessHandler[] processes = ExecutionManager.getInstance(p).getRunningProcesses();

    for (ProcessHandler process : processes) {
      if (!process.isProcessTerminated()) {
        final AndroidSessionInfo info = process.getUserData(AndroidDebugRunner.ANDROID_SESSION_INFO);
        if (info != null) {
          pairs.add(Pair.create(process, info.getDescriptor()));
        }
      }
    }
  }

  if (pairs.size() == 0) {
    return true;
  }

  final StringBuilder s = new StringBuilder();

  for (Pair<ProcessHandler, RunContentDescriptor> pair : pairs) {
    if (s.length() > 0) {
      s.append('\n');
    }
    s.append(pair.getSecond().getDisplayName());
  }

  final int r = Messages.showYesNoDialog(project, AndroidBundle.message("android.debug.sessions.will.be.closed", s),
                                         AndroidBundle.message("android.disable.adb.service.title"), Messages.getQuestionIcon());
  return r == Messages.YES;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:AndroidEnableAdbServiceAction.java

示例10: isEnabled

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
private boolean isEnabled() {
  if (myModule == null || myModule.isDisposed()) return false;

  final ProcessHandler processHandler = myContentDescriptor.getProcessHandler();
  if (processHandler == null || processHandler.isProcessTerminated()) return false;

  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:BuildAndRestartConsoleAction.java

示例11: 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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:RunContentManagerImpl.java

示例12: getRunningDescriptors

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
@NotNull
public List<RunContentDescriptor> getRunningDescriptors(@NotNull Condition<RunnerAndConfigurationSettings> condition) {
  List<RunContentDescriptor> result = new SmartList<RunContentDescriptor>();
  for (Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor> trinity : myRunningConfigurations) {
    if (condition.value(trinity.getSecond())) {
      ProcessHandler processHandler = trinity.getFirst().getProcessHandler();
      if (processHandler != null /*&& !processHandler.isProcessTerminating()*/ && !processHandler.isProcessTerminated()) {
        result.add(trinity.getFirst());
      }
    }
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ExecutionManagerImpl.java

示例13: BrowserStarter

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
public BrowserStarter(@NotNull RunConfiguration runConfiguration,
                      @NotNull StartBrowserSettings settings,
                      @NotNull final ProcessHandler serverProcessHandler) {
  this(runConfiguration, settings, new Computable<Boolean>() {

    @Override
    public Boolean compute() {
      return serverProcessHandler.isProcessTerminating() || serverProcessHandler.isProcessTerminated();
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:BrowserStarter.java

示例14: canBeStopped

import com.intellij.execution.process.ProcessHandler; //導入方法依賴的package包/類
private static boolean canBeStopped(@Nullable RunContentDescriptor descriptor) {
  @Nullable ProcessHandler processHandler = descriptor != null ? descriptor.getProcessHandler() : null;
  return processHandler != null && !processHandler.isProcessTerminated()
         && (!processHandler.isProcessTerminating()
             || processHandler instanceof KillableProcess && ((KillableProcess)processHandler).canKillProcess());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:StopAction.java

示例15: 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();
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:67,代碼來源:ExecutionHelper.java


注:本文中的com.intellij.execution.process.ProcessHandler.isProcessTerminated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。