mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+3
-8
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class ExecutionEnvironmentBuilder {
|
||||
@NotNull private RunProfile myRunProfile;
|
||||
private RunProfile myRunProfile;
|
||||
@NotNull private ExecutionTarget myTarget = DefaultExecutionTarget.INSTANCE;
|
||||
|
||||
@NotNull private final Project myProject;
|
||||
@@ -24,7 +24,6 @@ public final class ExecutionEnvironmentBuilder {
|
||||
@Nullable private ConfigurationPerRunnerSettings myConfigurationSettings;
|
||||
@Nullable private RunContentDescriptor myContentToReuse;
|
||||
@Nullable private RunnerAndConfigurationSettings myRunnerAndConfigurationSettings;
|
||||
@Nullable private String myRunnerId;
|
||||
private ProgramRunner<?> myRunner;
|
||||
private boolean myAssignNewId;
|
||||
@Nullable private Long myExecutionId = null;
|
||||
@@ -133,6 +132,7 @@ public final class ExecutionEnvironmentBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ExecutionEnvironmentBuilder runner(@NotNull ProgramRunner<?> runner) {
|
||||
myRunner = runner;
|
||||
return this;
|
||||
@@ -164,12 +164,7 @@ public final class ExecutionEnvironmentBuilder {
|
||||
}
|
||||
|
||||
if (environment == null && myRunner == null) {
|
||||
if (myRunnerId == null) {
|
||||
myRunner = ProgramRunner.getRunner(myExecutor.getId(), myRunProfile);
|
||||
}
|
||||
else {
|
||||
myRunner = ProgramRunner.findRunnerById(myRunnerId);
|
||||
}
|
||||
myRunner = ProgramRunner.getRunner(myExecutor.getId(), myRunProfile);
|
||||
}
|
||||
|
||||
if (environment == null && myRunner == null) {
|
||||
|
||||
+27
-27
@@ -76,33 +76,34 @@ public abstract class AbstractImportTestsAction extends AnAction {
|
||||
final Project project = e.getProject();
|
||||
LOG.assertTrue(project != null);
|
||||
final VirtualFile file = getFile(project);
|
||||
if (file != null) {
|
||||
try {
|
||||
final ImportRunProfile profile = new ImportRunProfile(file, project);
|
||||
SMTRunnerConsoleProperties properties = profile.getProperties();
|
||||
if (properties == null) {
|
||||
properties = myProperties;
|
||||
LOG.info("Failed to detect test framework in " + file.getPath() +
|
||||
"; use " + (properties != null ? properties.getTestFrameworkName() + " from toolbar" : "no properties"));
|
||||
}
|
||||
final Executor executor = properties != null ? properties.getExecutor()
|
||||
: ExecutorRegistry.getInstance().getExecutorById(DefaultRunExecutor.EXECUTOR_ID);
|
||||
ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder.create(project, executor, profile);
|
||||
ExecutionTarget target = profile.getTarget();
|
||||
if (target != null) {
|
||||
builder = builder.target(target);
|
||||
}
|
||||
final RunConfiguration initialConfiguration = profile.getInitialConfiguration();
|
||||
final ProgramRunner runner =
|
||||
initialConfiguration != null ? ProgramRunner.getRunner(executor.getId(), initialConfiguration) : null;
|
||||
if (runner != null) {
|
||||
builder = builder.runner(runner);
|
||||
}
|
||||
builder.buildAndExecute();
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final ImportRunProfile profile = new ImportRunProfile(file, project);
|
||||
SMTRunnerConsoleProperties properties = profile.getProperties();
|
||||
if (properties == null) {
|
||||
properties = myProperties;
|
||||
LOG.info("Failed to detect test framework in " + file.getPath() +
|
||||
"; use " + (properties != null ? properties.getTestFrameworkName() + " from toolbar" : "no properties"));
|
||||
}
|
||||
catch (ExecutionException e1) {
|
||||
Messages.showErrorDialog(project, e1.getMessage(), "Import Failed");
|
||||
final Executor executor = properties != null ? properties.getExecutor()
|
||||
: ExecutorRegistry.getInstance().getExecutorById(DefaultRunExecutor.EXECUTOR_ID);
|
||||
ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder.create(project, executor, profile);
|
||||
ExecutionTarget target = profile.getTarget();
|
||||
if (target != null) {
|
||||
builder = builder.target(target);
|
||||
}
|
||||
final RunConfiguration initialConfiguration = profile.getInitialConfiguration();
|
||||
final ProgramRunner runner = initialConfiguration != null ? ProgramRunner.getRunner(executor.getId(), initialConfiguration) : null;
|
||||
if (runner != null) {
|
||||
builder.runner(runner);
|
||||
}
|
||||
builder.buildAndExecute();
|
||||
}
|
||||
catch (ExecutionException e1) {
|
||||
Messages.showErrorDialog(project, e1.getMessage(), "Import Failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,8 +164,7 @@ public abstract class AbstractImportTestsAction extends AnAction {
|
||||
if (DefaultExecutionTarget.INSTANCE.getId().equals(myTargetId)) {
|
||||
return DefaultExecutionTarget.INSTANCE;
|
||||
}
|
||||
final RunnerAndConfigurationSettingsImpl settings =
|
||||
new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(myProject), myConfiguration, false);
|
||||
final RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(myProject), myConfiguration, false);
|
||||
for (ExecutionTargetProvider provider : Extensions.getExtensions(ExecutionTargetProvider.EXTENSION_NAME)) {
|
||||
for (ExecutionTarget target : provider.getTargets(myProject, settings)) {
|
||||
if (myTargetId.equals(target.getId())) {
|
||||
|
||||
Reference in New Issue
Block a user