| Customize GMF editors [message #662808] |
Thu, 31 March 2011 23:29  |
LD Messages: 28 Registered: March 2011 |
Junior Member |
|
|
Hi,
I am new with GMF templates. I would like help on:
- Do xpt templates for GMF modify generated models (gmfmap, gmftool,gmfgen, gmfgraph) as they customize the generated editor code?
- Is there any reverse transformation chain or generators:
e.g. ATL Flow Generators
e.g. IAML GMF Tools
i.e. .Reverse transformation: gmfgen --> .gmfmap --> ( .gmfgraph + .gmftool + .ecore ) ?
- Is posible to synchronize .gmfgen and .gmfmap with modified source code?
Thanks in advance.
|
|
|
|
|
|
|
| Re: Customize GMF editors [message #663196 is a reply to message #662917] |
Mon, 04 April 2011 05:46   |
Ralph Gerbig Messages: 550 Registered: November 2009 |
Senior Member |
|
|
Hi,
do I understand right that you want to modify the genmodel via a transformation? Take a look at this gmf plugin: http://code.google.com/p/gmftools/ . I use a post reconcile qvto transformation to do this. You can choose the transformation to execute on the last page of the genmodel creation wizzard. A post reconcile transformation would look like this:
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
transformation postRec(inout gmfgenModel : GMFGEN);
property genNavigator : GenNavigator = null;
property genStandardPrefencePage : GenStandardPreferencePage = null;
property genPlugIn : GenPlugin = null;
property genEditorGenerator : GenEditorGenerator = null;
property genDiagram: GenDiagram = null;
main() {
this.genEditorGenerator := gmfgenModel.objectsOfType(GenEditorGenerator)->asOrderedSet()->first();
genDiagram := gmfgenModel.objectsOfType(GenDiagram)->asOrderedSet()->first();
this.genPlugIn := gmfgenModel.objectsOfType(GenPlugin)->asOrderedSet()->first();
this.genStandardPrefencePage := gmfgenModel.objectsOfType(GenStandardPreferencePage)->asOrderedSet()->first();
this.genNavigator := gmfgenModel.objectsOfType(GenNavigator)->asOrderedSet()->first();
--fix BUG 331875
gmfgenModel.objectsOfType(ExpressionLabelParser)->forEach(parser)
{
parser.className := parser.className.concat(parser._uses->first().container().oclAsType(GenNodeLabel).visualID.toString());
};
}
This book can be helpful too.
I use custom expand templates to add custom code to the code generation. Here you can find the by gmf used templates org.eclipse.gmf.codegen. Just define a AROUND block for the definitions you want to override. Sometimes it is usefull to override only for some genmodel elements this can be done by using an if statement at the begining in you around block and write in it's else statemen <<targetDef.proceed()>>. So you get only your custom code executed for the elements you want.
Hope this helps you!
Ralph
[Updated on: Mon, 04 April 2011 05:57] Report message to a moderator
|
|
|
|
|
| Re: Customize GMF editors [message #664006 is a reply to message #663993] |
Thu, 07 April 2011 03:56   |
|
| LD wrote on Thu, 07 April 2011 08:35 | Hi. Thank you Mickael, Ralph and Aurelien.
Sure Bonita Studio team is effective, the Award and the quality of the product talk really positive.
|
Thank you 
| LD wrote on Thu, 07 April 2011 08:35 |
[Templates and Extensions ~Related Q.]
1. Templates in org.bonitasoft.studio-models/GMFTemplates/ are used for customizing this projects:
- (proj1) org.bonitasoft.studio.diagram/ (100% generated)
- org.bonitasoft.studio.diagram.custom/ (100% generated) Are the extensions generated too?
- org.bonitasoft.studio.common.diagram/ (100% generated)
|
org.bonitasoft.studio.diagram/ is generated
org.bonitasoft.studio.diagram.custom/ nothing is not generated, there are most of the subclass and providers that extends the generated code
g.bonitasoft.studio.common.diagram/ is not generated. We are using some classes in the generated code and also for the other diagram.
| LD wrote on Thu, 07 April 2011 08:35 |
2. Templates in org.bonitasoft.studio-models/form/GMFTemplates/
- (proj2) org.bonitasoft.studio.diagram.form/ (100% generated)
- org.bonitasoft.studio.diagram.form.custom/ (x% generated)
|
- (proj2) org.bonitasoft.studio.diagram.form/ (100% generated)
- org.bonitasoft.studio.diagram.form.custom/ (0% generated)
| LD wrote on Thu, 07 April 2011 08:35 |
3. Templates are not involved with generating:
- org.bonitasoft.studio.diagram.form.properties/
|
no
| LD wrote on Thu, 07 April 2011 08:35 |
[Execution of Templates ~Related Q.]
4. I see some of the projects (i.e. proj1, proj2) are automatically generated by means of GMF Diagram Code Generation functionality. And similar with the EMF templates. But do you use any other mechanism to automate the generation such as an ANT script, MWE, particular eclipse LUNCH configurations or something else?
|
In development mode, we are using the classic right-click generate code on the model files.
For build process, we are using ant tasks to generate EMF and GMF code. It avoids to have desynchronisation between svn code and generated code.
| LD wrote on Thu, 07 April 2011 08:35 |
[GMF models manipulation by transformation ~Related Q.]
5. I saw specific customizations of the .gmfgraph, .gmfmap such the required for having intemediate bpmn events in the border of an activity in bonita studio models project. Are this customizations done by hand, or do have scripts to manipulate those models such as the language EOL from Epsilon or the QVTO mentioned by Ralph?
|
For border items, I invite you to take a look to this blogpost: http://www.bonitasoft.org/blog/tutorial/how-to-create-and-cu stomize-boundary-items-in-eclipse-gmf/
Regards,
Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
|
|
|
|
| Re: Customize GMF editors [message #664146 is a reply to message #664143] |
Thu, 07 April 2011 11:54   |
|
| LD wrote on Thu, 07 April 2011 17:47 |
Yes I saw it and it works perfectly, and the correspondance in the SVN. That is why I ask (Q5) if the .gmfgraph and .gmfmap are modified by hand or not.
|
gmfgraph and gmfmap are modified using the graphical interface.
This is part of the graphical model, this is the main way to modelize/customize your GMF diagram.
Regards,
Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
|
|
|
|
| Re: Customize GMF editors [message #664170 is a reply to message #663375] |
Thu, 07 April 2011 13:22  |
Ralph Gerbig Messages: 550 Registered: November 2009 |
Senior Member |
|
|
Hi,
| Quote: | Why do you choose to use a post-reconcile approcach and don't customize code generation at the generation? Some precise use cases? Easier code to read?
|
I use this for all changes to the generator model that are done by hand. My usecases are filling in the paths for aspect templates, building up the gen navigator, fixing a bug with expression labels etc. The transformation enables me to delete and generate the generator model without the need to set it up by hand after is was deleted and new created.
Actually I use this. The blog post is very helpful for beginners.
Why do you override addFixedChild and not addBorderItem?
Ralph
[Updated on: Thu, 07 April 2011 13:34] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05021 seconds