Acceleo doesn't seem to do anything with the Monitor instance passed into it other than check for cancellation while visiting nodes of the template file model.
Is that intentional or a not-yet-implemented feature?
As a workaround currently I add an IAcceleoTextGenerationListener and update my progress monitor for each fileGenerated event.
That's a rather course level of progress reporting though. The template engine could provide more fine-grained progress as it proceeds through the template.
I'm encountering the same problem with IndigoSR1 and Acceleo 3.2.0. I tried to use a ProgressMonitorDialog to pass some feedback about the current progress to the user. However, the code is being generated, but no ProgressMonitorDialog is shown to the user.
ProgressMonitorDialog dlg = new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
dlg.create();
dlg.setOpenOnRun(true);
generator.doGenerate(BasicMonitor.toMonitor(dlg.getProgressMonitor()));
How exactly are you launching the generation? You don't usually create your own progress monitor, but reuse one that you are fed. For example in this case I'd use something of the sort :
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
...
generator.doGenerate(BasicMonitor.toMonitor(monitor));
}
};
PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runnable);
My code does pretty much exactly what your sample code shows Laurent.
SubProgressMonitor codegenMonitor = new SubProgressMonitor(monitor, 70);
final Monitor acceleoMonitor = BasicMonitor.toMonitor(codegenMonitor);
acceleoMonitor.beginTask("Generating code...", countFilesToBeGenerated(...));
Generate generator = new Generate(someArgument, targetFolder , Collections.emptyList());
generator.addGenerationListener(new AcceleoGenerationAdapter() {
public void fileGenerated(AcceleoTextGenerationEvent event) {
acceleoMonitor.worked(1);
}
});
generator.generate(acceleoMonitor);
Here you see my workaround for progress - since Acceleo doesn't seem to update the progress monitor I added a GenerationListener and update the monitor myself for each file I see generated.