remove unused/unneeded programm runners, BasicProgramRunner is able to run async

This commit is contained in:
Vladimir Krivosheev
2016-11-08 14:04:53 +01:00
parent 9504fea798
commit 533cd46101
9 changed files with 90 additions and 59 deletions
-1
View File
@@ -2527,7 +2527,6 @@ com/intellij/openapi/ui/popup/ListPopupStep.class:/lib/openapi.jar
com/intellij/openapi/ui/popup/PopupStep.class:/lib/openapi.jar
com/intellij/execution/ExecutionException.class:/lib/openapi.jar
com/intellij/execution/runners/Runner.class:/lib/openapi.jar
com/intellij/tools/ToolProgramRunner.class:/lib/idea.jar
com/intellij/execution/runners/DefaultProgramRunner.class:/lib/idea.jar
com/intellij/execution/runners/GenericProgramRunner.class:/lib/openapi.jar
com/intellij/execution/impl/DefaultJavaProgramRunner.class:/lib/idea.jar
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution.runners;
import com.intellij.execution.configurations.RunProfile;
@@ -21,10 +20,10 @@ import com.intellij.execution.executors.DefaultRunExecutor;
import org.jetbrains.annotations.NotNull;
/**
* @author AG
* @deprecated Do not use and do not extends — use DefaultProgramRunner instead.
*/
@Deprecated
public class BasicProgramRunner extends DefaultProgramRunner {
@NotNull
@Override
public String getRunnerId() {
@@ -0,0 +1,26 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution.runners;
import com.intellij.execution.ExecutionResult;
import com.intellij.execution.configurations.RunProfileState;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.concurrency.Promise;
public interface DebuggableRunProfileState extends RunProfileState {
@NotNull
Promise<ExecutionResult> execute(int debugPort);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,14 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution.runners;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionResult;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,11 +28,6 @@ public abstract class DefaultProgramRunner extends GenericProgramRunner {
@Nullable
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
ExecutionResult executionResult = state.execute(env.getExecutor(), this);
if (executionResult == null) {
return null;
}
return new RunContentBuilder(executionResult, env).showRunContent(env.getContentToReuse());
return DefaultProgramRunnerImplKt.executeState(state, env, this);
}
}
@@ -0,0 +1,57 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution.runners
import com.intellij.execution.RunProfileStarter
import com.intellij.execution.configurations.RunProfile
import com.intellij.execution.configurations.RunProfileState
import com.intellij.execution.configurations.RunnerSettings
import com.intellij.execution.executors.DefaultRunExecutor
import com.intellij.execution.ui.RunContentDescriptor
import com.intellij.openapi.fileEditor.FileDocumentManager
import org.jetbrains.concurrency.Promise
import org.jetbrains.concurrency.resolvedPromise
private class DefaultProgramRunnerImpl : AsyncGenericProgramRunner<RunnerSettings>() {
override fun getRunnerId() = "defaultRunner"
override fun prepare(environment: ExecutionEnvironment, state: RunProfileState): Promise<RunProfileStarter> {
if (state is DebuggableRunProfileState) {
return state.execute(-1)
.then {
it?.let {
runProfileStarter { state, environment -> RunContentBuilder(it, environment).showRunContent(environment.contentToReuse) }
}
}
}
return resolvedPromise(runProfileStarter { state, environment -> executeState(state, environment, this) })
}
override fun canRun(executorId: String, profile: RunProfile): Boolean {
return DefaultRunExecutor.EXECUTOR_ID == executorId && profile !is RunConfigurationWithSuppressedDefaultRunAction
}
}
inline fun runProfileStarter(crossinline starter: (state: RunProfileState, environment: ExecutionEnvironment) -> RunContentDescriptor?) = object : RunProfileStarter() {
override fun execute(state: RunProfileState, env: ExecutionEnvironment) = starter(state, env)
}
internal fun executeState(state: RunProfileState, env: ExecutionEnvironment, runner: ProgramRunner<*>): RunContentDescriptor? {
FileDocumentManager.getInstance().saveAllDocuments()
val executionResult = state.execute(env.executor, runner) ?: return null
return RunContentBuilder(executionResult, env).showRunContent(env.contentToReuse)
}
@@ -1,40 +0,0 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.tools;
import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.execution.runners.DefaultProgramRunner;
import org.jetbrains.annotations.NotNull;
/**
* @author spleaner
*/
public class ToolProgramRunner extends DefaultProgramRunner {
@Override
@NotNull
public String getRunnerId() {
return "ToolProgramRunner";
}
@Override
public boolean canRun(@NotNull final String executorId, @NotNull final RunProfile profile) {
return DefaultRunExecutor.EXECUTOR_ID.equals(executorId) && profile instanceof ToolRunProfile;
}
}
@@ -523,8 +523,6 @@
<applicationService serviceInterface="com.intellij.ide.macro.MacroManager" serviceImplementation="com.intellij.ide.macro.MacroManager"/>
<hectorComponentProvider implementation="com.intellij.codeInsight.daemon.impl.FileIncludeContextHectorProvider"/>
<programRunner implementation="com.intellij.tools.ToolProgramRunner"/>
<ideRootPaneNorth implementation="com.intellij.ide.navigationToolbar.NavBarRootPaneExtension"/>
<navbar implementation="com.intellij.ide.navigationToolbar.DefaultNavBarExtension" id="defaultNavbar" order="last"/>
@@ -75,7 +75,7 @@
<treeStructureProvider implementation="com.intellij.platform.PlatformProjectViewStructureProvider"/>
<programRunner implementation="com.intellij.execution.runners.BasicProgramRunner" order="last"/>
<programRunner implementation="com.intellij.execution.runners.DefaultProgramRunnerImpl" order="last"/>
<projectConfigurable groupId="editor" groupWeight="160" displayName="Inspections" id="Errors" instance="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurable" order="before preferences.intentionPowerPack"/>
<projectConfigurable groupId="appearance" groupWeight="111" instance="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" id="project.scopes" key="scopes.display.name" bundle="messages.IdeBundle" />
+1 -1
View File
@@ -341,7 +341,7 @@
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck" id="compileBeforeRunNoErrorCheck" order="after compileBeforeRun"/>
<stepsBeforeRunProvider implementation="com.intellij.packaging.impl.run.BuildArtifactsBeforeRunTaskProvider" order="after compileBeforeRunNoErrorCheck"/>
<programRunner id="defaultRunRunner" implementation="com.intellij.execution.impl.DefaultJavaProgramRunner"/>
<programRunner implementation="com.intellij.execution.runners.BasicProgramRunner" order="last"/>
<programRunner implementation="com.intellij.execution.runners.DefaultProgramRunnerImpl" order="last"/>
<hectorComponentProvider implementation="com.intellij.codeInsight.daemon.impl.ImportPopupHectorComponentProvider"/>