Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » GMF Code Generation customization(Is there any way to customize code generation or reuse already customized GMF code with newer version of eclipse/GMF?)
icon5.gif  GMF Code Generation customization [message #1690626] Mon, 30 March 2015 08:47 Go to next message
Balaji Varaprasad is currently offline Balaji VaraprasadFriend
Messages: 1
Registered: March 2015
Junior Member
I am generating GMF code using by my own xsd, GMF generated /diagram/edit/parts package and other packages. now i want to do common customization for all classes which extends ConnectionNodeEditPart class which exist in /diagram/edit/parts package. GMF generated a method in the sub classes of ConnectionNodeEditPart who's signature is

protected void "addChildVisual(EditPart childEditPart, int index)" and method content as below.

if (addFixedChild(childEditPart)) {
return;
}
super.addChildVisual(childEditPart, index);
Now i want to customize all addChildVisual methods as follows.

if (addFixedChild(childEditPart)) {
return;
}
super.addChildVisual(childEditPart, -1);
This is just changing/replacing index to -1

There are 1000 class like this, need to modify each time when i am migrating from one eclipse version to next eclipse version. This is a sample/simple change i am discussing. There are other changes in which few methods content was added/changes and few new methods were added to GMF generated code.

When ever we migrate from one eclipse version to next version this tedious code customization part was troubling a lot.

Is there any way to reuse the already customized code with the newer version of eclipse/newer version of GMF. I can group my customizations as say suppose 15 modifications but each change has to do for 1000 number of java classes(same change). Is there any way to customize code generation or reuse already customized GMF code with newer version of eclipse/GMF??

Kindly help to solve this issue.

Thanks in advance.
Re: GMF Code Generation customization [message #1690644 is a reply to message #1690626] Mon, 30 March 2015 11:25 Go to previous message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 634
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

you can modify Templates used for generation You can have a look to http://community.bonitasoft.com/blog/customize-your-gmf-editor-customizing-templates
Please note that with the latest version I recommened to use Xtend templates instead of XPand ones (both are still provided)

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Previous Topic:gmf : Problems encountered durning Validation
Next Topic:Place connection anchors on a circle, but such that connections are on a line with the node's center
Goto Forum:
  


Current Time: Fri Oct 20 09:08:10 GMT 2017

Powered by FUDForum. Page generated in 0.23511 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software