Commit 977d6617 authored by Vladislav.Soroka's avatar Vladislav.Soroka
Browse files

Allow to customize toolwindow id to be used for test notifications

parent bf06d4f6
Branches unavailable Tags unavailable
No related merge requests found
Showing with 20 additions and 4 deletions
+20 -4
......@@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.openapi.wm.impl.ToolWindowImpl;
import com.intellij.openapi.wm.impl.content.ToolWindowContentUi;
......@@ -57,7 +58,7 @@ public class BuildContentManagerImpl implements BuildContentManager {
private void init(Project project) {
final Runnable runnable = () -> {
ToolWindow toolWindow = ToolWindowManager.getInstance(project)
.registerToolWindow("Build", true, ToolWindowAnchor.BOTTOM, project, true);
.registerToolWindow(ToolWindowId.BUILD, true, ToolWindowAnchor.BOTTOM, project, true);
toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
toolWindow.setIcon(AllIcons.Actions.Compile);
myToolWindow = toolWindow;
......
......@@ -26,6 +26,7 @@ public interface ToolWindowId {
String ANT_BUILD = UIBundle.message("tool.window.name.ant.build");
String DEBUG = UIBundle.message("tool.window.name.debug");
String RUN = UIBundle.message("tool.window.name.run");
String BUILD = UIBundle.message("tool.window.name.build");
String FIND = UIBundle.message("tool.window.name.find");
String CVS = UIBundle.message("tool.window.name.cvs");
String HIERARCHY = UIBundle.message("tool.window.name.hierarchy");
......
......@@ -48,6 +48,7 @@ tool.window.name.ant.build=Ant Build
tool.window.name.preview=Preview
tool.window.name.debug=Debug
tool.window.name.run=Run
tool.window.name.build=Build
tool.window.name.find=Find
tool.window.name.cvs=CVS
tool.window.name.hierarchy=Hierarchy
......
......@@ -30,6 +30,7 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.config.*;
import com.intellij.util.containers.ContainerUtil;
......@@ -231,4 +232,9 @@ public abstract class TestConsoleProperties extends StoringPropertyContainer imp
public ExecutionTarget getExecutionTarget() {
return DefaultExecutionTarget.INSTANCE;
}
@NotNull
public String getWindowId() {
return isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN;
}
}
......@@ -130,7 +130,7 @@ public class TestsUIUtil {
TestStatusListener.notifySuiteFinished(root, properties.getProject());
final String testRunDebugId = properties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN;
final String windowId = properties.getWindowId();
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
final String title = testResultPresentation.getTitle();
......@@ -138,8 +138,8 @@ public class TestsUIUtil {
final String balloonText = testResultPresentation.getBalloonText();
final MessageType type = testResultPresentation.getType();
if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) {
toolWindowManager.notifyByBalloon(testRunDebugId, type, balloonText, null, null);
if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), windowId)) {
toolWindowManager.notifyByBalloon(windowId, type, balloonText, null, null);
}
NOTIFICATION_GROUP.createNotification(balloonText, type).notify(project);
......
......@@ -21,6 +21,7 @@ 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.openapi.wm.ToolWindowId;
import com.intellij.util.config.BooleanProperty;
import com.intellij.util.config.DumbAwareToggleBooleanProperty;
import com.intellij.util.config.ToggleBooleanProperty;
......@@ -58,6 +59,12 @@ public class GradleConsoleProperties extends SMTRunnerConsoleProperties {
return TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION;
}
@NotNull
@Override
public String getWindowId() {
return ToolWindowId.BUILD;
}
@Override
public void appendAdditionalActions(DefaultActionGroup actionGroup, JComponent parent, TestConsoleProperties target) {
super.appendAdditionalActions(actionGroup, parent, target);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment