Search in sources :

Example 6 with IItemPropertySource

use of org.eclipse.emf.edit.provider.IItemPropertySource in project ecf by eclipse.

the class EObjectPropertySourceFactory method getAdapter.

/* (non-Javadoc)
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
	 */
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adapterType.equals(IPropertySource.class) && adaptableObject instanceof EObject) {
        EObject eObj = (EObject) adaptableObject;
        List adapters = eObj.eAdapters();
        for (Iterator itr = adapters.iterator(); itr.hasNext(); ) {
            Object adapter = itr.next();
            if (adapter instanceof IItemPropertySource) {
                // TODO handle the case with multiple IItemPropertySource adapters for this EObject
                return new PropertySource(adaptableObject, (IItemPropertySource) adapter);
            }
        }
    }
    return null;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Iterator(java.util.Iterator) IPropertySource(org.eclipse.ui.views.properties.IPropertySource) List(java.util.List) EObject(org.eclipse.emf.ecore.EObject) IItemPropertySource(org.eclipse.emf.edit.provider.IItemPropertySource) IPropertySource(org.eclipse.ui.views.properties.IPropertySource) PropertySource(org.eclipse.emf.edit.ui.provider.PropertySource) IItemPropertySource(org.eclipse.emf.edit.provider.IItemPropertySource)

Aggregations

IItemPropertySource (org.eclipse.emf.edit.provider.IItemPropertySource)6 EObject (org.eclipse.emf.ecore.EObject)3 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)2 BusinessAssignment (org.talend.designer.business.model.business.BusinessAssignment)2 Iterator (java.util.Iterator)1 List (java.util.List)1 IItemPropertyDescriptor (org.eclipse.emf.edit.provider.IItemPropertyDescriptor)1 PropertySource (org.eclipse.emf.edit.ui.provider.PropertySource)1 Shell (org.eclipse.swt.widgets.Shell)1 IPropertySource (org.eclipse.ui.views.properties.IPropertySource)1