Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Implementing a Progress Monitor Dialog
Implementing a Progress Monitor Dialog [message #161574] Mon, 19 November 2007 22:33 Go to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

The user of my editor will be able to load a file. This can take a
while, so I figured a progress bar dialog would smooth things. I am
using JFace dialogs in other parts of my application, so I though about
using: org.eclipse.jface.dialogs.ProgressMonitorDialog.

I have found various examples on the net, but has anyone here
implemented a progress monitor before? I would love to see an example in
a gmf context :)


Best Regrads,

Tomas Zijdemans
Re: Implementing a Progress Monitor Dialog [message #161613 is a reply to message #161574] Tue, 20 November 2007 07:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: external.deyaa.adranale.de.bosch.com

Hi,

one way that is implemented in my program is to use
org.eclipse.jface.operation.IRunnableWithProgress as follows:

1. implement the interface
org.eclipse.jface.operation.IRunnableWithProgress
private class RunnableWithProgress implements IRunnableWithProgress {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
monitor.beginTask("task description", workunits);
// some work should be here
monitor.worked(someunits);
// extra work can be here.
monitor.done();
}
}

2. on the ok button click of your dialog or the performFinish() of your
wizard, you can write something like this:
this.getContainer().run(fork, cancelable, new RunnableWithProgress());


that's it
i hope it will of some help.


----------
Deyaa
Re: Implementing a Progress Monitor Dialog [message #161650 is a reply to message #161613] Tue, 20 November 2007 09:51 Go to previous message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

For file loading, this seems fitting:

InputStream in = new BufferedInputStream(new
ProgressMonitorInputStream(null, "Loading: " + "filename", new
FileInputStream(filename)));

The bad thing with this, is that it isn't jface - so the userface
becomes inconsistent.

Regards,

Tomas Zijdemans


Deyaa wrote:
> Hi,
>
> one way that is implemented in my program is to use
> org.eclipse.jface.operation.IRunnableWithProgress as follows:
>
> 1. implement the interface
> org.eclipse.jface.operation.IRunnableWithProgress
> private class RunnableWithProgress implements IRunnableWithProgress {
> public void run(IProgressMonitor monitor)
> throws InvocationTargetException, InterruptedException {
> monitor.beginTask("task description", workunits);
> // some work should be here
> monitor.worked(someunits);
> // extra work can be here. monitor.done();
> }
> }
>
> 2. on the ok button click of your dialog or the performFinish() of your
> wizard, you can write something like this:
> this.getContainer().run(fork, cancelable, new RunnableWithProgress());
>
>
> that's it
> i hope it will of some help.
>
>
> ----------
> Deyaa
>
Previous Topic:Strange code generated by GMF in XXXVisualIDRegistry#canCreateNode(...)
Next Topic:Creating new MetaModel Instance in Action
Goto Forum:
  


Current Time: Fri Apr 26 20:02:21 GMT 2024

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

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

Back to the top