use of com.intellij.execution.configurations.RunProfile in project intellij-community by JetBrains.
the class ImportedTestRunnableState method execute.
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
final MyEmptyProcessHandler handler = new MyEmptyProcessHandler();
final SMTRunnerConsoleProperties properties = myRunProfile.getProperties();
RunProfile configuration;
final String frameworkName;
if (properties != null) {
configuration = properties.getConfiguration();
frameworkName = properties.getTestFrameworkName();
} else {
configuration = myRunProfile;
frameworkName = "Import Test Results";
}
final ImportedTestConsoleProperties consoleProperties = new ImportedTestConsoleProperties(properties, myFile, handler, myRunProfile.getProject(), configuration, frameworkName, executor);
final BaseTestsOutputConsoleView console = SMTestRunnerConnectionUtil.createConsole(consoleProperties.getTestFrameworkName(), consoleProperties);
final JComponent component = console.getComponent();
AbstractRerunFailedTestsAction rerunFailedTestsAction = null;
if (component instanceof TestFrameworkRunningModel) {
rerunFailedTestsAction = consoleProperties.createRerunFailedTestsAction(console);
if (rerunFailedTestsAction != null) {
rerunFailedTestsAction.setModelProvider(() -> (TestFrameworkRunningModel) component);
}
}
console.attachToProcess(handler);
final DefaultExecutionResult result = new DefaultExecutionResult(console, handler);
if (rerunFailedTestsAction != null) {
result.setRestartActions(rerunFailedTestsAction);
}
return result;
}
use of com.intellij.execution.configurations.RunProfile in project android by JetBrains.
the class AndroidProgramRunner method doExecute.
@Override
protected RunContentDescriptor doExecute(@NotNull final RunProfileState state, @NotNull final ExecutionEnvironment env) throws ExecutionException {
boolean showRunContent = env.getRunProfile() instanceof AndroidTestRunConfiguration;
RunnerAndConfigurationSettings runnerAndConfigurationSettings = env.getRunnerAndConfigurationSettings();
if (runnerAndConfigurationSettings != null) {
runnerAndConfigurationSettings.setActivateToolWindowBeforeRun(showRunContent);
}
RunContentDescriptor descriptor = super.doExecute(state, env);
if (descriptor != null) {
ProcessHandler processHandler = descriptor.getProcessHandler();
assert processHandler != null;
RunProfile runProfile = env.getRunProfile();
int uniqueId = runProfile instanceof RunConfigurationBase ? ((RunConfigurationBase) runProfile).getUniqueID() : -1;
AndroidSessionInfo sessionInfo = new AndroidSessionInfo(processHandler, descriptor, uniqueId, env.getExecutor().getId(), InstantRunUtils.isInstantRunEnabled(env));
processHandler.putUserData(AndroidSessionInfo.KEY, sessionInfo);
}
return descriptor;
}
use of com.intellij.execution.configurations.RunProfile in project intellij-plugins by JetBrains.
the class CfmlRunner method doExecute.
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
final RunProfile runProfileRaw = env.getRunProfile();
if (runProfileRaw instanceof CfmlRunConfiguration) {
FileDocumentManager.getInstance().saveAllDocuments();
final CfmlRunConfiguration runProfile = (CfmlRunConfiguration) runProfileRaw;
//check if CfmlRunConfiguration generated from default server http://localhost:8500/
if (runProfile.isFromDefaultHost()) {
showDefaultRunConfigWarn(env, runProfile);
} else {
final CfmlRunnerParameters params = runProfile.getRunnerParameters();
BrowserLauncher.getInstance().browse(params.getUrl(), params.getCustomBrowser(), env.getProject());
}
return null;
} else {
return DefaultProgramRunnerKt.executeState(state, env, this);
}
}
use of com.intellij.execution.configurations.RunProfile in project intellij-plugins by JetBrains.
the class DartRunner method doExecuteDartDebug.
private RunContentDescriptor doExecuteDartDebug(@NotNull final RunProfileState state, @NotNull final ExecutionEnvironment env, @Nullable final String dasExecutionContextId) throws RuntimeConfigurationError, ExecutionException {
final DartSdk sdk = DartSdk.getDartSdk(env.getProject());
// already checked
assert (sdk != null);
final RunProfile runConfiguration = env.getRunProfile();
final VirtualFile contextFileOrDir;
VirtualFile currentWorkingDirectory;
final ExecutionResult executionResult;
final String debuggingHost;
final int observatoryPort;
if (runConfiguration instanceof DartRunConfigurationBase) {
contextFileOrDir = ((DartRunConfigurationBase) runConfiguration).getRunnerParameters().getDartFileOrDirectory();
final String cwd = ((DartRunConfigurationBase) runConfiguration).getRunnerParameters().computeProcessWorkingDirectory(env.getProject());
currentWorkingDirectory = LocalFileSystem.getInstance().findFileByPath((cwd));
executionResult = state.execute(env.getExecutor(), this);
if (executionResult == null) {
return null;
}
debuggingHost = null;
observatoryPort = ((DartCommandLineRunningState) state).getObservatoryPort();
} else if (runConfiguration instanceof DartRemoteDebugConfiguration) {
final String path = ((DartRemoteDebugConfiguration) runConfiguration).getParameters().getDartProjectPath();
contextFileOrDir = LocalFileSystem.getInstance().findFileByPath(path);
if (contextFileOrDir == null) {
throw new RuntimeConfigurationError("Folder not found: " + FileUtil.toSystemDependentName(path));
}
currentWorkingDirectory = contextFileOrDir;
executionResult = null;
debuggingHost = ((DartRemoteDebugConfiguration) runConfiguration).getParameters().getHost();
observatoryPort = ((DartRemoteDebugConfiguration) runConfiguration).getParameters().getPort();
} else {
LOG.error("Unexpected run configuration: " + runConfiguration.getClass().getName());
return null;
}
FileDocumentManager.getInstance().saveAllDocuments();
final XDebuggerManager debuggerManager = XDebuggerManager.getInstance(env.getProject());
final XDebugSession debugSession = debuggerManager.startSession(env, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull final XDebugSession session) {
final DartUrlResolver dartUrlResolver = getDartUrlResolver(env.getProject(), contextFileOrDir);
return new DartVmServiceDebugProcess(session, StringUtil.notNullize(debuggingHost, "localhost"), observatoryPort, executionResult, dartUrlResolver, dasExecutionContextId, runConfiguration instanceof DartRemoteDebugConfiguration, getTimeout(), currentWorkingDirectory);
}
});
return debugSession.getRunContentDescriptor();
}
use of com.intellij.execution.configurations.RunProfile in project intellij-plugins by JetBrains.
the class DartRunner method doExecute.
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
final String executorId = env.getExecutor().getId();
if (!DefaultDebugExecutor.EXECUTOR_ID.equals(executorId)) {
LOG.error("Unexpected executor id: " + executorId);
return null;
}
try {
final String dasExecutionContextId;
final RunProfile runConfig = env.getRunProfile();
if (runConfig instanceof DartRunConfigurationBase && DartAnalysisServerService.getInstance(env.getProject()).serverReadyForRequest(env.getProject())) {
final String path = ((DartRunConfigurationBase) runConfig).getRunnerParameters().getFilePath();
// already checked
assert path != null;
dasExecutionContextId = DartAnalysisServerService.getInstance(env.getProject()).execution_createContext(path);
} else {
// remote debug or can't start DAS
dasExecutionContextId = null;
}
return doExecuteDartDebug(state, env, dasExecutionContextId);
} catch (RuntimeConfigurationError e) {
throw new ExecutionException(e);
}
}
Aggregations