• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java KillableProcess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.execution.KillableProcess的典型用法代码示例。如果您正苦于以下问题:Java KillableProcess类的具体用法?Java KillableProcess怎么用?Java KillableProcess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



KillableProcess类属于com.intellij.execution包,在下文中一共展示了KillableProcess类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: terminateProcessHandler

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
/**
 * Gracefully terminates a process handler.
 * Initially, 'soft kill' is performed (on UNIX it's equivalent to SIGINT signal sending).
 * If the process isn't terminated within a given timeout, 'force quite' is performed (on UNIX it's equivalent to SIGKILL
 * signal sending).
 *
 * @param processHandler {@link ProcessHandler} instance
 * @param millisTimeout timeout in milliseconds between 'soft kill' and 'force quite'
 * @param commandLine command line
 */
public static void terminateProcessHandler(@NotNull ProcessHandler processHandler,
                                           long millisTimeout,
                                           @Nullable String commandLine) {
  if (processHandler.isProcessTerminated()) {
    if (commandLine == null && processHandler instanceof BaseOSProcessHandler) {
      commandLine = ((BaseOSProcessHandler) processHandler).getCommandLine();
    }
    LOG.warn("Process '" + commandLine + "' is already terminated!");
    return;
  }
  processHandler.destroyProcess();
  if (processHandler instanceof KillableProcess) {
    KillableProcess killableProcess = (KillableProcess) processHandler;
    if (killableProcess.canKillProcess()) {
      if (!processHandler.waitFor(millisTimeout)) {
        // doing 'force quite'
        killableProcess.killProcess();
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:ScriptRunnerUtil.java


示例2: update

import com.intellij.execution.KillableProcess; //导入依赖的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


示例3: stopProcess

import com.intellij.execution.KillableProcess; //导入依赖的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();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:StopProcessAction.java


示例4: stopDebugConnection

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
public void stopDebugConnection(@NotNull DataContext dataContext) {
    ProcessHandler processHandler = getHandler(dataContext);
    if(processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
        ((KillableProcess) processHandler).killProcess();
        return;
    }

    ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration();
    if(serverConfiguration != null) {
        serverConfiguration.setServerStatus(ServerConfiguration.ServerStatus.disconnecting);
    }
    if(processHandler != null) {
        if(processHandler.detachIsDefault()) {
            processHandler.detachProcess();
        } else {
            processHandler.destroyProcess();
        }
    }
    if(serverConfiguration != null) {
        serverConfiguration.setServerStatus(ServerConfiguration.ServerStatus.disconnected);
    }
}
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:23,代码来源:ServerConnectionManager.java


示例5: terminateProcessHandler

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
/**
 * Gracefully terminates a process handler.
 * Initially, 'soft kill' is performed (on UNIX it's equivalent to SIGINT signal sending).
 * If the process isn't terminated within a given timeout, 'force quite' is performed (on UNIX it's equivalent to SIGKILL
 * signal sending).
 *
 * @param processHandler {@link ProcessHandler} instance
 * @param millisTimeout timeout in milliseconds between 'soft kill' and 'force quite'
 * @param commandLine command line
 */
public static void terminateProcessHandler(@NotNull ProcessHandler processHandler,
                                           long millisTimeout,
                                           @Nullable String commandLine) {
  if (processHandler.isProcessTerminated()) {
    LOG.warn("Process '" + commandLine + "' is already terminated!");
    return;
  }
  processHandler.destroyProcess();
  if (processHandler instanceof KillableProcess) {
    KillableProcess killableProcess = (KillableProcess) processHandler;
    if (killableProcess.canKillProcess()) {
      if (!processHandler.waitFor(millisTimeout)) {
        // doing 'force quite'
        killableProcess.killProcess();
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:ScriptRunnerUtil.java


示例6: terminateProcessHandler

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
/**
 * Gracefully terminates a process handler.
 * Initially, 'soft kill' is performed (on UNIX it's equivalent to SIGINT signal sending).
 * If the process isn't terminated within a given timeout, 'force quite' is performed (on UNIX it's equivalent to SIGKILL
 * signal sending).
 *
 * @param processHandler {@link ProcessHandler} instance
 * @param millisTimeout timeout in milliseconds between 'soft kill' and 'force quite'
 * @param commandLine command line
 */
public static void terminateProcessHandler(@Nonnull ProcessHandler processHandler,
                                           long millisTimeout,
                                           @Nullable String commandLine) {
  if (processHandler.isProcessTerminated()) {
    LOG.warn("Process '" + commandLine + "' is already terminated!");
    return;
  }
  processHandler.destroyProcess();
  if (processHandler instanceof KillableProcess) {
    KillableProcess killableProcess = (KillableProcess) processHandler;
    if (killableProcess.canKillProcess()) {
      if (!processHandler.waitFor(millisTimeout)) {
        // doing 'force quite'
        killableProcess.killProcess();
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:ScriptRunnerUtil.java


示例7: update

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
public static void update(@Nonnull Presentation presentation,
                          @Nonnull 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:consulo,项目名称:consulo,代码行数:22,代码来源:StopProcessAction.java


示例8: stopProcess

import com.intellij.execution.KillableProcess; //导入依赖的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();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:StopAction.java


示例9: update

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
  boolean enable = false;
  Icon icon = getTemplatePresentation().getIcon();
  String description = getTemplatePresentation().getDescription();
  final Presentation presentation = e.getPresentation();

  if (ActionPlaces.MAIN_MENU.equals(e.getPlace())) {
    enable = !getCancellableProcesses(e.getProject()).isEmpty() || !getActiveDescriptors(e.getDataContext()).isEmpty();
  }
  else {
    final ProcessHandler processHandler = getHandler(e.getDataContext());
    if (processHandler != null && !processHandler.isProcessTerminated()) {
      if (!processHandler.isProcessTerminating()) {
        enable = true;
      }
      else if (processHandler instanceof KillableProcess && ((KillableProcess)processHandler).canKillProcess()) {
        enable = true;
        icon = AllIcons.Debugger.KillProcess;
        description = "Kill process";
      }
    }
  }

  presentation.setEnabled(enable);
  presentation.setIcon(icon);
  presentation.setDescription(description);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:StopAction.java


示例10: stopProcess

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
private static void stopProcess(ProcessHandler processHandler) {
  if (processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
    ((KillableProcess)processHandler).killProcess();
    return;
  }

  if (processHandler.detachIsDefault()) {
    processHandler.detachProcess();
  }
  else {
    processHandler.destroyProcess();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:StopAction.java


示例11: stopProcess

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
public static void stopProcess(@NotNull 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.detachIsDefault()) {
    processHandler.detachProcess();
  }
  else {
    processHandler.destroyProcess();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:StopProcessAction.java


示例12: stopProcess

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
public static void stopProcess(@Nonnull 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.detachIsDefault()) {
    processHandler.detachProcess();
  }
  else {
    processHandler.destroyProcess();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:StopProcessAction.java


示例13: update

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
  boolean enable = false;
  Icon icon = getTemplatePresentation().getIcon();
  String description = getTemplatePresentation().getDescription();
  Presentation presentation = e.getPresentation();
  if (isPlaceGlobal(e)) {
    List<RunContentDescriptor> stoppableDescriptors = getActiveStoppableDescriptors(e.getDataContext());
    List<Pair<TaskInfo, ProgressIndicator>> cancellableProcesses = getCancellableProcesses(e.getProject());
    int todoSize = stoppableDescriptors.size() + cancellableProcesses.size();
    if (todoSize > 1) {
      presentation.setText(getTemplatePresentation().getText()+"...");
    }
    else if (todoSize == 1) {
      if (stoppableDescriptors.size() ==1) {
        presentation.setText(ExecutionBundle.message("stop.configuration.action.name", stoppableDescriptors.get(0).getDisplayName()));
      } else {
        TaskInfo taskInfo = cancellableProcesses.get(0).first;
        presentation.setText(taskInfo.getCancelText() + " " + taskInfo.getTitle());
      }
    } else {
      presentation.setText(getTemplatePresentation().getText());
    }
    enable = todoSize > 0;
    if (todoSize > 1) {
      icon = IconUtil.addText(icon, String.valueOf(todoSize));
    }
  }
  else {
    RunContentDescriptor contentDescriptor = e.getData(LangDataKeys.RUN_CONTENT_DESCRIPTOR);
    ProcessHandler processHandler = contentDescriptor == null ? null : contentDescriptor.getProcessHandler();
    if (processHandler != null && !processHandler.isProcessTerminated()) {
      if (!processHandler.isProcessTerminating()) {
        enable = true;
      }
      else if (processHandler instanceof KillableProcess && ((KillableProcess)processHandler).canKillProcess()) {
        enable = true;
        icon = AllIcons.Debugger.KillProcess;
        description = "Kill process";
      }
    }

    RunProfile runProfile = e.getData(LangDataKeys.RUN_PROFILE);
    if (runProfile == null && contentDescriptor == null) {
      presentation.setText(getTemplatePresentation().getText());
    }
    else {
      presentation.setText(ExecutionBundle.message("stop.configuration.action.name",
                                                   runProfile == null ? contentDescriptor.getDisplayName() : runProfile.getName()));
    }
  }

  presentation.setEnabled(enable);
  presentation.setIcon(icon);
  presentation.setDescription(description);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:57,代码来源:StopAction.java


示例14: canBeStopped

import com.intellij.execution.KillableProcess; //导入依赖的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: canKillProcess

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
@Override
public boolean canKillProcess() {
  return base instanceof KillableProcess && ((KillableProcess) base).canKillProcess();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:5,代码来源:BlazeCoverageProgramRunner.java


示例16: killProcess

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
@Override
public void killProcess() {
  if (base instanceof KillableProcess) {
    ((KillableProcess) base).killProcess();
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:7,代码来源:BlazeCoverageProgramRunner.java


示例17: update

import com.intellij.execution.KillableProcess; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
  boolean enable = false;
  Icon icon = getTemplatePresentation().getIcon();
  String description = getTemplatePresentation().getDescription();
  Presentation presentation = e.getPresentation();
  if (isPlaceGlobal(e)) {
    List<RunContentDescriptor> stoppableDescriptors = getActiveStoppableDescriptors(e.getDataContext());
    List<Pair<TaskInfo, ProgressIndicator>> cancellableProcesses = getCancellableProcesses(e.getProject());
    int todoSize = stoppableDescriptors.size() + cancellableProcesses.size();
    if (todoSize > 1) {
      presentation.setText(getTemplatePresentation().getText() + "...");
    }
    else if (todoSize == 1) {
      if (stoppableDescriptors.size() == 1) {
        presentation
                .setText(ExecutionBundle.message("stop.configuration.action.name", StringUtil.escapeMnemonics(stoppableDescriptors.get(0).getDisplayName())));
      }
      else {
        TaskInfo taskInfo = cancellableProcesses.get(0).first;
        presentation.setText(taskInfo.getCancelText() + " " + taskInfo.getTitle());
      }
    }
    else {
      presentation.setText(getTemplatePresentation().getText());
    }
    enable = todoSize > 0;
    if (todoSize > 1) {
      icon = IconUtil.addText(icon, String.valueOf(todoSize));
    }
  }
  else {
    RunContentDescriptor contentDescriptor = e.getData(LangDataKeys.RUN_CONTENT_DESCRIPTOR);
    ProcessHandler processHandler = contentDescriptor == null ? null : contentDescriptor.getProcessHandler();
    if (processHandler != null && !processHandler.isProcessTerminated()) {
      if (!processHandler.isProcessTerminating()) {
        enable = true;
      }
      else if (processHandler instanceof KillableProcess && ((KillableProcess)processHandler).canKillProcess()) {
        enable = true;
        icon = AllIcons.Debugger.KillProcess;
        description = "Kill process";
      }
    }

    RunProfile runProfile = e.getData(LangDataKeys.RUN_PROFILE);
    if (runProfile == null && contentDescriptor == null) {
      presentation.setText(getTemplatePresentation().getText());
    }
    else {
      presentation.setText(ExecutionBundle.message("stop.configuration.action.name", StringUtil
              .escapeMnemonics(runProfile == null ? contentDescriptor.getDisplayName() : runProfile.getName())));
    }
  }

  presentation.setEnabled(enable);
  presentation.setIcon(icon);
  presentation.setDescription(description);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:60,代码来源:StopAction.java


示例18: canBeStopped

import com.intellij.execution.KillableProcess; //导入依赖的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:consulo,项目名称:consulo,代码行数:7,代码来源:StopAction.java



注:本文中的com.intellij.execution.KillableProcess类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FragmentDelegate类代码示例发布时间:2022-05-22
下一篇:
Java SVGLength类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap