Collection of notes on common problems and issues I faced while doing day to day programming
Wednesday, November 20, 2013
Customizing item provider adapter in EMF
By default all item provider adapters in EMF extend ItemProviderAdapter, however sometimes it's necessary to change base class for the adapters to something else. For example, today I was reading this post about suppressing DocumentRoot during model load and Ed Merks suggested specializing ResourceItemProvider to skip root. Great, but do I really need to update all my adapters to extend new class, manually? Nope, GenModel to the rescue once again this time with its attribute 'Provider Root Extends Class'. I just added 'org.eclipse.emf.edit.provider.resource.ResourceItemProvider' to the attribute, regenerated edit code and voilà, all my adapters extend ResourceItemProvider.