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
请先登录再写评论。
Hi Eric,
how do add the console to the UI?
Anna
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 ?
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
Yes but how do I add the console to the UI
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)
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.
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.
that's just want I wanted !. Sorry for the misunderstanding, and many thanks for your help