Home » Eclipse Projects » Plugin Development Environment (PDE) » using monitors and submonitors
using monitors and submonitors [message #756942] |
Tue, 15 November 2011 15:56 |
|
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
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Goto Forum:
Current Time: Tue Sep 24 18:11:36 GMT 2024
Powered by FUDForum. Page generated in 0.03220 seconds
|