本文整理汇总了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);
}
}
}
}
示例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) {
}
}
示例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();
}
}
}
示例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()]);
}
示例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());
}
示例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);
}
}
});
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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());
}
示例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());
}
示例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);
}
示例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;
}
示例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);
}