Merging model files before running XPand [message #57170] |
Mon, 13 July 2009 02:35  |
Eclipse User |
|
|
|
For maintainablitity reasons I have split the model (based on my TMF Xtext
DSL) over multiple files. Now I want to run xpand using the workflow, but
when I enter all the models separatly in the workflow, each model file is
parsed separatly. Is there a way to configure the workflow in such a way
that all the model files are merged together as one large model?
|
|
|
|
|
|
Re: Merging model files before running XPand [message #61620 is a reply to message #61578] |
Mon, 20 July 2009 15:29  |
Eclipse User |
|
|
|
This is the code I came up with myself. My model consist out of entities,
services and datalist. This Workflow component is called after each
MweReader. After all models are merged, the Generators are executed.
It works Ok, but I'm not sure if I will get in to trouble later, because
I'm not sure if the model is fully loaded correctly. Uptil now it works ok.
Thanx for the help
------------------------------------------------------------ --------------
package workflow;
import org.eclipse.emf.mwe.core.WorkflowContext;
import org.eclipse.emf.mwe.core.issues.Issues;
import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
import poc.model.businessDomain.impl.BusinessDomainModelImpl;
public class MyWorkflowComponent extends AbstractWorkflowComponent {
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor
monitor, Issues issues) {
System.out.println("my own workflow component");
BusinessDomainModelImpl model = (BusinessDomainModelImpl)
ctx.get("model");
if (model == null) {
return;
}
// Check if there is a model under a temporary key in the context
if (ctx.get("PBA") == null) {
//Set the model under a temporary key in the context
ctx.set("PBA", model);
} else {
//get the termporary stored model
BusinessDomainModelImpl model2 = (BusinessDomainModelImpl)ctx.get("PBA");
//Add items from store model2 to current model
model.getEntities().addAll(model2.getEntities());
model.getServices().addAll(model2.getServices());
model.getDataLists().addAll(model2.getDataLists());
// set the models to the context
ctx.set("PBA", model);
ctx.set("model", model);
}
}
@Override
public void checkConfiguration(Issues issues) {
// TODO Auto-generated method stub
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03267 seconds