Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Change behavior without modifying generated code
Change behavior without modifying generated code [message #1803311] Tue, 26 February 2019 16:02 Go to next message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 195
Registered: June 2010
Senior Member
Hi,

I would like to modify the behavior of the label provider without changing the generated code.

(The general idea is deescribed here: https://nirmalsasidharan.wordpress.com/2011/05/18/extending-emf-itemproviders-using-google-guice-i/ but then without the guice.)

I thought I could do that by extending the corresponding generated ItemProviders. For my ItemProviders to be used, I also had to extend the generated ItemProviderAdapterFactory. In order for that one to be used I had to modify the plugin.xml of the edit plugin. It registers the generated AdapterFactory and I changed that into MyAdapterFactory.

However, the emf generator generates a new extension each time I changed it into my AdapterFactory.

Is there a way to suppress generation of the extension in the plugin.xml by the emf generator? Or is there a better way to modify the behavior of the label providers without changing any generated code?

Greetings,
Wilbert.
Re: Change behavior without modifying generated code [message #1803330 is a reply to message #1803311] Wed, 27 February 2019 01:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31365
Registered: July 2009
Senior Member
Have you tried changing the marker in the plugin.xml? Also, if you disable Update Classpath in the GenModel, you can maintain the file manually.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Change behavior without modifying generated code [message #1803342 is a reply to message #1803330] Wed, 27 February 2019 07:42 Go to previous messageGo to next message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 195
Registered: June 2010
Senior Member
Hi Ed,

Plugin.xml indeed contains a line like:
      <!-- @generated Ddf -->


Changing that into <!-- @generated Ddf NOT--> results in adding an additional extension. (So then I have two itemProviderAdapterFactories extensions.) As far as I could tell, I could not force the generated editor to prefer mine over the default generated one.

Assuming that the 'update classpath' option is found below 'Templates & Merge' I could not determine any change in behavior. In other words, the plugin .xml gets overwritten regardless whether it is true or false.

Did I trigger some bugs here for which I should file a bug report? FYI, I have been using the windows version of eclipse:

Eclipse Modeling Tools
Version: Photon Release (4.8.0)
Build id: 20180619-1200

with:

EMF Code Generation
Version: 2.13.0.v20180319-0813
Build: 201805310718

Greetings,
Wilbert
Re: Change behavior without modifying generated code [message #1803365 is a reply to message #1803342] Wed, 27 February 2019 12:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31365
Registered: July 2009
Senior Member
I haven't tried it (I'm on vacation) but I believe if you comment out the default generated registration in the plugin.xml (deleting the @generated marker because <!-- --> can't nest), it will not generate an additional one and you can then register a different one.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Change behavior without modifying generated code [message #1803383 is a reply to message #1803365] Wed, 27 February 2019 15:50 Go to previous message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 195
Registered: June 2010
Senior Member
Hi Ed,

Brilliant!

That works. Thanks and enjoy your vacation!

Greetings,
Wilbert.
Previous Topic:Reference Model A classes in Model B without regenerating Model A
Next Topic:[CDO]
Goto Forum:
  


Current Time: Wed Aug 12 08:00:19 GMT 2020

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

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

Back to the top