/******************************************************************************* * Copyright (c) 2011 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Google, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.wb.rcp.databinding; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.emf.databinding.EMFObservables; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; /** * This class may be freely distributed as part of any application or plugin. * * @author lobas_av */ public class EMFBeansListObservableFactory extends BeansObservableFactory { private final EStructuralFeature m_eStructuralFeature; //////////////////////////////////////////////////////////////////////////// // // Constructor // //////////////////////////////////////////////////////////////////////////// public EMFBeansListObservableFactory(Class<?> beanClass, EStructuralFeature eStructuralFeature) { super(beanClass); m_eStructuralFeature = eStructuralFeature; } //////////////////////////////////////////////////////////////////////////// // // BeansObservableFactory // //////////////////////////////////////////////////////////////////////////// @Override protected IObservable createBeanObservable(Object target) { if (target instanceof EObject) { return EMFObservables.observeList(Realm.getDefault(), (EObject) target, m_eStructuralFeature); } return null; } }