Implementation detailsClearConsoleAction implementation should not try to search console view here.
ConsoleView console instance is already available, you can just pass it via constructor.
See com.intellij.execution.impl.ConsoleViewImpl.ClearThisConsoleAction for an example, your implementation should be based on it.
Anyway, replacing default "clear console" action for all consoles for sake of statistics is a bad use of API
(or lack of proper API and overuse of implementation detail).
The best would be to remove replaceClearAction(anActions); completely
Environment :
Scala Plugin : 2023.1.13
IntelliJ IDEA 2023.1 RC (Ultimate Edition)
Build : IU-231.8109.156 March 25, 2023
JRE : 17.0.6+10-b829.5amd64 (OpenJDK 64-Bit Server VM JetBrains s.r.o.)
OS : Windows (10.0, amd64)
Project JDK : Oracle OpenJDK version 17.0.1
Server JDK : Oracle OpenJDK version 17.0.1
Describe the bug See this code
replaceClearAction(anActions);
It uses custom implementation ofClearConsoleAction
which seems to be added to collect statistics. This leads to a bug when in some consoles "Clear" button is not active. See https://youtrack.jetbrains.com/issue/SCL-19370To Reproduce Steps to reproduce the behavior:
View | Tool Windows | sbt shell
Expected behavior "Clear" button is enabled
Implementation details
ClearConsoleAction
implementation should not try to search console view here.ConsoleView console
instance is already available, you can just pass it via constructor. Seecom.intellij.execution.impl.ConsoleViewImpl.ClearThisConsoleAction
for an example, your implementation should be based on it.Anyway, replacing default "clear console" action for all consoles for sake of statistics is a bad use of API (or lack of proper API and overuse of implementation detail). The best would be to remove
replaceClearAction(anActions);
completelyEnvironment : Scala Plugin : 2023.1.13 IntelliJ IDEA 2023.1 RC (Ultimate Edition) Build : IU-231.8109.156 March 25, 2023 JRE : 17.0.6+10-b829.5amd64 (OpenJDK 64-Bit Server VM JetBrains s.r.o.) OS : Windows (10.0, amd64) Project JDK : Oracle OpenJDK version 17.0.1 Server JDK : Oracle OpenJDK version 17.0.1