Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » catching output and displaying in a progress dialog
catching output and displaying in a progress dialog [message #145578] Fri, 17 October 2003 10:35 Go to next message
Eclipse UserFriend
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 18:12 Go to previous message
Eclipse UserFriend
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*
>
>
Previous Topic:Java nature/builder
Next Topic:swt: how to add to a TableViewer
Goto Forum:
  


Current Time: Sun Oct 06 14:14:58 GMT 2024

Powered by FUDForum. Page generated in 0.03222 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top