Reputation: 12132
Can I somehow use the same Eclipse plug-in project for both a generated EMF model and the corresponding generated EMF Edit code?
Normally these two components reside in two different projects, the EMF Edit one with the suffix .edit
to its name. I find this superfluous, since there is so little code in the Edit project, and it is so closely related to the model code.
I have tried setting both the modelDirectory
and the editDirectory
Gen Model attributes to (different) directories in the same project, but that seems to lead to endless confusion and build problems. I think maybe the two generation steps overwrite each others project setting files.
Upvotes: 0
Views: 153
Reputation: 12132
After some more experimentation it seems like it works fine to have EMF and EMF Edit generated code in the same project.
The things I had to do to make it work are the following:
modelDirectory
and editDirectory
to the same directory. Otherwise I got a build error saying "The type ... is already defined in ...".bundleManifest="false"
. Otherwise the plug-in ID is overwritten by the generation process.Apart from this I also set updateClasspath="false"
to avoid that the generation process messes around with that.
The automatic updates to the manifest and plugin.xml
files seem to be the following:
plugin.xml
2 and 3 needs to be performed manually if they are desired. That would involve adding entries to plugin.xml
similar to these:
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated model -->
<package
uri="somePackage"
class="somePackage.SomePackage"
genModel="model/model.xcore"/>
</extension>
<extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
<!-- @generated model -->
<factory
uri="somePackage"
class="somePackage.someClass"
supportedTypes=
"org.eclipse.emf.edit.provider.IEditingDomainItemProvider
org.eclipse.emf.edit.provider.IStructuredItemContentProvider
org.eclipse.emf.edit.provider.ITreeItemContentProvider
org.eclipse.emf.edit.provider.IItemLabelProvider
org.eclipse.emf.edit.provider.IItemPropertySource"/>
</extension>
Upvotes: 1