mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
mark env.getRunner as NotNull
This commit is contained in:
@@ -51,8 +51,7 @@ public class ExecutionEnvironment extends UserDataHolderBase implements Disposab
|
||||
@Nullable private ConfigurationPerRunnerSettings myConfigurationSettings;
|
||||
@Nullable private final RunnerAndConfigurationSettings myRunnerAndConfigurationSettings;
|
||||
@Nullable private RunContentDescriptor myContentToReuse;
|
||||
@Nullable private String myRunnerId;
|
||||
@Nullable final ProgramRunner<?> myRunner;
|
||||
private final ProgramRunner<?> myRunner;
|
||||
private long myExecutionId = 0;
|
||||
@Nullable private DataContext myDataContext;
|
||||
|
||||
@@ -77,7 +76,6 @@ public class ExecutionEnvironment extends UserDataHolderBase implements Disposab
|
||||
configuration.getConfigurationSettings(runner),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
runner);
|
||||
}
|
||||
|
||||
@@ -99,7 +97,6 @@ public class ExecutionEnvironment extends UserDataHolderBase implements Disposab
|
||||
configuration.getConfigurationSettings(runner),
|
||||
null,
|
||||
configuration,
|
||||
null,
|
||||
runner);
|
||||
}
|
||||
|
||||
@@ -111,22 +108,19 @@ public class ExecutionEnvironment extends UserDataHolderBase implements Disposab
|
||||
@NotNull Executor executor,
|
||||
@NotNull Project project,
|
||||
@Nullable RunnerSettings runnerSettings) {
|
||||
this(runProfile, executor, DefaultExecutionTarget.INSTANCE, project, runnerSettings, null, null, null, null, null);
|
||||
//noinspection ConstantConditions
|
||||
this(runProfile, executor, DefaultExecutionTarget.INSTANCE, project, runnerSettings, null, null, null, RunnerRegistry.getInstance().getRunner(executor.getId(), runProfile));
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't use, use {@link com.intellij.execution.runners.ExecutionEnvironmentBuilder} instead
|
||||
*/
|
||||
public ExecutionEnvironment(@NotNull RunProfile runProfile,
|
||||
@NotNull Executor executor,
|
||||
@NotNull ExecutionTarget target,
|
||||
@NotNull Project project,
|
||||
@Nullable RunnerSettings runnerSettings,
|
||||
@Nullable ConfigurationPerRunnerSettings configurationSettings,
|
||||
@Nullable RunContentDescriptor contentToReuse,
|
||||
@Nullable RunnerAndConfigurationSettings settings,
|
||||
@Nullable String runnerId,
|
||||
@Nullable ProgramRunner<?> runner) {
|
||||
ExecutionEnvironment(@NotNull RunProfile runProfile,
|
||||
@NotNull Executor executor,
|
||||
@NotNull ExecutionTarget target,
|
||||
@NotNull Project project,
|
||||
@Nullable RunnerSettings runnerSettings,
|
||||
@Nullable ConfigurationPerRunnerSettings configurationSettings,
|
||||
@Nullable RunContentDescriptor contentToReuse,
|
||||
@Nullable RunnerAndConfigurationSettings settings,
|
||||
@NotNull ProgramRunner<?> runner) {
|
||||
myExecutor = executor;
|
||||
myTarget = target;
|
||||
myRunProfile = runProfile;
|
||||
@@ -137,7 +131,6 @@ public class ExecutionEnvironment extends UserDataHolderBase implements Disposab
|
||||
myRunnerAndConfigurationSettings = settings;
|
||||
|
||||
myRunner = runner;
|
||||
myRunnerId = runner == null ? runnerId : runner.getRunnerId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,13 +172,18 @@ public class ExecutionEnvironment extends UserDataHolderBase implements Disposab
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Deprecated
|
||||
/**
|
||||
* Use {@link #getRunner()} instead
|
||||
* to remove in IDEA 15
|
||||
*/
|
||||
public String getRunnerId() {
|
||||
return myRunnerId;
|
||||
return myRunner.getRunnerId();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public ProgramRunner<?> getRunner() {
|
||||
return myRunner == null ? RunnerRegistry.getInstance().findRunnerById(getRunnerId()) : myRunner;
|
||||
return myRunner;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+19
-5
@@ -96,8 +96,8 @@ public final class ExecutionEnvironmentBuilder {
|
||||
myRunProfile = copySource.getRunProfile();
|
||||
myRunnerSettings = copySource.getRunnerSettings();
|
||||
myConfigurationSettings = copySource.getConfigurationSettings();
|
||||
myRunnerId = copySource.getRunnerId();
|
||||
myRunner = copySource.myRunner;
|
||||
//noinspection deprecation
|
||||
myRunner = copySource.getRunner();
|
||||
myContentToReuse = copySource.getContentToReuse();
|
||||
myExecutor = copySource.getExecutor();
|
||||
}
|
||||
@@ -183,6 +183,11 @@ public final class ExecutionEnvironmentBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
/**
|
||||
* to remove in IDEA 15
|
||||
*/
|
||||
public ExecutionEnvironmentBuilder setRunProfile(@NotNull RunProfile runProfile) {
|
||||
return runProfile(runProfile);
|
||||
}
|
||||
@@ -242,12 +247,21 @@ public final class ExecutionEnvironmentBuilder {
|
||||
|
||||
@NotNull
|
||||
public ExecutionEnvironment build() {
|
||||
if (myRunner == null && myRunnerId == null) {
|
||||
myRunner = RunnerRegistry.getInstance().getRunner(myExecutor.getId(), myRunProfile);
|
||||
if (myRunner == null) {
|
||||
if (myRunnerId == null) {
|
||||
myRunner = RunnerRegistry.getInstance().getRunner(myExecutor.getId(), myRunProfile);
|
||||
}
|
||||
else {
|
||||
myRunner = RunnerRegistry.getInstance().findRunnerById(myRunnerId);
|
||||
}
|
||||
}
|
||||
|
||||
if (myRunner == null) {
|
||||
throw new IllegalStateException("Runner must be specified");
|
||||
}
|
||||
|
||||
ExecutionEnvironment environment = new ExecutionEnvironment(myRunProfile, myExecutor, myTarget, myProject, myRunnerSettings, myConfigurationSettings, myContentToReuse,
|
||||
myRunnerAndConfigurationSettings, myRunnerId, myRunner);
|
||||
myRunnerAndConfigurationSettings, myRunner);
|
||||
if (myAssignNewId) {
|
||||
environment.assignNewExecutionId();
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class ExecutionTargetManagerImpl extends ExecutionTargetManager implement
|
||||
private void updateActiveTarget(@Nullable RunnerAndConfigurationSettings settings, @Nullable ExecutionTarget toSelect) {
|
||||
List<ExecutionTarget> suitable = settings == null ? Collections.singletonList(DefaultExecutionTarget.INSTANCE)
|
||||
: getTargetsFor(settings);
|
||||
ExecutionTarget toNotify = null;
|
||||
ExecutionTarget toNotify;
|
||||
synchronized (myActiveTargetLock) {
|
||||
if (toSelect == null) toSelect = myActiveTarget;
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ public class ExecutorRegistryImpl extends ExecutorRegistry {
|
||||
|
||||
@NotNull
|
||||
private static Trinity<Project, String, String> createExecutionId(String executorId, @NotNull ExecutionEnvironment environment) {
|
||||
return Trinity.create(environment.getProject(), executorId, environment.getRunnerId());
|
||||
return Trinity.create(environment.getProject(), executorId, environment.getRunner().getRunnerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,7 +178,7 @@ public class ExecutorRegistryImpl extends ExecutorRegistry {
|
||||
|
||||
@Override
|
||||
public boolean isStarting(@NotNull ExecutionEnvironment environment) {
|
||||
return isStarting(environment.getProject(), environment.getExecutor().getId(), environment.getRunnerId());
|
||||
return isStarting(environment.getProject(), environment.getExecutor().getId(), environment.getRunner().getRunnerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -84,7 +84,7 @@ public class RunContentBuilder extends RunTab {
|
||||
|
||||
@NotNull
|
||||
public static ExecutionEnvironment fix(@NotNull ExecutionEnvironment environment, @Nullable ProgramRunner runner) {
|
||||
if (runner == null || runner.getRunnerId().equals(environment.getRunnerId())) {
|
||||
if (runner == null || runner.equals(environment.getRunner())) {
|
||||
return environment;
|
||||
}
|
||||
else {
|
||||
|
||||
+8
-3
@@ -65,12 +65,14 @@ public class XsltCommandLineState extends CommandLineState {
|
||||
private UserDataHolder myExtensionData;
|
||||
|
||||
@SuppressWarnings({ "RawUseOfParameterizedType" })
|
||||
public XsltCommandLineState(XsltRunConfiguration xsltRunConfiguration, ExecutionEnvironment env) {
|
||||
super(env);
|
||||
public XsltCommandLineState(XsltRunConfiguration xsltRunConfiguration, ExecutionEnvironment environment) {
|
||||
super(environment);
|
||||
|
||||
myXsltRunConfiguration = xsltRunConfiguration;
|
||||
myIsDebugger = "Debug".equals(env.getRunnerId());
|
||||
myIsDebugger = "Debug".equals(environment.getRunner().getRunnerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected OSProcessHandler startProcess() throws ExecutionException {
|
||||
final OSProcessHandler osProcessHandler = createJavaParameters().createOSProcessHandler();
|
||||
@@ -204,12 +206,15 @@ public class XsltCommandLineState extends CommandLineState {
|
||||
|
||||
private class MyProcessAdapter extends ProcessAdapter {
|
||||
|
||||
@Override
|
||||
public void processTerminated(final ProcessEvent event) {
|
||||
|
||||
if (myXsltRunConfiguration.isSaveToFile()) {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (event.getExitCode() == 0) {
|
||||
if (myXsltRunConfiguration.myOpenInBrowser) {
|
||||
|
||||
@@ -87,7 +87,7 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
private Boolean myMultiprocessDebug = null;
|
||||
|
||||
public boolean isDebug() {
|
||||
return PyDebugRunner.PY_DEBUG_RUNNER.equals(getEnvironment().getRunnerId());
|
||||
return PyDebugRunner.PY_DEBUG_RUNNER.equals(getEnvironment().getRunner().getRunnerId());
|
||||
}
|
||||
|
||||
public static ServerSocket createServerSocket() throws ExecutionException {
|
||||
@@ -171,23 +171,13 @@ public abstract class PythonCommandLineState extends CommandLineState {
|
||||
* @throws ExecutionException
|
||||
*/
|
||||
protected ProcessHandler startProcess(CommandLinePatcher... patchers) throws ExecutionException {
|
||||
|
||||
|
||||
GeneralCommandLine commandLine = generateCommandLine(patchers);
|
||||
|
||||
// Extend command line
|
||||
RunnerSettings runnerSettings = getRunnerSettings();
|
||||
String runnerId = getEnvironment().getRunnerId();
|
||||
if (runnerId != null) {
|
||||
PythonRunConfigurationExtensionsManager.getInstance().patchCommandLine(myConfig, runnerSettings, commandLine, runnerId);
|
||||
}
|
||||
|
||||
PythonRunConfigurationExtensionsManager.getInstance().patchCommandLine(myConfig, getRunnerSettings(), commandLine, getEnvironment().getRunner().getRunnerId());
|
||||
Sdk sdk = PythonSdkType.findSdkByPath(myConfig.getInterpreterPath());
|
||||
|
||||
|
||||
final ProcessHandler processHandler;
|
||||
if (PySdkUtil.isRemote(sdk)) {
|
||||
assert sdk != null;
|
||||
processHandler =
|
||||
createRemoteProcessStarter().startRemoteProcess(sdk, commandLine, myConfig.getProject(), myConfig.getMappingSettings());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user