Property Sheet remains empty with GMF 2.2

Aus SDQ-Wiki
  • Setting: Eclipse 3.5, GMF 2.2
  • Problem: The GMF property sheet for elements in the graphical editor remains empty. Although the propery sheet itself is generated, no attributes can be edited.
  • Solution: Change the file XXModelPropertySection.java and insert
return xxModelDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory();

into the getAdapterFactory(..) method. Afterwards, the method should look like this (do not forget the @generated NOT):

/**
 * @generated NOT
 */
protected AdapterFactory getAdapterFactory(Object object) {
	return xxModelDiagramEditorPlugin
			.getInstance().getItemProvidersAdapterFactory();
	//		if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
	//			return ((AdapterFactoryEditingDomain) getEditingDomain())
	//					.getAdapterFactory();
	//		}
	//		TransactionalEditingDomain editingDomain = TransactionUtil
	//				.getEditingDomain(object);
	//		if (editingDomain != null) {
	//			return ((AdapterFactoryEditingDomain) editingDomain)
	//					.getAdapterFactory();
	//		}
	//		return null;
}

where xxModelDiagramEditorPlugin steems from the package xx.part.

Hint: If the above does not help, also check the xx.part.xxModelDiagramEditorPlugin.createAdapterFactory() method and return an instance of the generated xxItemProviderAdapterFactory:

..
ComposedAdapterFactory caf = new ComposedAdapterFactory(factories) {
	    @Override
 	    public ComposeableAdapterFactory getRootAdapterFactory() {
		return (xxItemProviderAdapterFactory) adapterFactory;
	    }
	};
return new PalladioItemProviderAdapterFactory(caf);
Keywords: GMFGMF, Property Sheet, Eclipse, EMF