Java Code Examples for com.intellij.execution.ui.RunContentDescriptor#getAttachedContent()

The following examples show how to use com.intellij.execution.ui.RunContentDescriptor#getAttachedContent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppCommandLineState.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Closes old session only for debug mode
 *
 * @param project
 * @param parameters
 */
private void closeOldSession(final Project project, EmbeddedLinuxJVMRunConfigurationRunnerParameters parameters) {
    final String configurationName = AppCommandLineState.getRunConfigurationName(parameters.getPort());
    final Collection<RunContentDescriptor> descriptors =
            ExecutionHelper.findRunningConsoleByTitle(project, configurationName::equals);

    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(project).getContentManager()
                        .removeRunContent(executor, descriptor);
            } else {
                content.getManager().setSelectedContent(content);
                ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(executor.getToolWindowId());
                window.activate(null, false, true);
            }
        }
    }
}
 
Example 2
Source File: AbstractAutoTestManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void setAutoTestEnabled(@Nonnull RunContentDescriptor descriptor, @Nonnull ExecutionEnvironment environment, boolean enabled) {
  Content content = descriptor.getAttachedContent();
  if (content != null) {
    if (enabled) {
      myEnabledRunProfiles.add(environment.getRunProfile());
      myWatcher.activate();
    }
    else {
      myEnabledRunProfiles.remove(environment.getRunProfile());
      if (!hasEnabledAutoTests()) {
        myWatcher.deactivate();
      }
      ProcessHandler processHandler = descriptor.getProcessHandler();
      if (processHandler != null) {
        clearRestarterListener(processHandler);
      }
    }
  }
}
 
Example 3
Source File: AbstractAutoTestManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
private boolean isAutoTestEnabledForDescriptor(@Nonnull RunContentDescriptor descriptor) {
  Content content = descriptor.getAttachedContent();
  if (content != null) {
    ExecutionEnvironment environment = getCurrentEnvironment(content);
    return environment != null && myEnabledRunProfiles.contains(environment.getRunProfile());
  }
  return false;
}
 
Example 4
Source File: DashboardNode.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
default Content getContent() {
  RunContentDescriptor descriptor = getDescriptor();
  return descriptor == null ? null : descriptor.getAttachedContent();
}