Java Code Examples for com.intellij.execution.configurations.RunConfiguration#getProject()

The following examples show how to use com.intellij.execution.configurations.RunConfiguration#getProject() . 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: PantsMakeBeforeRun.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public boolean executeTask(
  @NotNull DataContext context,
  RunConfiguration configuration,
  @NotNull ExecutionEnvironment env,
  @NotNull ExternalSystemBeforeRunTask beforeRunTask
) {
  Project currentProject = configuration.getProject();
  Set<String> targetAddressesToCompile = PantsUtil.filterGenTargets(getTargetAddressesToCompile(configuration));
  PantsExecuteTaskResult result = executeCompileTask(currentProject, targetAddressesToCompile, false);
  return result.succeeded;
}
 
Example 2
Source File: BuckCommandBeforeRunTaskProvider.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public Promise<Boolean> configureTask(
    @NotNull DataContext context,
    @NotNull RunConfiguration configuration,
    @NotNull BuckCommandBeforeRunTask task) {
  Project project = configuration.getProject();
  final BuckCommandToolEditorDialog dialog = new BuckCommandToolEditorDialog(project);
  dialog.setArguments(task.getArguments());
  if (dialog.showAndGet()) {
    task.setArguments(dialog.getArguments());
    Promises.resolvedPromise(true);
  }
  return Promises.resolvedPromise(false);
}
 
Example 3
Source File: RunConfigurationBeforeRunProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private List<RunnerAndConfigurationSettings> getAvailableConfigurations(RunConfiguration runConfiguration) {
  Project project = runConfiguration.getProject();
  if (project == null || !project.isInitialized()) return Collections.emptyList();
  final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project);

  final ArrayList<RunnerAndConfigurationSettings> configurations = new ArrayList<RunnerAndConfigurationSettings>(runManager.getSortedConfigurations());
  String executorId = DefaultRunExecutor.getRunExecutorInstance().getId();
  for (Iterator<RunnerAndConfigurationSettings> iterator = configurations.iterator(); iterator.hasNext(); ) {
    RunnerAndConfigurationSettings settings = iterator.next();
    final ProgramRunner runner = ProgramRunnerUtil.getRunner(executorId, settings);
    if (runner == null || settings.getConfiguration() == runConfiguration) iterator.remove();
  }
  return configurations;
}
 
Example 4
Source File: AbstractToolBeforeRunTaskProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@RequiredUIAccess
@Override
public AsyncResult<Void> configureTask(RunConfiguration runConfiguration, T task) {
  final ToolSelectDialog dialog = new ToolSelectDialog(runConfiguration.getProject(), task.getToolActionId(), createToolsPanel());

  AsyncResult<Void> result = AsyncResult.undefined();

  AsyncResult<Void> showAsync = dialog.showAsync();
  showAsync.doWhenDone(() -> {
    boolean isModified = dialog.isModified();
    Tool selectedTool = dialog.getSelectedTool();
    LOG.assertTrue(selectedTool != null);
    String selectedToolId = selectedTool.getActionId();
    String oldToolId = task.getToolActionId();
    if (oldToolId != null && oldToolId.equals(selectedToolId)) {
      if (isModified) {
        result.setDone();
      }
      else {
        result.setRejected();
      }
      return;
    }
    task.setToolActionId(selectedToolId);
    result.setDone();
  });
  showAsync.doWhenRejected((Runnable)result::setRejected);
  return result;
}
 
Example 5
Source File: SMTRunnerConsoleProperties.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * @param config
 * @param testFrameworkName Prefix for storage which keeps runner settings. E.g. "RubyTestUnit"
 * @param executor
 */
public SMTRunnerConsoleProperties(@Nonnull RunConfiguration config, @Nonnull String testFrameworkName, @Nonnull Executor executor) {
  this(config.getProject(), config, testFrameworkName, executor);
}