Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to introduce new Element inside GMF Generated PALETTE after Diagram Code Generation
How to introduce new Element inside GMF Generated PALETTE after Diagram Code Generation [message #703365] Wed, 27 July 2011 13:50 Go to next message
bunta Choudhary is currently offline bunta ChoudharyFriend
Messages: 38
Registered: December 2010
Member
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.

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.
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 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

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
Re: How to introduce new Element inside GMF Generated PALETTE after Diagram Code Generation [message #703520 is a reply to message #703451] Wed, 27 July 2011 16:48 Go to previous messageGo to next message
bunta Choudhary is currently offline bunta ChoudharyFriend
Messages: 38
Registered: December 2010
Member
@Mickael Istria

Can you please provide me any working example for -

Quote:
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.
Re: How to introduce new Element inside GMF Generated PALETTE after Diagram Code Generation [message #704043 is a reply to message #703520] Thu, 28 July 2011 07:41 Go to previous message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

http://www.bonitasoft.org/websvn/listing.php?repname=Bonita+Open+Solution&path=%2Fbonita-studio%2Ftrunk%2Fplugins%2Forg.bonitasoft.studio.diagram.custom%2F#path_bonita-studio_trunk_plugins_org.bonitasoft.studio.diagram.custom_

HTH

--
http://mickaelistria.wordpress.com
http://twitter.com/#!/mickaelistria
http://www.petalslink.com
Previous Topic:Unable to create editor ID error
Next Topic:Unifying Connections/Links
Goto Forum:
  


Current Time: Thu Apr 25 21:48:28 GMT 2024

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

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

Back to the top