ConsoleView, print not working

Hi,

I'm trying to print to the console for simple debugging of an applicationComponent  plugin ,
here is my code :

Project[] vProjects=ProjectManager.getInstance().getOpenProjects();
Project vCurrentProject=vProjects[0];

ConsoleView vConsole= TextConsoleBuilderFactory.getInstance().createBuilder(vCurrentProject).getConsole();
vConsole.print("test", ConsoleViewContentType.NORMAL_OUTPUT);

I have no errors, but nothing appears in the console, what aml I doing wrong ?
Thanks
0
8 comments

Hi Eric,

how do add the console to the UI? 

Anna

0
Avatar
Permanently deleted user

Sorry Anna, I don't understand your comment. You mean I need to add the console to the UI.

If it's the problem how do I do that ?

0

In order to see printed text, you need to see the console. As there is no code which adds the console to UI, I assumed that there could be an issue. If you would share that code, please also share the place where the code would be invoked as if you try to do this e.g. in ApplicationComponent.initComponent this won't work as there won't be any projects (and you will see AIOOBE, so it's not your case) but still the place could be important.

 

Anna

0
Avatar
Permanently deleted user

Yes but how do I add the console to the UI

0

Console.getComponent() returns Component and you can place it inside e.g. tool window (corresponding tutorial https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/tool_window)

0
Avatar
Permanently deleted user

I think there is a misunderstanding. The console allready exist, it's the debugger console of the Intellij Ide.

I just want to write in that console, I don't want and I don't need to create my own console.

0

This call

TextConsoleBuilderFactory.getInstance().createBuilder(vCurrentProject).getConsole()

creates new console and you write to the new console which is invisible in the UI, so it's expected that debugger console is not updated. If you mean that you want to write to the console of the IDE itself, then you may just call System.out.print().

Please explain your task as it's impossible to get the console of any existing process to write there. There are specific APIs to react on different debug events though, etc. 

0
Avatar
Permanently deleted user
System.out.print(). 

that's just want I wanted !. Sorry for the misunderstanding, and many thanks for your help

0

Please sign in to leave a comment.