Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-papyrus.dev] Custom code and code generation

Hi Patrick,

	Happy new Year to Papyrus Team!

It seem's, we can use two ways to customize the code generation from
GmfGen Model : 

* using dynamic templates to customize the code generation  : 
 a) Set Dynamic Templates as   true
 b) Set TemplateDirectory /org.eclipse.papyrus.codegen/dynamic-templates
 c) And create Xpand Aspect to override default GMF generator
, in example :  
/org.eclipse.papyrus.codegen/dynamic-templates/aspects/xpt/diagram/editparts/DiagramEditPart.xpt

* to add new concepts, it seem's that GMF 2.0 provide an extension
mechanism in order to annotate the GmfGen model with a custom metamodel.
But i never tested this feature, I think it's used as :
 a) Right-click on GmfGen model, and choose "Add Extension model..."
(see screenshot in attachment)
 b) Select your custom Ecore metamodel
 c) Populate your model to annotate GmfGen
 d) Read your annotation in Xpand Aspect to improve generation

Cheers,

Jérôme.
--
Obeo

 
Le mercredi 07 janvier 2009 à 12:21 +0100, TESSIER Patrick 202707 a
écrit :
> Hi,
>  
> I was continuing working on the class diagram editor but I have some
> problems that needs to be solved between going further. I have more
> and more customized code and the regeneration whe modifying the GMF
> models becomes more and more difficult.
> For some custumization I want to do, I cannot use the "not generated"
> tag. For example, for modeling the template signature, there is a
> particular locator and in this case I cannot use the "not generated"
> tag, because in this case there are sideeffects that will impact the
> possiblities to modify the compartiment of a  class. In this case, I
> think that the best solution is to modify the generation template
> itself.
> Questions:
> ==> Do you confirm, I am right?
> ==> Who has some experience in modifying the generation template? If
> yes what are the modifications that you may have done for example?
>  
> An addiitonal need I will have is to work on the gmfgen model in order
> to add specific behavior, e.g. on the edit parts. But I think it will
> not be sufficient, I think I will have to extend the gmfgen meta model
> (and also its editor) in order to add new concepts : e.g., specific
> locators, very specific parsers for stereotype label, etc. My purpose
> for such modifications, is to add information in the gmfgen model that
> will be needed to provide a more precise/complete, and above all
> efficient, code generation. In parallel, I have post this question in
> gmf newsgroup, but I would like to have your opinion also and help if
> possible.
>  
> Cheers... Patrick
>  
> ---------------------------------------------------------
> Patrick Tessier
> Research Engineer
> DRT LIST/DTSI/SOL/LISE CEA-Saclay
> 91191 Gif sur Yvette Cedex
> Tel: 01 69 08 48 63
> www.papyrusuml.org
> ---------------------------------------------------------
>  
> _______________________________________________
> mdt-papyrus.dev mailing list
> mdt-papyrus.dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/mdt-papyrus.dev

Attachment: ExtensionModel.png
Description: PNG image


Back to the top