@Override protected void onFinish(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) { if (!found) { issues.addError("No resource found in the slot"); return; } ctx.set(modelSlot, modelElements); }
protected void compileInternal( FdcHolder fdcs, BackendTypesystem bts, String contributorNamespace, String contributorName, String outputDir, String fileEncoding) { Map<String, Object> variables = new HashMap<String, Object>(); variables.put("fdcs", fdcs); variables.put("contributorNamespace", contributorNamespace); variables.put("contributorName", contributorName); variables.put("typesystem", bts); Collection<Outlet> outlets = new ArrayList<Outlet>(); outlets.add(new Outlet(outputDir)); Collection<MetaModel> metamodels = new ArrayList<MetaModel>(); metamodels.add(new JavaBeansMetaModel()); _log.info("Compiling resources " + fdcs.getResources().toString() + " to " + outputDir); Generator gen = new Generator(); gen.addMetaModel(new JavaBeansMetaModel()); Outlet out = new Outlet(outputDir); out.addPostprocessor(new JavaBeautifier()); gen.addOutlet(out); gen.setFileEncoding(fileEncoding); gen.setExpand( "org::eclipse::xtend::backend::compiler::templates::backend::Java5Compiler::compile (typesystem, contributorNamespace, contributorName) FOR fdcs"); gen.setBeautifier(Arrays.asList(org.eclipse.xpand2.output.JavaBeautifier.class)); WorkflowContext ctx = new WorkflowContextDefaultImpl(); ctx.set("fdcs", fdcs); ctx.set("contributorNamespace", contributorNamespace); ctx.set("contributorName", contributorName); ctx.set("typesystem", bts); Issues issues = new IssuesImpl(); gen.invoke(ctx, new NullProgressMonitor(), issues); // XpandBackendFacade.executeStatement(XpandTokens.LT + "EXPAND // org::eclipse::xtend::backend::compiler::templates::Java5Compiler::compile // (contributorNamespace, contributorName) FOR fdcs" + XpandTokens.RT, fileEncoding, metamodels, // variables, outlets, null); }
public void invokeInternal(WorkflowContext ctx, ProgressMonitor arg1, Issues arg2) { OCLstdlib.install(); Resource resource = (Resource) ctx.get(getUmlSlot()); log.info("Pivoting '" + resource.getURI() + "'"); MetaModelManager metaModelManager = MetaModelManager.getAdapter(resource.getResourceSet()); UML2Ecore2Pivot uml2pivot = UML2Ecore2Pivot.getAdapter(resource, metaModelManager); org.eclipse.ocl.examples.pivot.Package root = uml2pivot.getPivotRoot(); Resource resource2 = root.eResource(); ctx.set(getModelSlot(), resource2); }