mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Gradle: hide executor blocks in test runner UI (IDEA-153339, IDEA-150417)
This commit is contained in:
@@ -54,4 +54,6 @@ gradle.integrations.maven.notification.not_updated_repository.text=<a href=\"#up
|
||||
exportable.GradleSystemRunningSettings.presentable.name=Gradle: System Running
|
||||
|
||||
gradle.action.download.sources=Download Sources
|
||||
gradle.action.download.sources.busy.text=Downloading sources...
|
||||
gradle.action.download.sources.busy.text=Downloading sources...
|
||||
gradle.test.show.internal.nodes.action.name=Show internal gradle test suites
|
||||
gradle.test.show.internal.nodes.action.text=Show internal gradle test suites, e.g. 'Gradle Test Executor N'
|
||||
+25
@@ -16,10 +16,19 @@
|
||||
package org.jetbrains.plugins.gradle.execution.test.runner;
|
||||
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.testframework.TestConsoleProperties;
|
||||
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.Separator;
|
||||
import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration;
|
||||
import com.intellij.util.config.BooleanProperty;
|
||||
import com.intellij.util.config.DumbAwareToggleBooleanProperty;
|
||||
import com.intellij.util.config.ToggleBooleanProperty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.gradle.util.GradleBundle;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
import java.io.File;
|
||||
|
||||
@@ -28,6 +37,7 @@ import java.io.File;
|
||||
* @since 2/17/14
|
||||
*/
|
||||
public class GradleConsoleProperties extends SMTRunnerConsoleProperties {
|
||||
public static final BooleanProperty SHOW_INTERNAL_TEST_NODES = new BooleanProperty("showInternalTestNodes", false);
|
||||
@Nullable private File gradleTestReport;
|
||||
|
||||
public GradleConsoleProperties(final ExternalSystemRunConfiguration configuration, Executor executor) {
|
||||
@@ -47,4 +57,19 @@ public class GradleConsoleProperties extends SMTRunnerConsoleProperties {
|
||||
public int getSelectionMode() {
|
||||
return TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendAdditionalActions(DefaultActionGroup actionGroup, JComponent parent, TestConsoleProperties target) {
|
||||
super.appendAdditionalActions(actionGroup, parent, target);
|
||||
actionGroup.add(Separator.getInstance());
|
||||
actionGroup.add(createShowInternalNodesAction(target));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ToggleBooleanProperty createShowInternalNodesAction(TestConsoleProperties target) {
|
||||
String text = GradleBundle.message("gradle.test.show.internal.nodes.action.name");
|
||||
setIfUndefined(SHOW_INTERNAL_TEST_NODES, false);
|
||||
String desc = GradleBundle.message("gradle.test.show.internal.nodes.action.text");
|
||||
return new DumbAwareToggleBooleanProperty(text, desc, null, target, SHOW_INTERNAL_TEST_NODES);
|
||||
}
|
||||
}
|
||||
|
||||
+20
-6
@@ -15,8 +15,10 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.execution.test.runner.events;
|
||||
|
||||
import com.intellij.execution.testframework.sm.runner.SMTestProxy;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleConsoleProperties;
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleSMTestProxy;
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleTestsExecutionConsole;
|
||||
|
||||
@@ -40,12 +42,24 @@ public class BeforeSuiteEvent extends AbstractTestEvent {
|
||||
registerTestProxy(testId, getResultsViewer().getTestsRootNode());
|
||||
}
|
||||
else {
|
||||
String locationUrl = findLocationUrl(null, fqClassName);
|
||||
final GradleSMTestProxy testProxy = new GradleSMTestProxy(name, true, locationUrl, null);
|
||||
testProxy.setLocator(getExecutionConsole().getUrlProvider());
|
||||
testProxy.setParentId(parentTestId);
|
||||
testProxy.setStarted();
|
||||
registerTestProxy(testId, testProxy);
|
||||
SMTestProxy parentTest = findTestProxy(parentTestId);
|
||||
if (isHiddenTestNode(name, parentTest)) {
|
||||
registerTestProxy(testId, parentTest);
|
||||
}
|
||||
else {
|
||||
String locationUrl = findLocationUrl(null, fqClassName);
|
||||
final GradleSMTestProxy testProxy = new GradleSMTestProxy(name, true, locationUrl, null);
|
||||
testProxy.setLocator(getExecutionConsole().getUrlProvider());
|
||||
testProxy.setParentId(parentTestId);
|
||||
testProxy.setStarted();
|
||||
registerTestProxy(testId, testProxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isHiddenTestNode(String name, SMTestProxy parentTest) {
|
||||
return parentTest != null &&
|
||||
!GradleConsoleProperties.SHOW_INTERNAL_TEST_NODES.value(getProperties()) &&
|
||||
StringUtil.startsWith(name, "Gradle Test Executor");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user