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;
}
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);
}
}
}
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;
}
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;
}
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);
}
Aggregations