Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » using monitors and submonitors
using monitors and submonitors [message #756942] Tue, 15 November 2011 15:56
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1362
Registered: July 2009
Senior Member
Hi

I started to use monitor (with submonitors), and by reading here

http://wiki.eclipse.org/FAQ_How_do_I_use_a_SubProgressMonitor%3F

I understand that the correct use case is as follows (for instance,
reusing the code in the FAQ):

if this is the main method (copied from the FAQ)

public void move(File a, File b, IProgressMonitor pm) {
try {
pm.beginTask("Moving", 10);
copy(a, b, new SubProgressMonitor(pm, 8));
delete(a, new SubProgressMonitor(pm, 2));
} finally {
pm.done();
}
}

then, in copy and deleted (not shown in the FAQ) I should do as follows:

public void copy(File a, File b, IProgressMonitor pm) {
pm.beginTask("Copying", 1);
...
pm.done();
}

public void delete(File a, IProgressMonitor pm) {
pm.beginTask("Deleting", 1);
...
pm.done();
}

However, if I do like this, the message on the monitor is not changed...
it is changed only if I do

pm.subTask("Copying");

and

pm.subTask("Deleting");

so what is the correct way of using monitors and submonitors?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Previous Topic:Re: Custom LaunchShortcut, debugger does not link source
Next Topic:Understanding the Evolution Eclipse non-APIs
Goto Forum:
  


Current Time: Wed Oct 01 00:00:59 GMT 2014

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

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