capint
2/16/2016 - 3:27 PM

EMF >> Adapt EObject to ItemProvider

EMF >> Adapt EObject to ItemProvider

private IEditingDomainItemProvider getItemProvider(EObject element_p) {
  IEditingDomainItemProvider result = null;
  AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) AdapterFactoryEditingDomain.getEditingDomainFor(element_p);
  if (null != editingDomain) {
    result = (IEditingDomainItemProvider) editingDomain.getAdapterFactory().adapt(element_p, IEditingDomainItemProvider.class);
  }
  return result;
}

IEditingDomainItemProvider provider = getItemProvider(element);
parent = provider.getParent(element);