|
Re: How to introduce new Element inside GMF Generated PALETTE after Diagram Code Generation [message #703451 is a reply to message #703365] |
Wed, 27 July 2011 15:12 |
|
On 27/07/2011 15:50, buntha wrote:
> I am using the Eclipse Shape example(provided in 15minutes...).
> Now I created and got the Diagram Generated Code and I did a lot of
> modifications. Now I got the requirement of adding more
> components/elements inside the Palette.
> But if I start the process from Ecore generation , I am going to loose
> all my modifications.
That's exactly the reason why it is not a good idea to modify generated
code. You'd rather have either used gmf runtime extension point to
override the behavior of the generated editor, or use custom templates
to modify the way code is generated.
http://wiki.eclipse.org/Graphical_Modeling_Framework/Tutorial/Part_3
Generated code methods should be prefixed by a "@generated" comment. You
should replace it by "@generated NOT" on methods you've modified. Then
when regenerating your diagram on the same code, the generated won't
override these classes.
> Quote:
>> So is there any way to add or introduce any new Components/Element
>> which extends Shape directly in .gmfgen or any way which won't hurt my
>> modifications in the generated Diagram codes.
The good practice it to have a customization plugin and use a
org.eclipse.gmf.runtime.diagram.ui.editpartProviders extension to
override the editPart (and then the figure) for a given model element.
HTH
--
http://mickaelistria.wordpress.com
http://twitter.com/#!/mickaelistria
http://www.petalslink.com
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09290 seconds