com.intellij.execution.configurations.RunConfigurationBase Java Examples
The following examples show how to use
com.intellij.execution.configurations.RunConfigurationBase.
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: DebuggerSessionTabBase.java From consulo with Apache License 2.0 | 6 votes |
protected void attachNotificationTo(final Content content) { if (myConsole instanceof ObservableConsoleView) { ObservableConsoleView observable = (ObservableConsoleView)myConsole; observable.addChangeListener(types -> { if (types.contains(ConsoleViewContentType.ERROR_OUTPUT) || types.contains(ConsoleViewContentType.NORMAL_OUTPUT)) { content.fireAlert(); } }, content); RunProfile profile = getRunProfile(); if (profile instanceof RunConfigurationBase && !ApplicationManager.getApplication().isUnitTestMode()) { observable.addChangeListener( new RunContentBuilder.ConsoleToFrontListener((RunConfigurationBase)profile, myProject, DefaultDebugExecutor.getDebugExecutorInstance(), myRunContentDescriptor, myUi), content); } } }
Example #2
Source File: CoverageEnabledConfiguration.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public static CoverageEnabledConfiguration getOrCreate(@Nonnull final RunConfigurationBase runConfiguration) { CoverageEnabledConfiguration configuration = runConfiguration.getCopyableUserData(COVERAGE_KEY); if (configuration == null) { for (CoverageEngine engine : CoverageEngine.EP_NAME.getExtensionList()) { if (engine.isApplicableTo(runConfiguration)) { configuration = engine.createCoverageEnabledConfiguration(runConfiguration); break; } } LOG.assertTrue(configuration != null, "Coverage enabled run configuration wasn't found for run configuration: " + runConfiguration.getName() + ", type = " + runConfiguration.getClass().getName()); runConfiguration.putCopyableUserData(COVERAGE_KEY, configuration); } return configuration; }
Example #3
Source File: RunTab.java From consulo with Apache License 2.0 | 5 votes |
protected final void initLogConsoles(@Nonnull RunProfile runConfiguration, @Nonnull RunContentDescriptor contentDescriptor, @Nullable ExecutionConsole console) { ProcessHandler processHandler = contentDescriptor.getProcessHandler(); if (runConfiguration instanceof RunConfigurationBase) { RunConfigurationBase configuration = (RunConfigurationBase)runConfiguration; if (myManager == null) { myManager = new LogFilesManager(getLogConsoleManager()); } myManager.addLogConsoles(configuration, processHandler); if (processHandler != null) { OutputFileUtil.attachDumpListener(configuration, processHandler, console); } } }
Example #4
Source File: CoverageSuitesBundle.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable public RunConfigurationBase getRunConfiguration() { for (CoverageSuite suite : mySuites) { if (suite instanceof BaseCoverageSuite) { final RunConfigurationBase configuration = ((BaseCoverageSuite)suite).getConfiguration(); if (configuration != null) { return configuration; } } } return null; }
Example #5
Source File: CoverageSuitesBundle.java From consulo with Apache License 2.0 | 5 votes |
private GlobalSearchScope getSearchScopeInner(Project project) { final RunConfigurationBase configuration = getRunConfiguration(); if (configuration instanceof ModuleBasedConfiguration) { final Module module = ((ModuleBasedConfiguration)configuration).getConfigurationModule().getModule(); if (module != null) { return GlobalSearchScope.moduleRuntimeScope(module, isTrackTestFolders()); } } return isTrackTestFolders() ? GlobalSearchScope.projectScope(project) : GlobalSearchScopesCore.projectProductionScope(project); }
Example #6
Source File: CoverageDataManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void attachToProcess(@Nonnull final ProcessHandler handler, @Nonnull final RunConfigurationBase configuration, final RunnerSettings runnerSettings) { handler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(final ProcessEvent event) { processGatheredCoverage(configuration, runnerSettings); } }); }
Example #7
Source File: CoverageHelper.java From consulo with Apache License 2.0 | 5 votes |
public static void attachToProcess(@Nonnull RunConfigurationBase configuration, @Nonnull ProcessHandler handler, RunnerSettings runnerSettings) { resetCoverageSuit(configuration); // attach to process termination listener CoverageDataManager.getInstance(configuration.getProject()).attachToProcess(handler, configuration, runnerSettings); }
Example #8
Source File: CoverageDataManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
public static void processGatheredCoverage(RunConfigurationBase configuration) { final Project project = configuration.getProject(); if (project.isDisposed()) return; final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(project); final CoverageEnabledConfiguration coverageEnabledConfiguration = CoverageEnabledConfiguration.getOrCreate(configuration); //noinspection ConstantConditions final CoverageSuite coverageSuite = coverageEnabledConfiguration.getCurrentCoverageSuite(); if (coverageSuite != null) { ((BaseCoverageSuite)coverageSuite).setConfiguration(configuration); coverageDataManager.coverageGathered(coverageSuite); } }
Example #9
Source File: RunContentBuilder.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private RunContentDescriptor createDescriptor() { final RunProfile profile = myEnvironment.getRunProfile(); if (ApplicationManager.getApplication().isUnitTestMode()) { return new RunContentDescriptor(profile, myExecutionResult, myUi); } final ExecutionConsole console = myExecutionResult.getExecutionConsole(); RunContentDescriptor contentDescriptor = new RunContentDescriptor(profile, myExecutionResult, myUi); if (console != null) { if (console instanceof ExecutionConsoleEx) { ((ExecutionConsoleEx)console).buildUi(myUi); } else { buildConsoleUiDefault(myUi, console); } initLogConsoles(profile, contentDescriptor, console); } myUi.getOptions().setLeftToolbar(createActionToolbar(contentDescriptor), ActionPlaces.UNKNOWN); if (profile instanceof RunConfigurationBase) { if (console instanceof ObservableConsoleView && !ApplicationManager.getApplication().isUnitTestMode()) { ((ObservableConsoleView)console).addChangeListener(new ConsoleToFrontListener((RunConfigurationBase)profile, myProject, myEnvironment.getExecutor(), contentDescriptor, myUi), this); } } return contentDescriptor; }
Example #10
Source File: RunContentBuilder.java From consulo with Apache License 2.0 | 5 votes |
public ConsoleToFrontListener(@Nonnull RunConfigurationBase runConfigurationBase, @Nonnull Project project, @Nonnull Executor executor, @Nonnull RunContentDescriptor runContentDescriptor, @Nonnull RunnerLayoutUi ui) { myRunConfigurationBase = runConfigurationBase; myProject = project; myExecutor = executor; myRunContentDescriptor = runContentDescriptor; myUi = ui; }
Example #11
Source File: CoverageEnabledConfiguration.java From consulo with Apache License 2.0 | 5 votes |
public static boolean isApplicableTo(@Nonnull final RunConfigurationBase runConfiguration) { final CoverageEnabledConfiguration configuration = runConfiguration.getCopyableUserData(COVERAGE_KEY); if (configuration != null) { return true; } for (CoverageEngine engine : CoverageEngine.EP_NAME.getExtensionList()) { if (engine.isApplicableTo(runConfiguration)) { return true; } } return false; }
Example #12
Source File: LogConfigurationPanel.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void resetEditorFrom(final RunConfigurationBase configuration) { ArrayList<LogFileOptions> list = new ArrayList<LogFileOptions>(); final ArrayList<LogFileOptions> logFiles = configuration.getLogFiles(); for (LogFileOptions setting : logFiles) { list.add( new LogFileOptions(setting.getName(), setting.getPathPattern(), setting.isEnabled(), setting.isSkipContent(), setting.isShowAll())); } myLog2Predefined.clear(); myUnresolvedPredefined.clear(); final ArrayList<PredefinedLogFile> predefinedLogFiles = configuration.getPredefinedLogFiles(); for (PredefinedLogFile predefinedLogFile : predefinedLogFiles) { PredefinedLogFile logFile = new PredefinedLogFile(predefinedLogFile); final LogFileOptions options = configuration.getOptionsForPredefinedLogFile(logFile); if (options != null) { myLog2Predefined.put(options, logFile); list.add(options); } else { myUnresolvedPredefined.add(logFile); } } myModel.setItems(list); final boolean redirectOutputToFile = configuration.isSaveOutputToFile(); myRedirectOutputCb.setSelected(redirectOutputToFile); final String fileOutputPath = configuration.getOutputFilePath(); myOutputFile.setText(fileOutputPath != null ? FileUtil.toSystemDependentName(fileOutputPath) : ""); myOutputFile.setEnabled(redirectOutputToFile); myShowConsoleOnStdOutCb.setSelected(configuration.isShowConsoleOnStdOut()); myShowConsoleOnStdErrCb.setSelected(configuration.isShowConsoleOnStdErr()); }
Example #13
Source File: LogConfigurationPanel.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void applyEditorTo(final RunConfigurationBase configuration) throws ConfigurationException { myFilesTable.stopEditing(); configuration.removeAllLogFiles(); configuration.removeAllPredefinedLogFiles(); for (int i = 0; i < myModel.getRowCount(); i++) { LogFileOptions options = (LogFileOptions)myModel.getValueAt(i, 1); if (Comparing.equal(options.getPathPattern(), "")) { continue; } final Boolean checked = (Boolean)myModel.getValueAt(i, 0); final Boolean skipped = (Boolean)myModel.getValueAt(i, 2); final PredefinedLogFile predefined = myLog2Predefined.get(options); if (predefined != null) { configuration.addPredefinedLogFile(new PredefinedLogFile(predefined.getId(), options.isEnabled())); } else { configuration .addLogFile(options.getPathPattern(), options.getName(), checked.booleanValue(), skipped.booleanValue(), options.isShowAll()); } } for (PredefinedLogFile logFile : myUnresolvedPredefined) { configuration.addPredefinedLogFile(logFile); } final String text = myOutputFile.getText(); configuration.setFileOutputPath(StringUtil.isEmpty(text) ? null : FileUtil.toSystemIndependentName(text)); configuration.setSaveOutputToFile(myRedirectOutputCb.isSelected()); configuration.setShowConsoleOnStdOut(myShowConsoleOnStdOutCb.isSelected()); configuration.setShowConsoleOnStdErr(myShowConsoleOnStdErrCb.isSelected()); }
Example #14
Source File: CoverageHelper.java From consulo with Apache License 2.0 | 5 votes |
public static void resetCoverageSuit(RunConfigurationBase configuration) { final CoverageEnabledConfiguration covConfig = CoverageEnabledConfiguration.getOrCreate(configuration); // reset coverage suite covConfig.setCurrentCoverageSuite(null); // register new coverage suite final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(configuration.getProject()); covConfig.setCurrentCoverageSuite(coverageDataManager.addCoverageSuite(covConfig)); }
Example #15
Source File: LogConsoleManagerBase.java From consulo with Apache License 2.0 | 5 votes |
private void doAddLogConsole(@Nonnull final LogConsoleBase log, String id, Image icon, @Nullable RunProfile runProfile) { if (runProfile instanceof RunConfigurationBase) { ((RunConfigurationBase)runProfile).customizeLogConsole(log); } log.attachStopLogConsoleTrackingListener(getProcessHandler()); addAdditionalTabComponent(log, id, icon); getUi().addListener(new ContentManagerAdapter() { @Override public void selectionChanged(final ContentManagerEvent event) { log.activate(); } }, log); }
Example #16
Source File: PantsClasspathRunConfigurationExtension.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Nullable private <T extends RunConfigurationBase> Module findPantsModule(T configuration) { if (!(configuration instanceof ModuleBasedConfiguration)) { return null; } final RunConfigurationModule runConfigurationModule = ((ModuleBasedConfiguration) configuration).getConfigurationModule(); final Module module = runConfigurationModule.getModule(); if (module == null || !PantsUtil.isPantsModule(module)) { return null; } return module; }
Example #17
Source File: PantsClasspathRunConfigurationExtension.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
/** * The goal of this function is to find classpath for IntelliJ JUnit/Scala runner. * <p/> * This function will fail if the projects' Pants doesn't support `--export-classpath-manifest-jar-only`. * It also assumes that Pants has created a manifest jar that contains all the classpath links for the * particular test that's being run. */ @Override public <T extends RunConfigurationBase> void updateJavaParameters( T configuration, @NotNull JavaParameters params, RunnerSettings runnerSettings ) throws ExecutionException { List<BeforeRunTask<?>> tasks = ((RunManagerImpl) RunManager.getInstance(configuration.getProject())).getBeforeRunTasks(configuration); boolean builtByPants = tasks.stream().anyMatch(s -> s.getProviderId().equals(PantsMakeBeforeRun.ID)); // Not built by Pants means it was built by IntelliJ, in which case we don't need to change the classpath. if (!builtByPants) { return; } final Module module = findPantsModule(configuration); if (module == null) { return; } Set<String> pathsAllowed = calculatePathsAllowed(params); final PathsList classpath = params.getClassPath(); List<String> classpathToKeep = classpath.getPathList().stream() .filter(cp -> pathsAllowed.stream().anyMatch(cp::contains)).collect(Collectors.toList()); classpath.clear(); classpath.addAll(classpathToKeep); VirtualFile manifestJar = PantsUtil.findProjectManifestJar(configuration.getProject()) .orElseThrow(() -> new ExecutionException("manifest.jar is not found. It should be generated by `./pants export-classpath ...`")); classpath.add(manifestJar.getPath()); PantsExternalMetricsListenerManager.getInstance().logTestRunner(configuration); }
Example #18
Source File: LogFilesManager.java From consulo with Apache License 2.0 | 5 votes |
public void addLogConsoles(@Nonnull RunConfigurationBase runConfiguration, @Nullable ProcessHandler startedProcess) { for (LogFileOptions logFileOptions : runConfiguration.getAllLogFiles()) { if (logFileOptions.isEnabled()) { addConfigurationConsoles(logFileOptions, Conditions.<String>alwaysTrue(), logFileOptions.getPaths(), runConfiguration); } } runConfiguration.createAdditionalTabComponents(myManager, startedProcess); }
Example #19
Source File: LogFilesManager.java From consulo with Apache License 2.0 | 5 votes |
private void addConfigurationConsoles(@Nonnull LogFileOptions logFile, @Nonnull Condition<String> shouldInclude, @Nonnull Set<String> paths, @Nonnull RunConfigurationBase runConfiguration) { if (paths.isEmpty()) { return; } TreeMap<String, String> titleToPath = new TreeMap<String, String>(); if (paths.size() == 1) { String path = paths.iterator().next(); if (shouldInclude.value(path)) { titleToPath.put(logFile.getName(), path); } } else { for (String path : paths) { if (shouldInclude.value(path)) { String title = new File(path).getName(); if (titleToPath.containsKey(title)) { title = path; } titleToPath.put(title, path); } } } for (String title : titleToPath.keySet()) { String path = titleToPath.get(title); assert path != null; myManager.addLogConsole(title, path, logFile.getCharset(), logFile.isSkipContent() ? new File(path).length() : 0, runConfiguration); } }
Example #20
Source File: CompileStepBeforeRun.java From consulo with Apache License 2.0 | 5 votes |
@Override public MakeBeforeRunTask createTask(RunConfiguration configuration) { MakeBeforeRunTask task = null; if (!(configuration instanceof Suppressor) && configuration instanceof RunProfileWithCompileBeforeLaunchOption) { task = new MakeBeforeRunTask(); if (configuration instanceof RunConfigurationBase) { task.setEnabled(((RunConfigurationBase)configuration).isCompileBeforeLaunchAddedByDefault()); } } return task; }
Example #21
Source File: CoverageHelper.java From consulo with Apache License 2.0 | 4 votes |
public static void doWriteExternal(RunConfigurationBase runConfiguration, Element element) throws WriteExternalException { final CoverageEnabledConfiguration covConf = CoverageEnabledConfiguration.getOrCreate(runConfiguration); covConf.writeExternal(element); }
Example #22
Source File: CompileStepBeforeRun.java From consulo with Apache License 2.0 | 4 votes |
static AsyncResult<Void> doMake(UIAccess uiAccess, final Project myProject, final RunConfiguration configuration, final boolean ignoreErrors) { if (!(configuration instanceof RunProfileWithCompileBeforeLaunchOption)) { return AsyncResult.rejected(); } if (configuration instanceof RunConfigurationBase && ((RunConfigurationBase)configuration).excludeCompileBeforeLaunchOption()) { return AsyncResult.resolved(); } final RunProfileWithCompileBeforeLaunchOption runConfiguration = (RunProfileWithCompileBeforeLaunchOption)configuration; AsyncResult<Void> result = AsyncResult.undefined(); try { final CompileStatusNotification callback = (aborted, errors, warnings, compileContext) -> { if ((errors == 0 || ignoreErrors) && !aborted) { result.setDone(); } else { result.setRejected(); } }; TransactionGuard.submitTransaction(myProject, () -> { CompileScope scope; final CompilerManager compilerManager = CompilerManager.getInstance(myProject); if (Comparing.equal(Boolean.TRUE.toString(), System.getProperty(MAKE_PROJECT_ON_RUN_KEY))) { // user explicitly requested whole-project make scope = compilerManager.createProjectCompileScope(); } else { final Module[] modules = runConfiguration.getModules(); if (modules.length > 0) { for (Module module : modules) { if (module == null) { LOG.error("RunConfiguration should not return null modules. Configuration=" + runConfiguration.getName() + "; class=" + runConfiguration.getClass().getName()); } } scope = compilerManager.createModulesCompileScope(modules, true); } else { scope = compilerManager.createProjectCompileScope(); } } if (!myProject.isDisposed()) { compilerManager.make(scope, callback); } else { result.setRejected(); } }); } catch (Exception e) { result.rejectWithThrowable(e); } return result; }
Example #23
Source File: CoverageDataManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void processGatheredCoverage(@Nonnull RunConfigurationBase configuration, RunnerSettings runnerSettings) { if (runnerSettings instanceof CoverageRunnerData) { processGatheredCoverage(configuration); } }
Example #24
Source File: LogConsoleManagerBase.java From consulo with Apache License 2.0 | 4 votes |
@Override public void addLogConsole(@Nonnull String name, @Nonnull String path, @Nonnull Charset charset, long skippedContent, @Nonnull RunConfigurationBase runConfiguration) { addLogConsole(name, path, charset, skippedContent, getDefaultIcon(), runConfiguration); }
Example #25
Source File: BlazeCoverageEngine.java From intellij with Apache License 2.0 | 4 votes |
@Override public boolean isApplicableTo(@Nullable RunConfigurationBase config) { return CoverageUtils.isApplicableTo(config); }
Example #26
Source File: CoverageEnabledConfiguration.java From consulo with Apache License 2.0 | 4 votes |
public RunConfigurationBase getConfiguration() { return myConfiguration; }
Example #27
Source File: BlazeCoverageEngine.java From intellij with Apache License 2.0 | 4 votes |
@Override public boolean canHavePerTestCoverage(@Nullable RunConfigurationBase runConfigurationBase) { return false; }
Example #28
Source File: BlazeCoverageEngine.java From intellij with Apache License 2.0 | 4 votes |
@Override public CoverageEnabledConfiguration createCoverageEnabledConfiguration( @Nullable RunConfigurationBase config) { return new BlazeCoverageEnabledConfiguration(config); }
Example #29
Source File: BlazeCoverageEnabledConfiguration.java From intellij with Apache License 2.0 | 4 votes |
public BlazeCoverageEnabledConfiguration(RunConfigurationBase configuration) { super(configuration); setCoverageRunner(CoverageRunner.getInstance(BlazeCoverageRunner.class)); }
Example #30
Source File: DeployableJarRunConfigurationProducer.java From intellij with Apache License 2.0 | 4 votes |
private void setDeployableJarGeneratorTask(RunConfigurationBase config) { Project project = config.getProject(); RunManagerEx runManager = RunManagerEx.getInstanceEx(project); runManager.setBeforeRunTasks( config, ImmutableList.of(new GenerateDeployableJarTaskProvider.Task())); }