Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Customize GMF editors(Scope of xpt templates for generating GMF editors and alternative GMF transformation chains)
Customize GMF editors [message #662808] Thu, 31 March 2011 23:29 Go to next message
LD  is currently offline 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 #662860 is a reply to message #662808] Fri, 01 April 2011 05:28 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 745
Registered: July 2009
Location: Grenoble, France
Senior Member
> - Do xpt templates for GMF modify generated models (gmfmap, gmftool,gmfgen, gmfgraph) as they http://www.bonitasoft.org/blog/eclipse/customize-your-gmf-ed itor-by-customizing-templates/code?

These templates read your gnfgen files and generate code from there. There are also templates which generates the gmfgen from the 3 other files.


> - Is there any reverse transformation chain or generators:
> e.g. http://opensource.urszeidler.de/ATLflow/index.html e.g. http://code.google.com/p/iaml/wiki/GmfTools
> i.e. .Reverse transformation: gmfgen --> .gmfmap --> ( .gmfgraph + .gmftool + .ecore ) ?

AFAIK, this does not exist.

> - Is posible to synchronize .gmfgen and .gmfmap with modified source code?

AFAIK, such a feature does not exist, but it would be very powerful!


There are some easier ways to customize GMF using GMF runtime extension points (provider). It is far easier to use than templates, and it is a better design.

HTH
--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
Eclipse Community Award 2011: Best Modeling Tool
Re: Customize GMF editors [message #662868 is a reply to message #662860] Fri, 01 April 2011 06:04 Go to previous messageGo to next message
LD  is currently offline LD
Messages: 28
Registered: March 2011
Junior Member
Hi Mickael, thank you.

Can you please give more information (e.g. where to find examples and/or documentation or papers) about:


  • The "templates which generates the gmfgen from the 3 other files." ( .gmfmap, gmfgraph, .gmftool )?
  • The GMF customization alternative "using GMF runtime extension points (provider)"?


By the chance the examples are inside Bonita-Studio, can you indicate me in what part concretely if you don´t mind Wink.

Regards.
Re: Customize GMF editors [message #662904 is a reply to message #662868] Fri, 01 April 2011 08:41 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 745
Registered: July 2009
Location: Grenoble, France
Senior Member
> The "templates which generates the gmfgen from the 3 other files." ( .gmfmap, gmfgraph, .gmftool )?

I've never customized such templates. Then I cannot really help you on such topics. I think it would require you to tweak the GmfGen generator, which is some internal GMF Tooling code. Then that's not recommended.


> The GMF customization alternative "using GMF runtime extension points (provider)"?

Sure:
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. gmf.doc/reference/extension-points/index.html
http://www2.imm.dtu.dk/courses/02162/e08/PDF/seminar-papers/ GMF2P1.pdf

These extension point allow you to override most of GMF runtime "providers" (~= factories). Then you can easily add or remove edit policies, use customized edit parts and so on.

> By the chance the examples are inside Bonita-Studio, can you indicate me in what part concretely if you don´t mind ;).

Here it is:
http://www.bonitasoft.org/websvn/listing.php?repname=Bonita+ Open+Solution&path=%2Fbonita-studio%2Fbranches%2Fbonita- studio-5.4.1%2Fplugins%2Forg.bonitasoft.studio.diagram.custo m%2F#path_bonita-studio_branches_bonita-studio-5.4.1_plugins _org.bonitasoft.studio.diagram.custom_
http://www.bonitasoft.org/websvn/filedetails.php?repname=Bon ita+Open+Solution&path=%2Fbonita-studio%2Fbranches%2Fbon ita-studio-5.4.1%2Fplugins%2Forg.bonitasoft.studio.diagram.c ustom%2Fplugin.xml

HTH

--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
Eclipse Community Award 2011: Best Modeling Tool
Re: Customize GMF editors [message #662917 is a reply to message #662904] Fri, 01 April 2011 09:29 Go to previous messageGo to next message
LD  is currently offline LD
Messages: 28
Registered: March 2011
Junior Member
Thank you. HTH2

Bonita-studio-5.4.1 y the latest stable version? I saw 5.4.2 in the Web SVN.

Are the providers and the whole project of org.bonitasoft.studio.diagram.custom deloped without code generation mediation?

Do you have public diagrams of plugin dependencies related to the editor and of the editor architecture?

Regards.
Re: Customize GMF editors [message #663196 is a reply to message #662917] Mon, 04 April 2011 05:46 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
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 #663375 is a reply to message #662917] Mon, 04 April 2011 15:47 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

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 - BonitaSoft S.A.
My blog
My company Eclipse-related blog
Re: Customize GMF editors [message #663993 is a reply to message #663375] Thu, 07 April 2011 02:35 Go to previous messageGo to next message
LD  is currently offline LD
Messages: 28
Registered: March 2011
Junior Member
Hi. Thank you Mickael, Ralph and Aurelien.

Sure Bonita Studio team is effective, the Award and the quality of the product talk really positive.

Looking to the reference of the templates of bonita studio, I have some questions.

[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)

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)

3. Templates are not involved with generating:
- org.bonitasoft.studio.diagram.form.properties/

[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?


[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?

Best Regards.
Re: Customize GMF editors [message #664006 is a reply to message #663993] Thu, 07 April 2011 03:56 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

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 Smile

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 #664143 is a reply to message #664006] Thu, 07 April 2011 11:47 Go to previous messageGo to next message
LD  is currently offline LD
Messages: 28
Registered: March 2011
Junior Member
Hi.

See comments belows.

Quote:

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/


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.
|
|-------->
Quote:
[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?


Regards.

Re: Customize GMF editors [message #664146 is a reply to message #664143] Thu, 07 April 2011 11:54 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 558
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

LD wrote on Thu, 07 April 2011 17:47


Quote:

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/


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 #664157 is a reply to message #664146] Thu, 07 April 2011 12:27 Go to previous messageGo to next message
LD  is currently offline LD
Messages: 28
Registered: March 2011
Junior Member
Hi.

Thank you. I actually modify these models with EOL scripts and generate the editors with Eugenia.

I suppose you mean the GMF editor provided for each model. But some times it is ticky so I thougth you could be using a custom approach.

Best Regards.
Re: Customize GMF editors [message #664170 is a reply to message #663375] Thu, 07 April 2011 13:22 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
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.

Quote:
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/


Actually I use this. The blog post is very helpful for beginners.

Quote:
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/


Why do you override addFixedChild and not addBorderItem?

Ralph

[Updated on: Thu, 07 April 2011 13:34]

Report message to a moderator

Previous Topic:NsLock issue
Next Topic:How to customize GMF editors with nodes to have particular behavior
Goto Forum:
  


Current Time: Thu Aug 28 11:26:10 EDT 2014

Powered by FUDForum. Page generated in 0.02203 seconds