Search in sources :

Example 16 with RunProfile

use of com.intellij.execution.configurations.RunProfile in project intellij-community by JetBrains.

the class TestsUIUtil method getData.

@Nullable
public static Object getData(final AbstractTestProxy testProxy, final String dataId, final TestFrameworkRunningModel model) {
    final TestConsoleProperties properties = model.getProperties();
    final Project project = properties.getProject();
    if (testProxy == null)
        return null;
    if (AbstractTestProxy.DATA_KEY.is(dataId))
        return testProxy;
    if (CommonDataKeys.NAVIGATABLE.is(dataId))
        return getOpenFileDescriptor(testProxy, model);
    if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
        final Location location = testProxy.getLocation(project, properties.getScope());
        if (location != null) {
            final PsiElement element = location.getPsiElement();
            return element.isValid() ? element : null;
        } else {
            return null;
        }
    }
    if (Location.DATA_KEY.is(dataId))
        return testProxy.getLocation(project, properties.getScope());
    if (RunConfiguration.DATA_KEY.is(dataId)) {
        final RunProfile configuration = properties.getConfiguration();
        if (configuration instanceof RunConfiguration) {
            return configuration;
        }
    }
    return null;
}
Also used : Project(com.intellij.openapi.project.Project) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) RunProfile(com.intellij.execution.configurations.RunProfile) PsiElement(com.intellij.psi.PsiElement) Location(com.intellij.execution.Location) Nullable(org.jetbrains.annotations.Nullable)

Example 17 with RunProfile

use of com.intellij.execution.configurations.RunProfile in project intellij-community by JetBrains.

the class DebuggerSessionTabBase method attachNotificationTo.

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);
        }
    }
}
Also used : RunConfigurationBase(com.intellij.execution.configurations.RunConfigurationBase) ObservableConsoleView(com.intellij.execution.ui.ObservableConsoleView) RunProfile(com.intellij.execution.configurations.RunProfile) RunContentBuilder(com.intellij.execution.runners.RunContentBuilder)

Example 18 with RunProfile

use of com.intellij.execution.configurations.RunProfile in project intellij-community by JetBrains.

the class AntRunProfileState method execute.

@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    final RunProfile profile = myEnvironment.getRunProfile();
    if (profile instanceof AntRunConfiguration) {
        final AntRunConfiguration runConfig = (AntRunConfiguration) profile;
        if (runConfig.getTarget() == null) {
            return null;
        }
        final ProcessHandler processHandler = ExecutionHandler.executeRunConfiguration(runConfig, myEnvironment.getDataContext(), runConfig.getProperties(), AntBuildListener.NULL);
        if (processHandler == null) {
            return null;
        }
        return new DefaultExecutionResult(null, processHandler);
    }
    return null;
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) ProcessHandler(com.intellij.execution.process.ProcessHandler) RunProfile(com.intellij.execution.configurations.RunProfile) Nullable(org.jetbrains.annotations.Nullable)

Example 19 with RunProfile

use of com.intellij.execution.configurations.RunProfile in project intellij-community by JetBrains.

the class PyEduDebugRunner method getScriptName.

@Nullable
private static String getScriptName(PythonCommandLineState pyState) {
    ExecutionEnvironment environment = pyState.getEnvironment();
    if (environment == null) {
        return null;
    }
    RunProfile runProfile = environment.getRunProfile();
    if (runProfile instanceof PythonRunConfiguration) {
        String name = FileUtil.toSystemIndependentName(((PythonRunConfiguration) runProfile).getScriptName());
        return SystemInfo.isWindows ? name.toLowerCase() : name;
    }
    return null;
}
Also used : ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) PythonRunConfiguration(com.jetbrains.python.run.PythonRunConfiguration) RunProfile(com.intellij.execution.configurations.RunProfile) Nullable(org.jetbrains.annotations.Nullable)

Example 20 with RunProfile

use of com.intellij.execution.configurations.RunProfile in project intellij-community by JetBrains.

the class PythonRunner method doExecute.

@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
    FileDocumentManager.getInstance().saveAllDocuments();
    ExecutionResult executionResult;
    RunProfile profile = env.getRunProfile();
    if (state instanceof PythonCommandLineState && profile instanceof CommandLinePatcher) {
        executionResult = ((PythonCommandLineState) state).execute(env.getExecutor(), (CommandLinePatcher) profile);
    } else {
        executionResult = state.execute(env.getExecutor(), this);
    }
    return DefaultProgramRunnerKt.showRunContent(executionResult, env);
}
Also used : ExecutionResult(com.intellij.execution.ExecutionResult) RunProfile(com.intellij.execution.configurations.RunProfile)

Aggregations

RunProfile (com.intellij.execution.configurations.RunProfile)21 NotNull (org.jetbrains.annotations.NotNull)7 ProcessHandler (com.intellij.execution.process.ProcessHandler)6 Nullable (org.jetbrains.annotations.Nullable)6 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)5 Project (com.intellij.openapi.project.Project)5 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)4 RunConfigurationBase (com.intellij.execution.configurations.RunConfigurationBase)4 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)4 ExecutionException (com.intellij.execution.ExecutionException)3 ExecutionResult (com.intellij.execution.ExecutionResult)3 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)3 ProcessEvent (com.intellij.execution.process.ProcessEvent)3 ExecutionEnvironmentBuilder (com.intellij.execution.runners.ExecutionEnvironmentBuilder)3 Module (com.intellij.openapi.module.Module)3 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)2 CompatibilityAwareRunProfile (com.intellij.execution.configuration.CompatibilityAwareRunProfile)2 RunProfileState (com.intellij.execution.configurations.RunProfileState)2 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)2 ProgramRunner (com.intellij.execution.runners.ProgramRunner)2