Writing to the ConsoleView [message #36816] |
Mon, 02 December 2002 14:46 |
Eclipse User |
|
|
|
Originally posted by: benjamin.diefenbach.lhsystems.com
After several hours of searching for a easy and fast way to write to the
console window it works now.
Here is the code for doing so.
IViewPart viewPart =
JavaPlugin.getActivePage().findView("org.eclipse.debug.ui.ConsoleView ");
if (viewPart instanceof ConsoleView) {
ConsoleView console = (ConsoleView) viewPart;
console.getConsoleViewer().getDocument().set("Test message");
}
The ConsoleView which you must import is the
"org.eclipse.debug.internal.ui.views.console.ConsoleView" which is
included in the org.eclipse.debug.ui plugin.
If this doesn`t work just look for all Workbenchpages and test if you can
find the view. This may be if the ConsoleWindow is not in the actual
perspective.
IWorkbenchWindow windows[] =
JavaPlugin.getActiveWorkbenchWindow().getWorkbench().getWork benchWindows();
for (int i = 0; i < windows.length; i++) {
IWorkbenchWindow window = windows[i];
IWorkbenchPage pages[] = window.getPages();
for (int j = 0; j < pages.length; j++) {
IWorkbenchPage page = pages[j];
IViewPart foundViewPart = page.
findView("org.eclipse.debug.ui.ConsoleView");
if (foundViewPart != null) {
viewPart = foundViewPart;
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03468 seconds