diff options
Diffstat (limited to 'platform/testRunner/src')
3 files changed, 47 insertions, 27 deletions
diff --git a/platform/testRunner/src/com/intellij/execution/testframework/actions/AbstractRerunFailedTestsAction.java b/platform/testRunner/src/com/intellij/execution/testframework/actions/AbstractRerunFailedTestsAction.java index 9be02ae51271..30f8599e2aaf 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/actions/AbstractRerunFailedTestsAction.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/actions/AbstractRerunFailedTestsAction.java @@ -69,7 +69,7 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction protected ExecutionEnvironment myEnvironment; private final JComponent myParent; - + @SuppressWarnings("UnusedDeclaration") public AbstractRerunFailedTestsAction() { //We call this constructor with a little help from reflection. myParent = null; @@ -83,6 +83,7 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction registerCustomShortcutSet(getShortcutSet(), myParent); } + @Override public void dispose() { registry.remove(this); } @@ -127,6 +128,7 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction return candidates.get(0); } + @Override public final void update(AnActionEvent e) { AbstractRerunFailedTestsAction action = findActualAction(); e.getPresentation().setEnabled(action.isActive(e)); @@ -167,6 +169,7 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction return Filter.FAILED_OR_INTERRUPTED; } + @Override public void actionPerformed(AnActionEvent e) { findActualAction().showPopup(e); } @@ -225,6 +228,7 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction .setResizable(false) .setRequestFocus(true) .setItemChoosenCallback(new Runnable() { + @Override public void run() { final Object value = list.getSelectedValue(); if (value instanceof Executor) { @@ -237,12 +241,11 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction private void performAction(ProgramRunner runner, MyRunProfile profile, Executor executor) { try { - final ExecutionEnvironment environment = - new ExecutionEnvironmentBuilder(myEnvironment).setRunnerId(runner.getRunnerId()) - .setExecutor(executor) - .setRunProfile(profile) - .build(); - runner.execute(environment); + new ExecutionEnvironmentBuilder(myEnvironment) + .runner(runner) + .executor(executor) + .runProfile(profile) + .buildAndExecute(); } catch (ExecutionException e1) { LOG.error(e1); @@ -291,58 +294,71 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction } + @Override public void checkConfiguration() throws RuntimeConfigurationException { } ///////////////////////////////////Delegates + @Override public void readExternal(final Element element) throws InvalidDataException { myConfiguration.readExternal(element); } + @Override public void writeExternal(final Element element) throws WriteExternalException { myConfiguration.writeExternal(element); } + @Override @NotNull public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() { return myConfiguration.getConfigurationEditor(); } + @Override @NotNull public ConfigurationType getType() { return myConfiguration.getType(); } + @Override public ConfigurationPerRunnerSettings createRunnerSettings(final ConfigurationInfoProvider provider) { return myConfiguration.createRunnerSettings(provider); } + @Override public SettingsEditor<ConfigurationPerRunnerSettings> getRunnerSettingsEditor(final ProgramRunner runner) { return myConfiguration.getRunnerSettingsEditor(runner); } + @Override public RunConfiguration clone() { return myConfiguration.clone(); } + @Override public int getUniqueID() { return myConfiguration.getUniqueID(); } + @Override public LogFileOptions getOptionsForPredefinedLogFile(PredefinedLogFile predefinedLogFile) { return myConfiguration.getOptionsForPredefinedLogFile(predefinedLogFile); } + @Override public ArrayList<PredefinedLogFile> getPredefinedLogFiles() { return myConfiguration.getPredefinedLogFiles(); } + @Override public ArrayList<LogFileOptions> getAllLogFiles() { return myConfiguration.getAllLogFiles(); } + @Override public ArrayList<LogFileOptions> getLogFiles() { return myConfiguration.getLogFiles(); } } -}
\ No newline at end of file +} diff --git a/platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java b/platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java index fb433b23ec56..3f15ee3f6de3 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java @@ -2,9 +2,12 @@ package com.intellij.execution.testframework.autotest; import com.intellij.execution.DelayedDocumentWatcher; import com.intellij.execution.process.ProcessHandler; +import com.intellij.execution.runners.ExecutionUtil; import com.intellij.execution.ui.RunContentDescriptor; -import com.intellij.execution.ui.RunContentManagerImpl; +import com.intellij.ide.DataManager; import com.intellij.ide.util.PropertiesComponent; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.LangDataKeys; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.project.Project; @@ -15,6 +18,7 @@ import com.intellij.ui.content.Content; import com.intellij.util.Consumer; import com.intellij.util.containers.WeakHashMap; +import javax.swing.*; import java.util.Collections; import java.util.Set; @@ -79,21 +83,21 @@ public class AutoTestManager { } private static void runAutoTest(Content content) { - RunContentDescriptor descriptor = RunContentManagerImpl.getRunContentDescriptorByContent(content); - if (descriptor == null) { - return; - } - Runnable restarter = descriptor.getRestarter(); - if (restarter == null) { - return; - } - final ProcessHandler processHandler = descriptor.getProcessHandler(); - if (processHandler != null && !processHandler.isProcessTerminated()) { - return; + JComponent component = content.getComponent(); + if (component != null) { + DataContext dataContext = DataManager.getInstance().getDataContext(component); + RunContentDescriptor descriptor = LangDataKeys.RUN_CONTENT_DESCRIPTOR.getData(dataContext); + if (descriptor != null) { + ProcessHandler processHandler = descriptor.getProcessHandler(); + if (processHandler != null && !processHandler.isProcessTerminated()) { + return; + } + + descriptor.setActivateToolWindowWhenAdded(false); + descriptor.setReuseToolWindowActivation(true); + ExecutionUtil.restart(content); + } } - descriptor.setActivateToolWindowWhenAdded(false); - descriptor.setReuseToolWindowActivation(true); - restarter.run(); } int getDelay() { diff --git a/platform/testRunner/src/com/intellij/execution/testframework/autotest/ToggleAutoTestAction.java b/platform/testRunner/src/com/intellij/execution/testframework/autotest/ToggleAutoTestAction.java index 893ddb320aab..256ff0277c83 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/autotest/ToggleAutoTestAction.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/autotest/ToggleAutoTestAction.java @@ -2,10 +2,10 @@ package com.intellij.execution.testframework.autotest; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.execution.ui.RunContentDescriptor; -import com.intellij.execution.ui.RunContentManager; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.actionSystem.LangDataKeys; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.project.Project; @@ -21,15 +21,15 @@ public class ToggleAutoTestAction extends ToggleAction { @Override public boolean isSelected(AnActionEvent e) { - Project project = e.getData(CommonDataKeys.PROJECT); - RunContentDescriptor descriptor = e.getData(RunContentManager.RUN_CONTENT_DESCRIPTOR); + Project project = e.getProject(); + RunContentDescriptor descriptor = e.getData(LangDataKeys.RUN_CONTENT_DESCRIPTOR); return !(project == null || descriptor == null) && AutoTestManager.getInstance(project).isAutoTestEnabled(descriptor); } @Override public void setSelected(AnActionEvent e, boolean state) { Project project = e.getData(CommonDataKeys.PROJECT); - RunContentDescriptor descriptor = e.getData(RunContentManager.RUN_CONTENT_DESCRIPTOR); + RunContentDescriptor descriptor = e.getData(LangDataKeys.RUN_CONTENT_DESCRIPTOR); if (project != null && descriptor != null) { AutoTestManager.getInstance(project).setAutoTestEnabled(descriptor, state); } |