catching output and displaying in a progress dialog [message #145578] |
Fri, 17 October 2003 06:35  |
Eclipse User |
|
|
|
Originally posted by: pippo.pluto.com
Hello all,
I am trying to catch System.out output from a standalone application I made.
When the app starts, it displays some informations to the standard out,
which I would like to redirect to a ProgressMonitorDialog, showing a
progress bar and those lines that are displayed in System.out as sub tasks
of a main task "Loading".
Any ideas how I can do it?
For the System.out redirection I am currently setting a different out, using
a ByteArrayOutputStream: the main method is as follows
public static void main(String[] args) {
baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
System.setOut(ps);
MyApp w = new MyApp();
w.setBlockOnOpen(true);
w.open();
Display.getCurrent().dispose();
}
I tried to reimplement the open method, so to include the creation of a
ProgressMonitorDialog and a long running operation object i created...wonder
what...it does not work and gives out a nullpointer exception.... :-O
I'd be very glad if someone can teach me how to do this...thanks a lot!
*GIU*
|
|
|
Re: catching output and displaying in a progress dialog [message #148676 is a reply to message #145578] |
Thu, 23 October 2003 14:12  |
Eclipse User |
|
|
|
Originally posted by: John_Arthorne.oti.com_
Wiring System.out to a progress monitor dialog seems like a very odd
thing to do. The intended approach is to use the IProgressMonitor
callback object supplied by ProgressMonitorDialog, pass it into your
"operation" code, and report progress to that using the subTask() and
worked() methods.
-
GIU wrote:
> Hello all,
> I am trying to catch System.out output from a standalone application I made.
> When the app starts, it displays some informations to the standard out,
> which I would like to redirect to a ProgressMonitorDialog, showing a
> progress bar and those lines that are displayed in System.out as sub tasks
> of a main task "Loading".
>
> Any ideas how I can do it?
>
> For the System.out redirection I am currently setting a different out, using
> a ByteArrayOutputStream: the main method is as follows
>
> public static void main(String[] args) {
>
> baos = new ByteArrayOutputStream();
>
> PrintStream ps = new PrintStream(baos);
>
> System.setOut(ps);
>
> MyApp w = new MyApp();
>
> w.setBlockOnOpen(true);
>
> w.open();
>
> Display.getCurrent().dispose();
>
> }
>
> I tried to reimplement the open method, so to include the creation of a
> ProgressMonitorDialog and a long running operation object i created...wonder
> what...it does not work and gives out a nullpointer exception.... :-O
>
> I'd be very glad if someone can teach me how to do this...thanks a lot!
>
> *GIU*
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03354 seconds