|
Re: How to invoke the code generation programmatically [message #468131 is a reply to message #468127] |
Tue, 04 August 2009 10:28 |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
invoke the generation programmatically works with this snippet:
ISelectionService selectionService =
Activator.getDefault().getWorkbench().getActiveWorkbenchWind ow().getSelectionService();
ISelection selection = selectionService.getSelection();
if(selection instanceof IStructuredSelection){
IStructuredSelection strucSel = (IStructuredSelection)selection;
if(strucSel.size() == 1){
if(strucSel.getFirstElement() instanceof GenModel){
GenModel genModel = (GenModel) strucSel.getFirstElement();
Generator generator = new Generator();
generator.setInput(genModel);
generator.generate(genModel,
GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, new BasicMonitor());
generator.generate(genModel,
GenBaseGeneratorAdapter.EDIT_PROJECT_TYPE, new BasicMonitor());
}
}
}
This starts the generation of the model and the edit code for example.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04406 seconds