com.intellij.execution.runners.ExecutionEnvironment Java Examples

The following examples show how to use com.intellij.execution.runners.ExecutionEnvironment. 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: BlazeAndroidTestProgramRunner.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
protected RunContentDescriptor doExecute(
    final RunProfileState state, final ExecutionEnvironment env) throws ExecutionException {
  RunContentDescriptor descriptor = super.doExecute(state, env);
  if (descriptor != null) {
    ProcessHandler processHandler = descriptor.getProcessHandler();
    assert processHandler != null;

    RunProfile runProfile = env.getRunProfile();
    RunConfiguration runConfiguration =
        (runProfile instanceof RunConfiguration) ? (RunConfiguration) runProfile : null;
    AndroidSessionInfo sessionInfo =
        AndroidSessionInfo.create(
            processHandler,
            descriptor,
            runConfiguration,
            env.getExecutor().getId(),
            env.getExecutor().getActionName(),
            env.getExecutionTarget());
    processHandler.putUserData(AndroidSessionInfo.KEY, sessionInfo);
  }

  return descriptor;
}
 
Example #2
Source File: LaunchState.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NotNull
private FlutterPositionMapper createPositionMapper(@NotNull ExecutionEnvironment env,
                                                   @NotNull FlutterApp app,
                                                   @NotNull DartUrlResolver resolver) {
  final FlutterPositionMapper.Analyzer analyzer;
  if (app.getMode() == RunMode.DEBUG) {
    analyzer = FlutterPositionMapper.Analyzer.create(env.getProject(), sourceLocation);
  }
  else {
    analyzer = null; // Don't need analysis server just to run.
  }

  // Choose source root containing the Dart application.
  // TODO(skybrian) for bazel, we probably should pass in three source roots here (for bazel-bin, bazel-genfiles, etc).
  final VirtualFile pubspec = resolver.getPubspecYamlFile();
  final VirtualFile sourceRoot = pubspec != null ? pubspec.getParent() : workDir;

  return new FlutterPositionMapper(env.getProject(), sourceRoot, resolver, analyzer);
}
 
Example #3
Source File: FastBuildConfigurationRunner.java    From intellij with Apache License 2.0 6 votes vote down vote up
private static void handleJavacError(
    ExecutionEnvironment env,
    Project project,
    Label label,
    FastBuildService buildService,
    FastBuildIncrementalCompileException e) {

  BlazeConsoleService console = BlazeConsoleService.getInstance(project);
  console.print(e.getMessage() + "\n", ConsoleViewContentType.ERROR_OUTPUT);
  console.printHyperlink(
      "Click here to run the tests again with a fresh "
          + Blaze.getBuildSystem(project)
          + " build.\n",
      new RerunTestsWithBlazeHyperlink(buildService, label, env));
  ExecutionUtil.handleExecutionError(
      env, new ExecutionException("See the Blaze Console for javac output", e.getCause()));
}
 
Example #4
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 6 votes vote down vote up
private XDebugSessionTab(@Nonnull XDebugSessionImpl session, @Nullable Image icon, @Nullable ExecutionEnvironment environment) {
  super(session.getProject(), "Debug", session.getSessionName(), GlobalSearchScope.allScope(session.getProject()));

  setSession(session, environment, icon);

  myUi.addContent(createFramesContent(), 0, PlaceInGrid.left, false);
  addVariablesAndWatches(session);

  attachToSession(session);

  DefaultActionGroup focus = new DefaultActionGroup();
  focus.add(ActionManager.getInstance().getAction(XDebuggerActions.FOCUS_ON_BREAKPOINT));
  myUi.getOptions().setAdditionalFocusActions(focus);

  myUi.addListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(ContentManagerEvent event) {
      Content content = event.getContent();
      if (mySession != null && content.isSelected() && getWatchesContentId().equals(ViewImpl.ID.get(content))) {
        myRebuildWatchesRunnable.run();
      }
    }
  }, myRunContentDescriptor);

  rebuildViews();
}
 
Example #5
Source File: DeployToServerRunConfiguration.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(@Nonnull Executor executor, @Nonnull ExecutionEnvironment env) throws ExecutionException {
  String serverName = getServerName();
  if (serverName == null) {
    throw new ExecutionException("Server is not specified");
  }

  RemoteServer<S> server = RemoteServersManager.getInstance().findByName(serverName, myServerType);
  if (server == null) {
    throw new ExecutionException("Server '" + serverName + " not found");
  }

  if (myDeploymentSource == null) {
    throw new ExecutionException("Deployment is not selected");
  }

  return new DeployToServerState(server, myDeploymentSource, myDeploymentConfiguration, env);
}
 
Example #6
Source File: BazelRunConfig.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NotNull
@Override
public LaunchState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
  final BazelFields launchFields = fields.copy();
  try {
    launchFields.checkRunnable(env.getProject());
  }
  catch (RuntimeConfigurationError e) {
    throw new ExecutionException(e);
  }

  final Workspace workspace = fields.getWorkspace(getProject());
  final VirtualFile workspaceRoot = workspace.getRoot();
  final RunMode mode = RunMode.fromEnv(env);
  final Module module = ModuleUtil.findModuleForFile(workspaceRoot, env.getProject());

  final LaunchState.CreateAppCallback createAppCallback = (@Nullable FlutterDevice device) -> {
    if (device == null) return null;

    final GeneralCommandLine command = getCommand(env, device);
    return FlutterApp.start(env, env.getProject(), module, mode, device, command,
                            StringUtil.capitalize(mode.mode()) + "BazelApp", "StopBazelApp");
  };

  return new LaunchState(env, workspaceRoot, workspaceRoot, this, createAppCallback);
}
 
Example #7
Source File: ProjectExecutor.java    From tmc-intellij with MIT License 6 votes vote down vote up
public void executeConfiguration(Project project, ModuleBasedConfiguration appCon) {
    if (noProjectsAreOpen()) {
        logger.warn("No open projects found, can't execute the project.");
        return;
    }
    logger.info("Starting to build execution environment.");
    RunManager runManager = RunManager.getInstance(project);
    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    RunnerAndConfigurationSettingsImpl selectedConfiguration =
            getApplicationRunnerAndConfigurationSettings(runManager, appCon);
    ProgramRunner runner = getRunner(executor, selectedConfiguration);
    logger.info("Creating ExecutionEnvironment.");
    ExecutionEnvironment environment =
            new ExecutionEnvironment(
                    new DefaultRunExecutor(), runner, selectedConfiguration, project);
    try {
        logger.info("Executing project.");
        runner.execute(environment);
    } catch (ExecutionException e1) {
        JavaExecutionUtil.showExecutionErrorMessage(e1, "Error", project);
    }
}
 
Example #8
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 #9
Source File: BazelRunConfig.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NotNull
@Override
public LaunchState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
  final BazelFields launchFields = fields.copy();
  try {
    launchFields.checkRunnable(env.getProject());
  }
  catch (RuntimeConfigurationError e) {
    throw new ExecutionException(e);
  }

  final Workspace workspace = fields.getWorkspace(getProject());
  final VirtualFile workspaceRoot = workspace.getRoot();
  final RunMode mode = RunMode.fromEnv(env);
  final Module module = ModuleUtil.findModuleForFile(workspaceRoot, env.getProject());

  final LaunchState.CreateAppCallback createAppCallback = (@Nullable FlutterDevice device) -> {
    if (device == null) return null;

    final GeneralCommandLine command = getCommand(env, device);
    return FlutterApp.start(env, env.getProject(), module, mode, device, command,
                            StringUtil.capitalize(mode.mode()) + "BazelApp", "StopBazelApp");
  };

  return new LaunchState(env, workspaceRoot, workspaceRoot, this, createAppCallback);
}
 
Example #10
Source File: Unity3dAttachRunner.java    From consulo-unity3d with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
private static void setRunDescriptor(AsyncResult<RunContentDescriptor> result,
		ExecutionEnvironment environment,
		ExecutionResult executionResult,
		@Nullable UnityProcess process,
		@Nullable UnityProcess editorProcess)
{
	if(process == null)
	{
		result.rejectWithThrowable(new ExecutionException("Process not find for attach"));
		return;
	}

	boolean isEditor = editorProcess != null && Comparing.equal(editorProcess, process);

	try
	{
		result.setDone(runContentDescriptor(executionResult, environment, process, null, isEditor));
	}
	catch(ExecutionException e)
	{
		result.rejectWithThrowable(e);
	}
}
 
Example #11
Source File: GeneralToSMTRunnerEventsConvertorTest.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  TestConsoleProperties consoleProperties = createConsoleProperties();
  TestConsoleProperties.HIDE_PASSED_TESTS.set(consoleProperties, false);
  TestConsoleProperties.OPEN_FAILURE_LINE.set(consoleProperties, false);
  TestConsoleProperties.SCROLL_TO_SOURCE.set(consoleProperties, false);
  TestConsoleProperties.SELECT_FIRST_DEFECT.set(consoleProperties, false);
  TestConsoleProperties.TRACK_RUNNING_TEST.set(consoleProperties, false);

  final ExecutionEnvironment environment = new ExecutionEnvironment();
  myMockResettablePrinter = new MockPrinter(true);
  myConsole = new MyConsoleView(consoleProperties, environment);
  myConsole.initUI();
  myResultsViewer = myConsole.getResultsViewer();
  myEventsProcessor = new GeneralToSMTRunnerEventsConvertor(consoleProperties.getProject(), myResultsViewer.getTestsRootNode(), "SMTestFramework");
  myEventsProcessor.addEventsListener(myResultsViewer);
  myTreeModel = myResultsViewer.getTreeView().getModel();

  myEventsProcessor.onStartTesting();
}
 
Example #12
Source File: BlazeHotSwapManager.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Nullable
static HotSwappableDebugSession findHotSwappableBlazeDebuggerSession(Project project) {
  DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
  DebuggerSession session = debuggerManager.getContext().getDebuggerSession();
  if (session == null || !session.isAttached()) {
    return null;
  }
  JavaDebugProcess process = session.getProcess().getXdebugProcess();
  if (process == null) {
    return null;
  }
  ExecutionEnvironment env = ((XDebugSessionImpl) process.getSession()).getExecutionEnvironment();
  if (env == null || ClassFileManifestBuilder.getManifest(env) == null) {
    return null;
  }
  RunProfile runProfile = env.getRunProfile();
  if (!(runProfile instanceof BlazeCommandRunConfiguration)) {
    return null;
  }
  return new HotSwappableDebugSession(session, env, (BlazeCommandRunConfiguration) runProfile);
}
 
Example #13
Source File: BlazeAndroidRunState.java    From intellij with Apache License 2.0 6 votes vote down vote up
public BlazeAndroidRunState(
    Module module,
    ExecutionEnvironment env,
    LaunchOptions.Builder launchOptionsBuilder,
    boolean isDebug,
    DeviceSession deviceSession,
    BlazeAndroidRunContext runContext,
    BlazeAndroidRunConfigurationDebuggerManager debuggerManager) {
  this.module = module;
  this.env = env;
  this.launchConfigName = env.getRunProfile().getName();
  this.deviceSession = deviceSession;
  this.runContext = runContext;
  this.launchOptionsBuilder = launchOptionsBuilder;
  this.isDebug = isDebug;
  this.debuggerManager = debuggerManager;
}
 
Example #14
Source File: TestLaunchState.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
static TestLaunchState create(@NotNull ExecutionEnvironment env, @NotNull TestConfig config) throws ExecutionException {
  final TestFields fields = config.getFields();
  try {
    fields.checkRunnable(env.getProject());
  }
  catch (RuntimeConfigurationError e) {
    throw new ExecutionException(e);
  }
  FileDocumentManager.getInstance().saveAllDocuments();

  final VirtualFile fileOrDir = fields.getFileOrDir();
  assert (fileOrDir != null);

  final PubRoot pubRoot = fields.getPubRoot(env.getProject());
  assert (pubRoot != null);

  final FlutterSdk sdk = FlutterSdk.getFlutterSdk(env.getProject());
  assert (sdk != null);
  final boolean testConsoleEnabled = sdk.getVersion().flutterTestSupportsMachineMode();

  final TestLaunchState launcher = new TestLaunchState(env, config, fileOrDir, pubRoot, testConsoleEnabled);
  DaemonConsoleView.install(launcher, env, pubRoot.getRoot());
  return launcher;
}
 
Example #15
Source File: BazelTestLaunchState.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static BazelTestLaunchState create(@NotNull ExecutionEnvironment env, @NotNull BazelTestConfig config) throws ExecutionException {
  final BazelTestFields fields = config.getFields();
  try {
    fields.checkRunnable(env.getProject());
  }
  catch (RuntimeConfigurationError e) {
    throw new ExecutionException(e);
  }
  FileDocumentManager.getInstance().saveAllDocuments();

  final VirtualFile virtualFile = fields.getFile();

  final BazelTestLaunchState launcher = new BazelTestLaunchState(env, config, virtualFile);
  final Workspace workspace = FlutterModuleUtils.getFlutterBazelWorkspace(env.getProject());
  if (workspace != null) {
    DaemonConsoleView.install(launcher, env, workspace.getRoot());
  }
  return launcher;
}
 
Example #16
Source File: AttachState.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AttachState(@NotNull ExecutionEnvironment env,
                   @NotNull VirtualFile workDir,
                   @NotNull VirtualFile sourceLocation,
                   @NotNull RunConfig runConfig,
                   @NotNull CreateAppCallback createAppCallback) {
  super(env, workDir, sourceLocation, runConfig, createAppCallback);
}
 
Example #17
Source File: DemoRunConfiguration.java    From intellij-sdk-docs with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment) {
  return new CommandLineState(executionEnvironment) {
    @NotNull
    @Override
    protected ProcessHandler startProcess() throws ExecutionException {
      GeneralCommandLine commandLine = new GeneralCommandLine(getOptions().getScriptName());
      OSProcessHandler processHandler = ProcessHandlerFactory.getInstance().createColoredProcessHandler(commandLine);
      ProcessTerminatedListener.attach(processHandler);
      return processHandler;
    }
  };
}
 
Example #18
Source File: ExternalSystemUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public static Pair<ProgramRunner, ExecutionEnvironment> createRunner(@Nonnull ExternalSystemTaskExecutionSettings taskSettings,
                                                                     @Nonnull String executorId,
                                                                     @Nonnull Project project,
                                                                     @Nonnull ProjectSystemId externalSystemId) {
  Executor executor = ExecutorRegistry.getInstance().getExecutorById(executorId);
  if (executor == null) return null;

  String runnerId = getRunnerId(executorId);
  if (runnerId == null) return null;

  ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(runnerId);
  if (runner == null) return null;

  AbstractExternalSystemTaskConfigurationType configurationType = findConfigurationType(externalSystemId);
  if (configurationType == null) return null;

  String name = AbstractExternalSystemTaskConfigurationType.generateName(project, taskSettings);
  RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createRunConfiguration(name, configurationType.getFactory());
  ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration)settings.getConfiguration();
  runConfiguration.getSettings().setExternalProjectPath(taskSettings.getExternalProjectPath());
  runConfiguration.getSettings().setTaskNames(ContainerUtil.newArrayList(taskSettings.getTaskNames()));
  runConfiguration.getSettings().setTaskDescriptions(ContainerUtil.newArrayList(taskSettings.getTaskDescriptions()));
  runConfiguration.getSettings().setVmOptions(taskSettings.getVmOptions());
  runConfiguration.getSettings().setScriptParameters(taskSettings.getScriptParameters());
  runConfiguration.getSettings().setExecutionName(taskSettings.getExecutionName());

  return Pair.create(runner, new ExecutionEnvironment(executor, runner, settings, project));
}
 
Example #19
Source File: DeploymentTaskImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public DeploymentTaskImpl(DeploymentSource source, D configuration, Project project, DebugConnector<?, ?> connector,
                          ExecutionEnvironment environment) {
  mySource = source;
  myConfiguration = configuration;
  myProject = project;
  myDebugConnector = connector;
  myExecutionEnvironment = environment;
}
 
Example #20
Source File: HaskellApplicationCommandLineState.java    From intellij-haskforce with Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
protected OSProcessHandler startProcess() throws ExecutionException {
    ExecutionEnvironment env = getEnvironment();
    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setWorkDirectory(env.getProject().getBasePath());
    // TODO: This should probably be a bit more generic than relying on `cabal run`.
    final HaskellBuildSettings buildSettings = HaskellBuildSettings.getInstance(myConfig.getProject());
    commandLine.setExePath(buildSettings.getCabalPath());
    ParametersList parametersList = commandLine.getParametersList();
    parametersList.add("run");
    parametersList.add("--with-ghc=" + buildSettings.getGhcPath());
    parametersList.addParametersString(myConfig.programArguments);
    return new OSProcessHandler(commandLine);
}
 
Example #21
Source File: ExecutionManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void compileAndRun(@Nonnull UIAccess uiAccess, @Nonnull Runnable startRunnable, @Nonnull ExecutionEnvironment environment, @Nullable Runnable onCancelRunnable) {
  long id = environment.getExecutionId();
  if (id == 0) {
    id = environment.assignNewExecutionId();
  }

  RunProfile profile = environment.getRunProfile();
  if (!(profile instanceof RunConfiguration)) {
    startRunnable.run();
    return;
  }

  final RunConfiguration runConfiguration = (RunConfiguration)profile;
  final List<BeforeRunTask> beforeRunTasks = RunManagerEx.getInstanceEx(myProject).getBeforeRunTasks(runConfiguration);
  if (beforeRunTasks.isEmpty()) {
    startRunnable.run();
  }
  else {
    DataContext context = environment.getDataContext();
    final DataContext projectContext = context != null ? context : SimpleDataContext.getProjectContext(myProject);

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

    runBeforeTask(beforeRunTasks, 0, id, environment, uiAccess, projectContext, runConfiguration, result);

    if (onCancelRunnable != null) {
      result.doWhenRejected(() -> uiAccess.give(onCancelRunnable));
    }

    result.doWhenDone(() -> {
      // important! Do not use DumbService.smartInvokeLater here because it depends on modality state
      // and execution of startRunnable could be skipped if modality state check fails
      uiAccess.give(() -> {
        if (!myProject.isDisposed()) {
          DumbService.getInstance(myProject).runWhenSmart(startRunnable);
        }
      });
    });
  }
}
 
Example #22
Source File: AttachState.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AttachState(@NotNull ExecutionEnvironment env,
                   @NotNull VirtualFile workDir,
                   @NotNull VirtualFile sourceLocation,
                   @NotNull RunConfig runConfig,
                   @NotNull CreateAppCallback createAppCallback) {
  super(env, workDir, sourceLocation, runConfig, createAppCallback);
}
 
Example #23
Source File: BlazeAndroidRunConfigurationDeployTargetManager.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
DeployTarget getDeployTarget(
    Executor executor, ExecutionEnvironment env, AndroidFacet facet, int runConfigId)
    throws ExecutionException {
  DeployTargetProvider currentTargetProvider = getCurrentDeployTargetProvider();
  Project project = env.getProject();

  DeployTarget deployTarget;

  if (currentTargetProvider.requiresRuntimePrompt(project)) {
    deployTarget =
        currentTargetProvider.showPrompt(
            executor,
            env,
            facet,
            getDeviceCount(),
            isAndroidTest,
            deployTargetStates,
            runConfigId,
            (device) -> LaunchCompatibility.YES);
    if (deployTarget == null) {
      return null;
    }
  } else {
    deployTarget = currentTargetProvider.getDeployTarget(env.getProject());
  }

  return deployTarget;
}
 
Example #24
Source File: BuildArtifactsBeforeRunTaskProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public AsyncResult<Void> executeTaskAsync(UIAccess uiAccess, DataContext context, RunConfiguration configuration, ExecutionEnvironment env, BuildArtifactsBeforeRunTask task) {
  AsyncResult<Void> result = AsyncResult.undefined();

  final List<Artifact> artifacts = new ArrayList<>();
  AccessRule.read(() -> {
    for (ArtifactPointer pointer : task.getArtifactPointers()) {
      ContainerUtil.addIfNotNull(artifacts, pointer.get());
    }
  });

  final CompileStatusNotification callback = (aborted, errors, warnings, compileContext) -> {
    if(!aborted && errors == 0) {
      result.setDone();
    }
    else {
      result.setRejected();
    }
  };

  final Condition<Compiler> compilerFilter = compiler -> compiler instanceof ArtifactsCompiler || compiler instanceof ArtifactAwareCompiler && ((ArtifactAwareCompiler)compiler).shouldRun(artifacts);

  uiAccess.give(() -> {
    final CompilerManager manager = CompilerManager.getInstance(myProject);
    manager.make(ArtifactCompileScope.createArtifactsScope(myProject, artifacts), compilerFilter, callback);
  }).doWhenRejectedWithThrowable(result::rejectWithThrowable);

  return result;
}
 
Example #25
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 #26
Source File: MavenDebugConfigurationType.java    From MavenHelper with Apache License 2.0 5 votes vote down vote up
public static void debugConfiguration(Project project, ProgramRunner.Callback callback,
		RunnerAndConfigurationSettings configSettings, Executor executor) {
	ProgramRunner runner = ProgramRunner.findRunnerById(DefaultDebugExecutor.EXECUTOR_ID);
	ExecutionEnvironment env = new ExecutionEnvironment(executor, runner, configSettings, project);

	try {
		runner.execute(env, callback);
	} catch (ExecutionException e) {
		MavenUtil.showError(project, "Failed to execute Maven goal", e);
	}
}
 
Example #27
Source File: XDebugSessionImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public XDebugSessionImpl(@Nullable ExecutionEnvironment environment,
                         @Nonnull XDebuggerManagerImpl debuggerManager,
                         @Nonnull String sessionName,
                         @Nullable Image icon,
                         boolean showTabOnSuspend,
                         @Nullable RunContentDescriptor contentToReuse) {
  myEnvironment = environment;
  mySessionName = sessionName;
  myDebuggerManager = debuggerManager;
  myShowTabOnSuspend = new AtomicBoolean(showTabOnSuspend);
  myProject = debuggerManager.getProject();
  ValueLookupManager.getInstance(myProject).startListening();
  myIcon = icon;

  XDebugSessionData oldSessionData = null;
  if (contentToReuse == null) {
    contentToReuse = environment != null ? environment.getContentToReuse() : null;
  }
  if (contentToReuse != null) {
    JComponent component = contentToReuse.getComponent();
    if (component != null) {
      oldSessionData = DataManager.getInstance().getDataContext(component).getData(XDebugSessionData.DATA_KEY);
    }
  }

  String currentConfigurationName = getConfigurationName();
  if (oldSessionData == null || !oldSessionData.getConfigurationName().equals(currentConfigurationName)) {
    oldSessionData = new XDebugSessionData(getWatchExpressions(), currentConfigurationName);
  }
  mySessionData = oldSessionData;
}
 
Example #28
Source File: RunContentManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public String getToolWindowIdByEnvironment(@Nonnull ExecutionEnvironment executionEnvironment) {
  // TODO [konstantin.aleev] Check remaining places where Executor.getToolWindowId() is used
  // Also there are some places where ToolWindowId.RUN or ToolWindowId.DEBUG are used directly.
  // For example, HotSwapProgressImpl.NOTIFICATION_GROUP. All notifications for this group is shown in Debug tool window,
  // however such notifications should be shown in Run Dashboard tool window, if run content is redirected to Run Dashboard tool window.
  String toolWindowId = getContentDescriptorToolWindowId(executionEnvironment.getRunnerAndConfigurationSettings());
  return toolWindowId != null ? toolWindowId : executionEnvironment.getExecutor().getToolWindowId();
}
 
Example #29
Source File: AppCommandLineState.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 5 votes vote down vote up
/**
 * Command line state when runner is launch
 *
 * @param environment
 * @param configuration
 */
public AppCommandLineState(@NotNull ExecutionEnvironment environment, @NotNull EmbeddedLinuxJVMRunConfiguration configuration) {
    super(environment);
    this.configuration = configuration;
    this.runnerSettings = environment.getRunnerSettings();
    this.project = environment.getProject();
    this.isDebugMode = runnerSettings instanceof DebuggingRunnerData;
    this.outputForwarder = new EmbeddedLinuxJVMOutputForwarder(EmbeddedLinuxJVMConsoleView.getInstance(project));
    this.outputForwarder.attachTo(null);
}
 
Example #30
Source File: XDebuggerTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
public boolean isUnderRemoteDebug() {
  DataContext context = DataManager.getInstance().getDataContext(this);
  ExecutionEnvironment env = context.getData(LangDataKeys.EXECUTION_ENVIRONMENT);
  if (env != null && env.getRunProfile() instanceof RemoteRunProfile) {
    return true;
  }
  return false;
}