当前位置: 首页>>代码示例>>Java>>正文


Java RunContentDescriptor.getProcessHandler方法代码示例

本文整理汇总了Java中com.intellij.execution.ui.RunContentDescriptor.getProcessHandler方法的典型用法代码示例。如果您正苦于以下问题:Java RunContentDescriptor.getProcessHandler方法的具体用法?Java RunContentDescriptor.getProcessHandler怎么用?Java RunContentDescriptor.getProcessHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.ui.RunContentDescriptor的用法示例。


在下文中一共展示了RunContentDescriptor.getProcessHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAutoTestEnabled

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
public void setAutoTestEnabled(@NotNull RunContentDescriptor descriptor, @NotNull ExecutionEnvironment environment, boolean enabled) {
  Content content = descriptor.getAttachedContent();
  if (content != null) {
    if (enabled) {
      EXECUTION_ENVIRONMENT_KEY.set(content, environment);
      myDocumentWatcher.activate();
    }
    else {
      EXECUTION_ENVIRONMENT_KEY.set(content, null);
      if (!hasEnabledAutoTests()) {
        myDocumentWatcher.deactivate();
      }
      ProcessHandler processHandler = descriptor.getProcessHandler();
      if (processHandler != null) {
        clearRestarterListener(processHandler);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AutoTestManager.java

示例2: actionPerformed

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的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.ui.RunContentDescriptor; //导入方法依赖的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: getRunningProcesses

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@NotNull
@Override
public ProcessHandler[] getRunningProcesses() {
  if (myContentManager == null) return EMPTY_PROCESS_HANDLERS;
  List<ProcessHandler> handlers = null;
  for (RunContentDescriptor descriptor : getContentManager().getAllDescriptors()) {
    ProcessHandler processHandler = descriptor.getProcessHandler();
    if (processHandler != null) {
      if (handlers == null) {
        handlers = new SmartList<ProcessHandler>();
      }
      handlers.add(processHandler);
    }
  }
  return handlers == null ? EMPTY_PROCESS_HANDLERS : handlers.toArray(new ProcessHandler[handlers.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ExecutionManagerImpl.java

示例5: restartRunProfile

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@Override
public void restartRunProfile(@NotNull Project project,
                              @NotNull Executor executor,
                              @NotNull ExecutionTarget target,
                              @Nullable RunnerAndConfigurationSettings configuration,
                              @Nullable ProcessHandler processHandler) {
  ExecutionEnvironmentBuilder builder = createEnvironmentBuilder(project, executor, configuration);
  if (processHandler != null) {
    for (RunContentDescriptor descriptor : getContentManager().getAllDescriptors()) {
      if (descriptor.getProcessHandler() == processHandler) {
        builder.contentToReuse(descriptor);
        break;
      }
    }
  }
  restartRunProfile(builder.target(target).build());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ExecutionManagerImpl.java

示例6: startDebugSession

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@Override
public void startDebugSession(@NotNull JavaDebugConnectionData info, @NotNull ExecutionEnvironment executionEnvironment, @NotNull RemoteServer<?> server)
  throws ExecutionException {
  final Project project = executionEnvironment.getProject();
  final DebuggerPanelsManager manager = DebuggerPanelsManager.getInstance(project);
  final JavaDebugServerModeHandler serverModeHandler = info.getServerModeHandler();
  boolean serverMode = serverModeHandler != null;
  final RemoteConnection remoteConnection = new RemoteConnection(true, info.getHost(), String.valueOf(info.getPort()), serverMode);
  DebugEnvironment debugEnvironment = new RemoteServerDebugEnvironment(project, remoteConnection, executionEnvironment.getRunProfile());
  DebugUIEnvironment debugUIEnvironment = new RemoteServerDebugUIEnvironment(debugEnvironment, executionEnvironment);
  RunContentDescriptor debugContentDescriptor = manager.attachVirtualMachine(debugUIEnvironment);
  LOG.assertTrue(debugContentDescriptor != null);
  ProcessHandler processHandler = debugContentDescriptor.getProcessHandler();
  LOG.assertTrue(processHandler != null);
  if (serverMode) {
    serverModeHandler.attachRemote();
    DebuggerManager.getInstance(executionEnvironment.getProject())
      .addDebugProcessListener(processHandler, new DebugProcessAdapter() {
        public void processDetached(DebugProcess process, boolean closedByUser) {
          try {
            serverModeHandler.detachRemote();
          }
          catch (ExecutionException e) {
            LOG.info(e);
          }
        }
      });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:JavaDebuggerLauncherImpl.java

示例7: restartIfActive

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

示例8: restartAutoTest

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

示例9: getItemsList

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@Nullable
private static Pair<List<HandlerItem>, HandlerItem> getItemsList(List<Pair<TaskInfo, ProgressIndicator>> tasks,
                                                                 List<RunContentDescriptor> descriptors,
                                                                 RunContentDescriptor toSelect) {
  if (tasks.isEmpty() && descriptors.isEmpty()) {
    return null;
  }

  List<HandlerItem> items = new ArrayList<HandlerItem>(tasks.size() + descriptors.size());
  HandlerItem selected = null;
  for (final RunContentDescriptor descriptor : descriptors) {
    final ProcessHandler handler = descriptor.getProcessHandler();
    if (handler != null) {
      HandlerItem item = new HandlerItem(descriptor.getDisplayName(), descriptor.getIcon(), false) {
        @Override
        void stop() {
          stopProcess(descriptor);
        }
      };
      items.add(item);
      if (descriptor == toSelect) {
        selected = item;
      }
    }
  }

  boolean hasSeparator = true;
  for (final Pair<TaskInfo, ProgressIndicator> eachPair : tasks) {
    items.add(new HandlerItem(eachPair.first.getTitle(), AllIcons.Process.Step_passive, hasSeparator) {
      @Override
      void stop() {
        eachPair.second.cancel();
      }
    });
    hasSeparator = false;
  }
  return Pair.create(items, selected);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:StopAction.java

示例10: stopProcess

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

示例11: update

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
  RunContentDescriptor descriptor = StopAction.getRecentlyStartedContentDescriptor(e.getDataContext());
  ProcessHandler handler = descriptor != null ? descriptor.getProcessHandler() : null;
  e.getPresentation().setEnabledAndVisible(e.getData(LangDataKeys.CONSOLE_VIEW) != null
                                           && e.getData(CommonDataKeys.EDITOR) != null
                                           && handler != null
                                           && !handler.isProcessTerminated());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:EOFAction.java

示例12: isEnabled

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
protected boolean isEnabled(AnActionEvent event) {
  RunContentDescriptor descriptor = getDescriptor(event);
  ProcessHandler processHandler = descriptor == null ? null : descriptor.getProcessHandler();
  ExecutionEnvironment environment = getEnvironment(event);
  return environment != null &&
         !ExecutorRegistry.getInstance().isStarting(environment) &&
         !(processHandler != null && processHandler.isProcessTerminating());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FakeRerunAction.java

示例13: closeOldSessionAndRun

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
private void closeOldSessionAndRun(final String debugPort) {
  final String configurationName = getRunConfigurationName(debugPort);
  final Collection<RunContentDescriptor> descriptors =
    ExecutionHelper.findRunningConsoleByTitle(myProject, new NotNullFunction<String, Boolean>() {
      @NotNull
      @Override
      public Boolean fun(String title) {
        return configurationName.equals(title);
      }
    });

  if (descriptors.size() > 0) {
    final RunContentDescriptor descriptor = descriptors.iterator().next();
    final ProcessHandler processHandler = descriptor.getProcessHandler();
    final Content content = descriptor.getAttachedContent();

    if (processHandler != null && content != null) {
      final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();

      if (processHandler.isProcessTerminated()) {
        ExecutionManager.getInstance(myProject).getContentManager()
          .removeRunContent(executor, descriptor);
      }
      else {
        content.getManager().setSelectedContent(content);
        ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(executor.getToolWindowId());
        window.activate(null, false, true);
        return;
      }
    }
  }

  runSession(debugPort);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:AndroidProcessChooserDialog.java

示例14: doExecute

import com.intellij.execution.ui.RunContentDescriptor; //导入方法依赖的package包/类
@Nullable
@Override
protected RunContentDescriptor doExecute(RunProfileState profile, ExecutionEnvironment env)
    throws ExecutionException {
  WorkspaceRoot root = WorkspaceRoot.fromProjectSafe(env.getProject());
  if (root == null) {
    return null;
  }
  RunContentDescriptor result = super.doExecute(profile, env);
  if (result == null) {
    return null;
  }
  // remove any old copy of the coverage data

  // retrieve coverage data and copy locally
  BlazeCommandRunConfiguration blazeConfig = (BlazeCommandRunConfiguration) env.getRunProfile();
  BlazeCoverageEnabledConfiguration config =
      (BlazeCoverageEnabledConfiguration) CoverageEnabledConfiguration.getOrCreate(blazeConfig);

  String coverageFilePath = config.getCoverageFilePath();
  File blazeOutputFile = CoverageUtils.getOutputFile(root);

  ProcessHandler handler = result.getProcessHandler();
  if (handler != null) {
    ProcessHandler wrappedHandler =
        new ProcessHandlerWrapper(
            handler, exitCode -> copyCoverageOutput(blazeOutputFile, coverageFilePath, exitCode));
    CoverageHelper.attachToProcess(blazeConfig, wrappedHandler, env.getRunnerSettings());
  }
  return result;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:32,代码来源:BlazeCoverageProgramRunner.java

示例15: update

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


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