How to add a button under "Scroll to end" button

I'm implementing a plugin that interacts with console and would like to add my button under "Scroll to end" button that is located left to console. I looked through com.intellij.execution.impl.ConsoleViewImpl and found that there is no easy way to do that, i.e. no named action group is created there, all four actions are created manually and added to unnamed group. There exists an unused method com.intellij.execution.impl.ConsoleViewImpl#addCustomConsoleAction that could have been useful, but I do not know a way to postprocess ConsoleView being created so that I could cast to ConsoleViewImpl (not a good style though) and add my nice action button to the list.

6 comments
Comment actions Permalink

Hi Max,

As for now, I don't see any solution over than checking if particular ConsoleView IS-A ConsoleViewImpl, performing necessary type casting and calling ConsoleViewImpl.addCustomConsoleAction().

However, I don't have an objection to move that to the API (ConsoleView interface). Feel free to track the progress of IDEA-68346.

Denis

0
Comment actions Permalink

Ок, but how do I catch ConsoleView creation, so that I can add actions to it?

0
Comment actions Permalink

Sorry, the ticket's title was not strict enough. Updated.

Denis

0
Comment actions Permalink

So, you want to say that even

denis.zhdanov wrote:

As for now, I don't see any solution over than checking if particular ConsoleView IS-A ConsoleViewImpl, performing necessary type casting and calling ConsoleViewImpl.addCustomConsoleAction().

is not possible at the moment?

0
Comment actions Permalink

It's possible via dirty hack only, i.e. get reference to the ConsoleViewImpl object before its toolbar is constructed and add custom actions.

However, such an approach is ugly and not robust, hence, I'd recommend you to wait for the API expansion (will be part of 10.5 release).

Denis

0
Comment actions Permalink

Pretty clear, thank you.

0

Please sign in to leave a comment.