[Xpand] How to indicate progress while executing a template ? [message #533956] |
Mon, 17 May 2010 14:45 |
Harald M Messages: 10 Registered: March 2010 |
Junior Member |
|
|
Hello,
I want to show the progress of several generation steps in a ProgressMonitorDialog. In the standard java steps it is easy to do a monitor.worked(numberOfTicks).
Is it possible to give a similar feedback in the Xpand template code ?
With the following code I am able to run the the Xpand template, but I get no feedback for the progress view.
The generation is called from an IRunnableWithProgress:
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitorAdapter;
monitor.beginTask("Generating xxx", 10);
[...]
monitor.worked(1);
[...]
ProgressMonitor oawMonitor;
oawMonitor = new ProgressMonitorAdapter(new SubProgressMonitor(monitor, 5));
generateFiles(model, path, oawMonitor);
[...]
monitor.done();
The template is executed via XpandFacade:
public static void generateFiles(Model model, String path, ProgressMonitor monitor) {
// configure outlet
OutputImpl output = new OutputImpl();
output.addOutlet(new Outlet(path));
// create execution context
XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl(output, null);
EmfRegistryMetaModel metamodel = new EmfRegistryMetaModel();
execCtx.registerMetaModel(metamodel);
execCtx.setMonitor(monitor);
// generate
XpandFacade facade = XpandFacade.create(execCtx);
facade.evaluate("templates::simulation::Template_all::main", model);
}
Thanks,
Harald
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03786 seconds