Home » Modeling » GMF (Graphical Modeling Framework) » Customize GMF editors(Scope of xpt templates for generating GMF editors and alternative GMF transformation chains)
| | | | |
Re: Customize GMF editors [message #663196 is a reply to message #662917] |
Mon, 04 April 2011 09:46 |
Ralph Gerbig Messages: 702 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 09:57] Report message to a moderator
|
|
|
Re: Customize GMF editors [message #663375 is a reply to message #662917] |
Mon, 04 April 2011 19:47 |
|
Hi,
LD wrote on Fri, 01 April 2011 15:29 |
Bonita-studio-5.4.1 y the latest stable version? I saw 5.4.2 in the Web SVN.
|
5.4.1 is the latest stable release but 5.4.2 will be soon release.
LD wrote on Fri, 01 April 2011 15:29 |
Are the providers and the whole project of org.bonitasoft.studio.diagram.custom deloped without code generation mediation?
|
No, we are efffectively using also custom templates. you can find them here:http://www.bonitasoft.org/websvn/listing.php?repname=Bo nita+Open+Solution&path=%2Fbonita-studio%2Fbranches%2Fbo nita-studio-5.4.1%2Fplugins%2Forg.bonitasoft.studio-models%2 F#path_bonita-studio_branches_bonita-studio-5.4.1_plugins_or g.bonitasoft.studio-models_
We are using them when there are no extension points available or if we want to customize a part of code that is generated for a lot of elements.
LD wrote on Fri, 01 April 2011 15:29 |
Do you have public diagrams of plugin dependencies related to the editor and of the editor architecture?
|
sorry no. But you can use this http://www.eclipse.org/pde/incubator/dependency-visualizatio n/index.php to hae a quick overview.
Ralph |
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:
|
Are you able to generate the code with this transformation in a headless build?
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?
Ralph |
This book can be helpful too.
|
yes this is a good starting point for EMF and GMF.
Ralph |
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.
|
effectively using aspect templates is better. You can take a look to this blogpost: http://www.bonitasoft.org/blog/eclipse/customize-your-gmf-ed itor-by-customizing-templates/
Regards,
Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
|
|
| |
Re: Customize GMF editors [message #664006 is a reply to message #663993] |
Thu, 07 April 2011 07: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 - Red Hat
Senior Software Engineer in Fuse Tooling team
|
|
| |
Re: Customize GMF editors [message #664146 is a reply to message #664143] |
Thu, 07 April 2011 15: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 - Red Hat
Senior Software Engineer in Fuse Tooling team
|
|
| |
Re: Customize GMF editors [message #664170 is a reply to message #663375] |
Thu, 07 April 2011 17:22 |
Ralph Gerbig Messages: 702 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 17:34] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Nov 02 11:51:05 GMT 2024
Powered by FUDForum. Page generated in 0.03655 seconds
|