com.intellij.execution.configurations.CommandLineState Java Examples

The following examples show how to use com.intellij.execution.configurations.CommandLineState. 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: DaemonConsoleView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Sets up a launcher to use a DaemonConsoleView.
 */
public static void install(@NotNull CommandLineState launcher, @NotNull ExecutionEnvironment env, @NotNull VirtualFile workDir) {
  // Create our own console builder.
  //
  // We need to filter input to this console without affecting other consoles, so we cannot use
  // a consoleFilterInputProvider.
  final GlobalSearchScope searchScope = SearchScopeProvider.createSearchScope(env.getProject(), env.getRunProfile());
  final TextConsoleBuilder builder = new TextConsoleBuilderImpl(env.getProject(), searchScope) {
    @NotNull
    @Override
    protected ConsoleView createConsole() {
      return new DaemonConsoleView(env.getProject(), searchScope);
    }
  };

  // Set up basic console filters. (More may be added later.)
  // TODO(devoncarew): Do we need this filter? What about DartConsoleFilter (for package: uris)?
  builder.addFilter(new DartRelativePathsConsoleFilter(env.getProject(), workDir.getPath()));
  launcher.setConsoleBuilder(builder);
}
 
Example #2
Source File: DaemonConsoleView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Sets up a launcher to use a DaemonConsoleView.
 */
public static void install(@NotNull CommandLineState launcher, @NotNull ExecutionEnvironment env, @NotNull VirtualFile workDir) {
  // Create our own console builder.
  //
  // We need to filter input to this console without affecting other consoles, so we cannot use
  // a consoleFilterInputProvider.
  final GlobalSearchScope searchScope = SearchScopeProvider.createSearchScope(env.getProject(), env.getRunProfile());
  final TextConsoleBuilder builder = new TextConsoleBuilderImpl(env.getProject(), searchScope) {
    @NotNull
    @Override
    protected ConsoleView createConsole() {
      return new DaemonConsoleView(env.getProject(), searchScope);
    }
  };

  // Set up basic console filters. (More may be added later.)
  // TODO(devoncarew): Do we need this filter? What about DartConsoleFilter (for package: uris)?
  builder.addFilter(new DartRelativePathsConsoleFilter(env.getProject(), workDir.getPath()));
  launcher.setConsoleBuilder(builder);
}
 
Example #3
Source File: HaxeTestsRunner.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@Override
protected RunContentDescriptor doExecute(@NotNull final Project project,
                                         @NotNull RunProfileState state,
                                         final RunContentDescriptor descriptor,
                                         @NotNull final ExecutionEnvironment environment) throws ExecutionException {

  final HaxeTestsConfiguration profile = (HaxeTestsConfiguration)environment.getRunProfile();
  final Module module = profile.getConfigurationModule().getModule();

  ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  VirtualFile[] roots = rootManager.getContentRoots();

  return super.doExecute(project, new CommandLineState(environment) {
    @NotNull
    @Override
    protected ProcessHandler startProcess() throws ExecutionException {
      //actually only neko target is supported for tests
      HaxeTarget currentTarget = HaxeTarget.NEKO;
      final GeneralCommandLine commandLine = new GeneralCommandLine();
      commandLine.setWorkDirectory(PathUtil.getParentPath(module.getModuleFilePath()));
      commandLine.setExePath(currentTarget.getFlag());
      final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(module);
      String folder = settings.getOutputFolder() != null ? (settings.getOutputFolder() + "/release/") : "";
      commandLine.addParameter(getFileNameWithCurrentExtension(currentTarget, folder + settings.getOutputFileName()));

      final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(module.getProject());
      consoleBuilder.addFilter(new ErrorFilter(module));
      setConsoleBuilder(consoleBuilder);

      return new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
    }

    private String getFileNameWithCurrentExtension(HaxeTarget haxeTarget, String fileName) {
      if (haxeTarget != null) {
        return haxeTarget.getTargetFileNameWithExtension(FileUtil.getNameWithoutExtension(fileName));
      }
      return fileName;
    }
  }, descriptor, environment);
}
 
Example #4
Source File: SMTestRunnerConnectionUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated use {@link #createAndAttachConsole(String, ProcessHandler, TestConsoleProperties)} (to be removed in IDEA 16)
 */
@SuppressWarnings({"unused", "deprecation"})
public static ConsoleView createAndAttachConsole(@Nonnull String testFrameworkName,
                                                 @Nonnull ProcessHandler processHandler,
                                                 @Nonnull CommandLineState commandLineState,
                                                 @Nonnull ModuleRunConfiguration config,
                                                 @Nonnull Executor executor) throws ExecutionException {
  TestConsoleProperties consoleProperties = new SMTRunnerConsoleProperties(config, testFrameworkName, executor);
  return createAndAttachConsole(testFrameworkName, processHandler, consoleProperties, commandLineState.getEnvironment());
}
 
Example #5
Source File: SMTestRunnerConnectionUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated use {@link #createConsole(String, TestConsoleProperties)} (to be removed in IDEA 16)
 */
@SuppressWarnings({"unused", "deprecation"})
public static ConsoleView createConsole(@Nonnull String testFrameworkName, @Nonnull CommandLineState commandLineState, @Nonnull ModuleRunConfiguration config, @Nonnull Executor executor)
        throws ExecutionException {
  TestConsoleProperties consoleProperties = new SMTRunnerConsoleProperties(config, testFrameworkName, executor);
  return createConsole(testFrameworkName, consoleProperties, commandLineState.getEnvironment());
}
 
Example #6
Source File: BlazeCidrLauncher.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public ProcessHandler createProcess(CommandLineState state) throws ExecutionException {
  return createProcess(state, ImmutableList.of());
}