rerun failed tests: use before tasks options from the initial run (IDEA-100417)

This commit is contained in:
Anna Kozlova
2013-02-05 14:34:32 +04:00
parent 43c298147f
commit 9696c5adbd
3 changed files with 37 additions and 1 deletions
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2013 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.configurations;
/**
* Allow to get before/after steps from wrapped configuration: e.g. to rerun tests with initial tests before options
*/
public interface WrappingRunConfiguration<T extends RunConfiguration> {
T getPeer();
}
@@ -951,6 +951,9 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
@NotNull
@Override
public <T extends BeforeRunTask> List<T> getBeforeRunTasks(RunConfiguration settings, Key<T> taskProviderID) {
if (settings instanceof WrappingRunConfiguration) {
return getBeforeRunTasks(((WrappingRunConfiguration)settings).getPeer(), taskProviderID);
}
List<BeforeRunTask> tasks = myConfigurationToBeforeTasksMap.get(settings);
if (tasks == null) {
tasks = getBeforeRunTasks(settings);
@@ -967,6 +970,9 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
@Override
@NotNull
public List<BeforeRunTask> getBeforeRunTasks(final RunConfiguration settings) {
if (settings instanceof WrappingRunConfiguration) {
return getBeforeRunTasks(((WrappingRunConfiguration)settings).getPeer());
}
final List<BeforeRunTask> tasks = myConfigurationToBeforeTasksMap.get(settings);
if (tasks != null) {
return getCopies(tasks);
@@ -196,8 +196,15 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction
return null;
}
protected static abstract class MyRunProfile extends RunConfigurationBase implements ModuleRunProfile {
protected static abstract class MyRunProfile extends RunConfigurationBase implements ModuleRunProfile,
WrappingRunConfiguration<RunConfigurationBase> {
@Deprecated
public RunConfigurationBase getConfiguration() {
return getPeer();
}
@Override
public RunConfigurationBase getPeer() {
return myConfiguration;
}