Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 134185 Details for
Bug 262160
Implement the new Property-based Databinding-API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Bean Properties port of EMFProperties
patch.txt (text/plain), 75.20 KB, created by
Hasan Ceylan
on 2009-05-03 17:38:45 EDT
(
hide
)
Description:
Bean Properties port of EMFProperties
Filename:
MIME Type:
Creator:
Hasan Ceylan
Created:
2009-05-03 17:38:45 EDT
Size:
75.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.databinding >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.databinding/META-INF/MANIFEST.MF,v >retrieving revision 1.5 >diff -u -r1.5 MANIFEST.MF >--- META-INF/MANIFEST.MF 21 Oct 2008 11:03:56 -0000 1.5 >+++ META-INF/MANIFEST.MF 3 May 2009 21:37:40 -0000 >@@ -11,6 +11,7 @@ > Export-Package: org.eclipse.emf.databinding > Require-Bundle: org.eclipse.core.runtime, > org.eclipse.emf.ecore;visibility:=reexport, >- org.eclipse.core.databinding;visibility:=reexport >+ org.eclipse.core.databinding;visibility:=reexport, >+ org.eclipse.core.databinding.property;bundle-version="1.2.0" > Eclipse-LazyStart: true > Bundle-ActivationPolicy: lazy >Index: src/org/eclipse/emf/databinding/EMFObservables.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.databinding/src/org/eclipse/emf/databinding/EMFObservables.java,v >retrieving revision 1.3 >diff -u -r1.3 EMFObservables.java >--- src/org/eclipse/emf/databinding/EMFObservables.java 22 Apr 2008 13:36:00 -0000 1.3 >+++ src/org/eclipse/emf/databinding/EMFObservables.java 3 May 2009 21:37:40 -0000 >@@ -1,18 +1,16 @@ > /** >- * <copyright> >- * >- * Copyright (c) 2007 IBM Corporation and others. >- * 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 >+ * <copyright> >+ * >+ * Copyright (c) 2007 IBM Corporation and others. 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: IBM - Initial API and implementation Trevor S. Kaufman - Bug >+ * 215131 - added mapFactory > * >- * Contributors: >- * IBM - Initial API and implementation >- * Trevor S. Kaufman - Bug 215131 - added mapFactory >- * > * </copyright> >- * >+ * > * $Id: EMFObservables.java,v 1.3 2008/04/22 13:36:00 emerks Exp $ > */ > package org.eclipse.emf.databinding; >@@ -30,165 +28,229 @@ > import org.eclipse.emf.ecore.EStructuralFeature; > > /** >- * PROVISIONAL >- * This API is subject to arbitrary change, including renaming or removal. >+ * PROVISIONAL This API is subject to arbitrary change, including renaming or >+ * removal. > */ >-public class EMFObservables >-{ >- /** >- * Returns an observable value for the given feature of the object. >- * @param eObject the object to observe. >- * @param eStructuralFeature the feature of the object to observe. >- * @return an observable value for the given feature of the object. >- */ >- public static IObservableValue observeValue(EObject eObject, EStructuralFeature eStructuralFeature) >- { >- return new EObjectObservableValue(eObject, eStructuralFeature); >- } >- >- /** >- * Returns an observable value for the given feature of the object. >- * @param realm the realm in which to observe. >- * @param eObject the object to observe. >- * @param eStructuralFeature the feature of the object to observe. >- * @return an observable value for the given feature of the object. >- */ >- public static IObservableValue observeValue(Realm realm, EObject eObject, EStructuralFeature eStructuralFeature) >- { >- return new EObjectObservableValue(realm, eObject, eStructuralFeature); >- } >- >- /** >- * Returns an observable list for the given multi-valued feature of the object. >- * @param eObject the object to observe. >- * @param eStructuralFeature the feature of the object to observe. >- * @return an observable list for the given multi-valued feature of the object. >- */ >- public static IObservableList observeList(EObject eObject, EStructuralFeature eStructuralFeature) >- { >- return new EObjectObservableList(eObject, eStructuralFeature); >- } >- >- /** >- * Returns an observable list for the given multi-valued feature of the object. >- * @param realm the realm in which to observe. >- * @param eObject the object to observe. >- * @param eStructuralFeature the feature of the object to observe. >- * @return an observable list for the given multi-valued feature of the object. >- */ >- public static IObservableList observeList(Realm realm, EObject eObject, EStructuralFeature eStructuralFeature) >- { >- return new EObjectObservableList(realm, eObject, eStructuralFeature); >- } >- >- /** >- * Returns an observable map in the default realm >- * tracking the current value of the given feature for each object in the given set. >- * @param objects the objects to track. >- * @param eStructuralFeature the feature for which to track the value. >- * @return an observable map tracking the current value of the given feature for each object in the given set. >- */ >- public static IObservableMap observeMap(IObservableSet objects, EStructuralFeature eStructuralFeature) >- { >- return new EObjectObservableMap(objects, eStructuralFeature); >- } >- >- /** >- * Returns an array of observable maps in the default realm >- * tracking the current value of the given features for each object in the given set. >- * @param objects the objects to track. >- * @param eStructuralFeatures the features for which to track the value. >- * @return an array of observable maps tracking the current value of the given features for each object in the given set. >- */ >- public static IObservableMap[] observeMaps(IObservableSet objects, EStructuralFeature[] eStructuralFeatures) >- { >- IObservableMap[] result = new IObservableMap [eStructuralFeatures.length]; >- for (int i = 0; i < eStructuralFeatures.length; i++) >- { >- result[i] = observeMap(objects, eStructuralFeatures[i]); >- } >- return result; >- } >- >- /** >- * Returns an observable value that tracks the current value of the feature of the current value of the master observable value. >- * @param realm the realm in which to observe. >- * @param value the master observable value. >- * @param eStructuralFeature the feature for which to track the value. >- * @return an observable value that tracks the current value of the named property for the current value of the master observable value >- * @see MasterDetailObservables#detailValue(IObservableValue, IObservableFactory, Object) >- */ >- public static IObservableValue observeDetailValue(Realm realm, IObservableValue value, EStructuralFeature eStructuralFeature) >- { >- return MasterDetailObservables.detailValue(value, valueFactory(realm, eStructuralFeature), eStructuralFeature); >- } >- >- /** >- * Returns a factory for creating observable values >- * tracking the value of the given feature of a particular {@link EObject object}. >- * @param realm the realm in which to observe. >- * @param eStructuralFeature the feature for which to track the value. >- * @return an observable factory. >- */ >- public static IObservableFactory valueFactory(final Realm realm, final EStructuralFeature eStructuralFeature) >- { >- return >- new IObservableFactory() >- { >- public IObservable createObservable(Object target) >- { >- return observeValue(realm, (EObject)target, eStructuralFeature); >- } >- }; >- } >- >- /** >- * Returns an observable list that tracks the current value of the feature of the current value of the master observable value. >- * @param realm the realm in which to observe. >- * @param value the master observable value. >- * @param eStructuralFeature the feature for which to track the value. >- * @return an observable value that tracks the current value of the named property for the current value of the master observable value >- * @see MasterDetailObservables#detailList(IObservableValue, IObservableFactory, Object) >- */ >- public static IObservableList observeDetailList(Realm realm, IObservableValue value, EStructuralFeature eStructuralFeature) >- { >- return MasterDetailObservables.detailList(value, listFactory(realm, eStructuralFeature), eStructuralFeature); >- } >- >- /** >- * Returns a factory for creating observable lists >- * tracking the value of the given feature of a particular {@link EObject object}. >- * @param realm the realm in which to observe. >- * @param eStructuralFeature the feature for which to track the value. >- * @return an observable factory. >- */ >- public static IObservableFactory listFactory(final Realm realm, final EStructuralFeature eStructuralFeature) >- { >- return >- new IObservableFactory() >- { >- public IObservable createObservable(Object target) >- { >- return observeList(realm, (EObject)target, eStructuralFeature); >- } >- }; >- } >- >- /** >- * Returns a factory for creating observable maps >- * tracking the value of the given feature of a particular {@link EObject object}. >- * @param eStructuralFeature the feature for which to track the value. >- * @return an observable factory. >- */ >- public static IObservableFactory mapFactory(final EStructuralFeature eStructuralFeature) >- { >- return >- new IObservableFactory() >- { >- public IObservable createObservable(Object target) >- { >- return observeMap((IObservableSet)target, eStructuralFeature); >- } >- }; >- } >+public class EMFObservables { >+ >+ /** >+ * Returns a factory for creating observable lists tracking the value of the >+ * given feature of a particular {@link EObject object}. >+ * >+ * @param realm >+ * the realm in which to observe. >+ * @param eStructuralFeature >+ * the feature for which to track the value. >+ * @return an observable factory. >+ */ >+ public static IObservableFactory listFactory(final Realm realm, final EStructuralFeature eStructuralFeature) { >+ return new IObservableFactory() { >+ >+ public IObservable createObservable(Object target) { >+ return EMFObservables.observeList(realm, ( EObject ) target, eStructuralFeature); >+ } >+ }; >+ } >+ >+ /** >+ * Returns a factory for creating observable maps tracking the value of the >+ * given feature of a particular {@link EObject object}. >+ * >+ * @param eStructuralFeature >+ * the feature for which to track the value. >+ * @return an observable factory. >+ */ >+ public static IObservableFactory mapFactory(final EStructuralFeature eStructuralFeature) { >+ return new IObservableFactory() { >+ >+ public IObservable createObservable(Object target) { >+ return EMFObservables.observeMap(( IObservableSet ) target, eStructuralFeature); >+ } >+ }; >+ } >+ >+ /** >+ * Returns an observable list that tracks the current value of the feature >+ * of the current value of the master observable value. >+ * >+ * @param value >+ * the master observable value. >+ * @param eStructuralFeature >+ * the feature for which to track the value. >+ * @return an observable value that tracks the current value of the named >+ * property for the current value of the master observable value >+ * @see MasterDetailObservables#detailList(IObservableValue, >+ * IObservableFactory, Object) >+ */ >+ public static IObservableList observeDetailList(IObservableValue value, EStructuralFeature eStructuralFeature) { >+ return EMFObservables.observeDetailList(Realm.getDefault(), value, eStructuralFeature); >+ } >+ >+ /** >+ * Returns an observable list that tracks the current value of the feature >+ * of the current value of the master observable value. >+ * >+ * @param realm >+ * the realm in which to observe. >+ * @param value >+ * the master observable value. >+ * @param eStructuralFeature >+ * the feature for which to track the value. >+ * @return an observable value that tracks the current value of the named >+ * property for the current value of the master observable value >+ * @see MasterDetailObservables#detailList(IObservableValue, >+ * IObservableFactory, Object) >+ */ >+ public static IObservableList observeDetailList(Realm realm, IObservableValue value, EStructuralFeature eStructuralFeature) { >+ return MasterDetailObservables.detailList(value, EMFObservables.listFactory(realm, eStructuralFeature), eStructuralFeature); >+ } >+ >+ /** >+ * Returns an observable value that tracks the current value of the feature >+ * of the current value of the master observable value. >+ * >+ * @param value >+ * the master observable value. >+ * @param eStructuralFeature >+ * the feature for which to track the value. >+ * @return an observable value that tracks the current value of the named >+ * property for the current value of the master observable value >+ * @see MasterDetailObservables#detailValue(IObservableValue, >+ * IObservableFactory, Object) >+ */ >+ public static IObservableValue observeDetailValue(IObservableValue value, EStructuralFeature eStructuralFeature) { >+ return EMFObservables.observeDetailValue(Realm.getDefault(), value, eStructuralFeature); >+ } >+ >+ /** >+ * Returns an observable value that tracks the current value of the feature >+ * of the current value of the master observable value. >+ * >+ * @param realm >+ * the realm in which to observe. >+ * @param value >+ * the master observable value. >+ * @param eStructuralFeature >+ * the feature for which to track the value. >+ * @return an observable value that tracks the current value of the named >+ * property for the current value of the master observable value >+ * @see MasterDetailObservables#detailValue(IObservableValue, >+ * IObservableFactory, Object) >+ */ >+ public static IObservableValue observeDetailValue(Realm realm, IObservableValue value, EStructuralFeature eStructuralFeature) { >+ return MasterDetailObservables.detailValue(value, EMFObservables.valueFactory(realm, eStructuralFeature), eStructuralFeature); >+ } >+ >+ /** >+ * Returns an observable list for the given multi-valued feature of the >+ * object. >+ * >+ * @param eObject >+ * the object to observe. >+ * @param eStructuralFeature >+ * the feature of the object to observe. >+ * @return an observable list for the given multi-valued feature of the >+ * object. >+ */ >+ public static IObservableList observeList(EObject eObject, EStructuralFeature eStructuralFeature) { >+ return new EObjectObservableList(eObject, eStructuralFeature); >+ } >+ >+ /** >+ * Returns an observable list for the given multi-valued feature of the >+ * object. >+ * >+ * @param realm >+ * the realm in which to observe. >+ * @param eObject >+ * the object to observe. >+ * @param eStructuralFeature >+ * the feature of the object to observe. >+ * @return an observable list for the given multi-valued feature of the >+ * object. >+ */ >+ public static IObservableList observeList(Realm realm, EObject eObject, EStructuralFeature eStructuralFeature) { >+ return new EObjectObservableList(realm, eObject, eStructuralFeature); >+ } >+ >+ /** >+ * Returns an observable map in the default realm tracking the current value >+ * of the given feature for each object in the given set. >+ * >+ * @param objects >+ * the objects to track. >+ * @param eStructuralFeature >+ * the feature for which to track the value. >+ * @return an observable map tracking the current value of the given feature >+ * for each object in the given set. >+ */ >+ public static IObservableMap observeMap(IObservableSet objects, EStructuralFeature eStructuralFeature) { >+ return new EObjectObservableMap(objects, eStructuralFeature); >+ } >+ >+ /** >+ * Returns an array of observable maps in the default realm tracking the >+ * current value of the given features for each object in the given set. >+ * >+ * @param objects >+ * the objects to track. >+ * @param eStructuralFeatures >+ * the features for which to track the value. >+ * @return an array of observable maps tracking the current value of the >+ * given features for each object in the given set. >+ */ >+ public static IObservableMap[] observeMaps(IObservableSet objects, EStructuralFeature[] eStructuralFeatures) { >+ final IObservableMap[] result = new IObservableMap[eStructuralFeatures.length]; >+ for ( int i = 0; i < eStructuralFeatures.length; i++ ) { >+ result[i] = EMFObservables.observeMap(objects, eStructuralFeatures[i]); >+ } >+ return result; >+ } >+ >+ /** >+ * Returns an observable value for the given feature of the object. >+ * >+ * @param eObject >+ * the object to observe. >+ * @param eStructuralFeature >+ * the feature of the object to observe. >+ * @return an observable value for the given feature of the object. >+ */ >+ public static IObservableValue observeValue(EObject eObject, EStructuralFeature eStructuralFeature) { >+ return new EObjectObservableValue(eObject, eStructuralFeature); >+ } >+ >+ /** >+ * Returns an observable value for the given feature of the object. >+ * >+ * @param realm >+ * the realm in which to observe. >+ * @param eObject >+ * the object to observe. >+ * @param eStructuralFeature >+ * the feature of the object to observe. >+ * @return an observable value for the given feature of the object. >+ */ >+ public static IObservableValue observeValue(Realm realm, EObject eObject, EStructuralFeature eStructuralFeature) { >+ return new EObjectObservableValue(realm, eObject, eStructuralFeature); >+ } >+ >+ /** >+ * Returns a factory for creating observable values tracking the value of >+ * the given feature of a particular {@link EObject object}. >+ * >+ * @param realm >+ * the realm in which to observe. >+ * @param eStructuralFeature >+ * the feature for which to track the value. >+ * @return an observable factory. >+ */ >+ public static IObservableFactory valueFactory(final Realm realm, final EStructuralFeature eStructuralFeature) { >+ return new IObservableFactory() { >+ >+ public IObservable createObservable(Object target) { >+ return EMFObservables.observeValue(realm, ( EObject ) target, eStructuralFeature); >+ } >+ }; >+ } > } >Index: src/org/eclipse/emf/databinding/internal/EObjectObservableListDecorator.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectObservableListDecorator.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectObservableListDecorator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectObservableListDecorator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,59 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.observable.IObservable; >+import org.eclipse.core.databinding.observable.IObserving; >+import org.eclipse.core.databinding.observable.list.DecoratingObservableList; >+import org.eclipse.core.databinding.observable.list.IObservableList; >+import org.eclipse.emf.databinding.IEObjectObservable; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * {@link IBeanObservable} decorator for an {@link IObservableList}. >+ * >+ * @since 3.3 >+ */ >+public class EObjectObservableListDecorator extends DecoratingObservableList implements IEObjectObservable { >+ >+ private EStructuralFeature feature; >+ >+ /** >+ * @param decorated >+ * @param feature >+ */ >+ public EObjectObservableListDecorator(IObservableList decorated, EStructuralFeature feature) { >+ super(decorated, true); >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.observable.list.DecoratingObservableList >+ * #dispose() >+ */ >+ @Override >+ public synchronized void dispose() { >+ this.feature = null; >+ super.dispose(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.batoo.utils.ui.databinding.IEObjectObservable#getFeature() >+ */ >+ public EStructuralFeature getFeature() { >+ return this.feature; >+ } >+ >+ public Object getObserved() { >+ final IObservable decorated = this.getDecorated(); >+ if ( decorated instanceof IObserving ) { >+ return ( ( IObserving ) decorated ).getObserved(); >+ } >+ return null; >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectObservableMapDecorator.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectObservableMapDecorator.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectObservableMapDecorator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectObservableMapDecorator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,64 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.observable.IObservable; >+import org.eclipse.core.databinding.observable.IObserving; >+import org.eclipse.core.databinding.observable.map.DecoratingObservableMap; >+import org.eclipse.core.databinding.observable.map.IObservableMap; >+import org.eclipse.emf.databinding.IEObjectObservable; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * {@link IEObjectObservable} decorator for an {@link IObservableMap}. >+ * >+ * @since 3.5 >+ */ >+public class EObjectObservableMapDecorator extends DecoratingObservableMap implements IEObjectObservable { >+ >+ private EStructuralFeature feature; >+ >+ /** >+ * @param decorated >+ * @param feature >+ */ >+ public EObjectObservableMapDecorator(IObservableMap decorated, EStructuralFeature feature) { >+ super(decorated, true); >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.observable.map.DecoratingObservableMap#dispose >+ * () >+ */ >+ @Override >+ public synchronized void dispose() { >+ this.feature = null; >+ super.dispose(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.batoo.utils.ui.databinding.IEObjectObservable#getFeature() >+ */ >+ public EStructuralFeature getFeature() { >+ return this.feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.core.databinding.observable.IObserving#getObserved() >+ */ >+ public Object getObserved() { >+ final IObservable decorated = this.getDecorated(); >+ if ( decorated instanceof IObserving ) { >+ return ( ( IObserving ) decorated ).getObserved(); >+ } >+ return null; >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/internal/EMFPropertiesHelper.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EMFPropertiesHelper.java >diff -N src/org/eclipse/emf/databinding/internal/EMFPropertiesHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EMFPropertiesHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+abstract class EMFPropertiesHelper { >+ >+ static Object getType(EStructuralFeature feature) { >+ try { >+ return Class.forName(feature.getEType().getInstanceClassName()); >+ } >+ catch ( final ClassNotFoundException e ) { >+ return null; >+ } >+ } >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectValueProperty.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectValueProperty.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectValueProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectValueProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,71 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.property.INativePropertyListener; >+import org.eclipse.core.databinding.property.ISimplePropertyListener; >+import org.eclipse.core.databinding.property.value.SimpleValueProperty; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class EObjectValueProperty extends SimpleValueProperty { >+ >+ private final EStructuralFeature feature; >+ >+ /** >+ * @param feature >+ */ >+ public EObjectValueProperty(EStructuralFeature feature) { >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.SimpleValueProperty#adaptListener >+ * (org.eclipse.core.databinding.property.ISimplePropertyListener) >+ */ >+ @Override >+ public INativePropertyListener adaptListener(final ISimplePropertyListener listener) { >+ return new EObjectPropertyListener(this, this.feature, listener); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.SimpleValueProperty#doGetValue >+ * (java.lang.Object) >+ */ >+ @Override >+ protected Object doGetValue(Object source) { >+ return ( ( EObject ) source ).eGet(this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.SimpleValueProperty#doSetValue >+ * (java.lang.Object, java.lang.Object) >+ */ >+ @Override >+ protected void doSetValue(Object source, Object value) { >+ ( ( EObject ) source ).eSet(this.feature, value); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.IValueProperty#getValueType() >+ */ >+ public Object getValueType() { >+ return this.feature.getEType(); >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/IEObjectMapProperty.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/IEObjectMapProperty.java >diff -N src/org/eclipse/emf/databinding/IEObjectMapProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/IEObjectMapProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+package org.eclipse.emf.databinding; >+ >+ >+import java.util.Map; >+ >+import org.eclipse.core.databinding.property.map.IMapProperty; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * An {@link IMapProperty} extension interface with convenience methods for >+ * creating nested EObject properties. >+ * >+ * @since 1.2 >+ * @noextend This interface is not intended to be extended by clients. >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+public interface IEObjectMapProperty extends IEObjectProperty, IMapProperty { >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * value property. >+ * >+ * @param feature >+ * @return a master-detail combination of this property and the specified >+ * value property. >+ * @see #values(IBeanValueProperty) >+ */ >+ public IEObjectMapProperty values(EStructuralFeature... feature); >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * value property. The returned property will observe the specified value >+ * property for all {@link Map#values() values} observed by this map >+ * property, mapping from this map property's {@link Map#keySet() key set} >+ * to the specified value property's value for each element in the master >+ * property's {@link Map#values() values} collection. >+ * >+ * @param property >+ * the detail property to observe >+ * @return a master-detail combination of this property and the specified >+ * value property. >+ */ >+ public IEObjectMapProperty values(IEObjectValueProperty property); >+ >+} >Index: src/org/eclipse/emf/databinding/IEObjectProperty.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/IEObjectProperty.java >diff -N src/org/eclipse/emf/databinding/IEObjectProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/IEObjectProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+package org.eclipse.emf.databinding; >+ >+ >+import org.eclipse.core.databinding.property.IProperty; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * An IProperty extension interface providing access to details of EObject >+ * structural features. >+ * >+ * @since 1.2 >+ * @noextend This interface is not intended to be extended by clients. >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+public interface IEObjectProperty extends IProperty { >+ >+ /** >+ * Returns the structural feature of the {@link EObject} property being >+ * observed. This method returns null in the case of anonymous properties. >+ * >+ * @return the structural feature of the EObject property being observed >+ */ >+ public EStructuralFeature getFeature(); >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectMapProperty.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectMapProperty.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectMapProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectMapProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,116 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.databinding.observable.map.MapDiff; >+import org.eclipse.core.databinding.property.INativePropertyListener; >+import org.eclipse.core.databinding.property.ISimplePropertyListener; >+import org.eclipse.core.databinding.property.map.SimpleMapProperty; >+import org.eclipse.emf.ecore.EClass; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * @since 3.5 >+ * >+ */ >+public class EObjectMapProperty extends SimpleMapProperty { >+ >+ private final EStructuralFeature feature; >+ >+ /** >+ * @param feature >+ * @param keyType >+ * @param valueType >+ */ >+ public EObjectMapProperty(EStructuralFeature feature) { >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.SimpleMapProperty#adaptListener >+ * (org.eclipse.core.databinding.property.ISimplePropertyListener) >+ */ >+ @Override >+ public INativePropertyListener adaptListener(final ISimplePropertyListener listener) { >+ return new EObjectMapPropertyListener(this, this.feature, listener); >+ } >+ >+ /** >+ * @param propertyValue >+ * @return >+ */ >+ private Map asMap(Object propertyValue) { >+ if ( propertyValue == null ) { >+ return new HashMap(); >+ } >+ >+ return ( Map ) propertyValue; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.SimpleMapProperty#doGetMap( >+ * java.lang.Object) >+ */ >+ @Override >+ protected Map doGetMap(Object source) { >+ return this.asMap(( ( EObject ) source ).eGet(this.feature)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.SimpleMapProperty#doSetMap( >+ * java.lang.Object, java.util.Map, >+ * org.eclipse.core.databinding.observable.map.MapDiff) >+ */ >+ @Override >+ protected void doSetMap(Object source, Map map, MapDiff diff) { >+ diff.applyTo(( Map ) ( ( EObject ) source ).eGet(this.feature)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.core.databinding.property.map.IMapProperty#getKeyType() >+ */ >+ public Object getKeyType() { >+ final EClass eType = ( EClass ) this.feature.getEType(); >+ >+ for ( final EStructuralFeature feature : eType.getEAllStructuralFeatures() ) { >+ if ( feature.getName().equals("key") ) { >+ return EMFPropertiesHelper.getType(feature); >+ } >+ } >+ >+ return null; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.IMapProperty#getValueType() >+ */ >+ public Object getValueType() { >+ final EClass eType = ( EClass ) this.feature.getEType(); >+ >+ for ( final EStructuralFeature feature : eType.getEAllStructuralFeatures() ) { >+ if ( feature.getName().equals("value") ) { >+ return EMFPropertiesHelper.getType(feature); >+ } >+ } >+ >+ return null; >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectMapPropertyDecorator.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectMapPropertyDecorator.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectMapPropertyDecorator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectMapPropertyDecorator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,150 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.map.IObservableMap; >+import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; >+import org.eclipse.core.databinding.observable.value.IObservableValue; >+import org.eclipse.core.databinding.property.map.IMapProperty; >+import org.eclipse.core.databinding.property.map.MapProperty; >+import org.eclipse.emf.databinding.EMFProperties; >+import org.eclipse.emf.databinding.IEObjectMapProperty; >+import org.eclipse.emf.databinding.IEObjectValueProperty; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * @since 3.5 >+ * >+ */ >+public class EObjectMapPropertyDecorator extends MapProperty implements IEObjectMapProperty { >+ >+ private final IMapProperty delegate; >+ >+ private final EStructuralFeature feature; >+ >+ /** >+ * @param delegate >+ * @param feature >+ */ >+ public EObjectMapPropertyDecorator(IMapProperty delegate, EStructuralFeature feature) { >+ this.delegate = delegate; >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.batoo.utils.ui.databinding.IEObjectProperty#getFeature() >+ */ >+ public EStructuralFeature getFeature() { >+ return this.feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.core.databinding.property.map.IMapProperty#getKeyType() >+ */ >+ public Object getKeyType() { >+ return this.delegate.getKeyType(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.IMapProperty#getValueType() >+ */ >+ public Object getValueType() { >+ return this.delegate.getValueType(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.core.databinding.property.map.MapProperty#mapFactory() >+ */ >+ @Override >+ public IObservableFactory mapFactory() { >+ return this.delegate.mapFactory(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.MapProperty#mapFactory(org. >+ * eclipse.core.databinding.observable.Realm) >+ */ >+ @Override >+ public IObservableFactory mapFactory(Realm realm) { >+ return this.delegate.mapFactory(realm); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.MapProperty#observe(java.lang >+ * .Object) >+ */ >+ @Override >+ public IObservableMap observe(Object source) { >+ return new EObjectObservableMapDecorator(this.delegate.observe(source), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.IMapProperty#observe(org.eclipse >+ * .core.databinding.observable.Realm, java.lang.Object) >+ */ >+ public IObservableMap observe(Realm realm, Object source) { >+ return new EObjectObservableMapDecorator(this.delegate.observe(realm, source), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.map.MapProperty#observeDetail(org >+ * .eclipse.core.databinding.observable.value.IObservableValue) >+ */ >+ @Override >+ public IObservableMap observeDetail(IObservableValue master) { >+ return new EObjectObservableMapDecorator(this.delegate.observeDetail(master), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see java.lang.Object#toString() >+ */ >+ @Override >+ public String toString() { >+ return this.delegate.toString(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectMapProperty#values(org.eclipse >+ * .emf.ecore.EStructuralFeature) >+ */ >+ public IEObjectMapProperty values(EStructuralFeature... feature) { >+ return this.values(EMFProperties.value(feature)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectMapProperty#values(org.batoo.utils >+ * .ui.databinding.IEObjectValueProperty) >+ */ >+ public IEObjectMapProperty values(IEObjectValueProperty property) { >+ return new EObjectMapPropertyDecorator(super.values(property), property.getFeature()); >+ } >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectListProperty.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectListProperty.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectListProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectListProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,84 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.core.databinding.observable.list.ListDiff; >+import org.eclipse.core.databinding.property.INativePropertyListener; >+import org.eclipse.core.databinding.property.ISimplePropertyListener; >+import org.eclipse.core.databinding.property.list.SimpleListProperty; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class EObjectListProperty extends SimpleListProperty { >+ >+ private final EStructuralFeature feature; >+ >+ /** >+ * @param feature >+ * @param elementType >+ */ >+ public EObjectListProperty(EStructuralFeature feature) { >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.SimpleListProperty#adaptListener >+ * (org.eclipse.core.databinding.property.ISimplePropertyListener) >+ */ >+ @Override >+ public INativePropertyListener adaptListener(final ISimplePropertyListener listener) { >+ return new EObjectListPropertyListener(this, this.feature, listener); >+ } >+ >+ private List asList(Object propertyValue) { >+ if ( propertyValue == null ) { >+ return new ArrayList(); >+ } >+ return ( List ) propertyValue; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.SimpleListProperty#doGetList >+ * (java.lang.Object) >+ */ >+ @Override >+ protected List doGetList(Object source) { >+ return this.asList(( ( EObject ) source ).eGet(this.feature)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.SimpleListProperty#doSetList >+ * (java.lang.Object, java.util.List, >+ * org.eclipse.core.databinding.observable.list.ListDiff) >+ */ >+ @Override >+ protected void doSetList(Object source, List list, ListDiff diff) { >+ diff.applyTo(( List ) ( ( EObject ) source ).eGet(this.feature)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.IListProperty#getElementType() >+ */ >+ public Object getElementType() { >+ return EMFPropertiesHelper.getType(this.feature); >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectListPropertyDecorator.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectListPropertyDecorator.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectListPropertyDecorator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectListPropertyDecorator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,137 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.list.IObservableList; >+import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; >+import org.eclipse.core.databinding.observable.value.IObservableValue; >+import org.eclipse.core.databinding.property.list.IListProperty; >+import org.eclipse.core.databinding.property.list.ListProperty; >+import org.eclipse.emf.databinding.EMFProperties; >+import org.eclipse.emf.databinding.IEObjectListProperty; >+import org.eclipse.emf.databinding.IEObjectValueProperty; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * @since 3.5 >+ * >+ */ >+public class EObjectListPropertyDecorator extends ListProperty implements IEObjectListProperty { >+ >+ private final IListProperty delegate; >+ >+ private final EStructuralFeature feature; >+ >+ /** >+ * @param delegate >+ * @param feature >+ */ >+ public EObjectListPropertyDecorator(IListProperty delegate, EStructuralFeature feature) { >+ this.delegate = delegate; >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.IListProperty#getElementType() >+ */ >+ public Object getElementType() { >+ return this.delegate.getElementType(); >+ } >+ >+ public EStructuralFeature getFeature() { >+ return this.feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.ListProperty#listFactory() >+ */ >+ @Override >+ public IObservableFactory listFactory() { >+ return this.delegate.listFactory(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.ListProperty#listFactory(org >+ * .eclipse.core.databinding.observable.Realm) >+ */ >+ @Override >+ public IObservableFactory listFactory(Realm realm) { >+ return this.delegate.listFactory(realm); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.ListProperty#observe(java. >+ * lang.Object) >+ */ >+ @Override >+ public IObservableList observe(Object source) { >+ return new EObjectObservableListDecorator(this.delegate.observe(source), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.IListProperty#observe(org. >+ * eclipse.core.databinding.observable.Realm, java.lang.Object) >+ */ >+ public IObservableList observe(Realm realm, Object source) { >+ return new EObjectObservableListDecorator(this.delegate.observe(realm, source), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.list.ListProperty#observeDetail >+ * (org.eclipse.core.databinding.observable.value.IObservableValue) >+ */ >+ @Override >+ public IObservableList observeDetail(IObservableValue master) { >+ return new EObjectObservableListDecorator(this.delegate.observeDetail(master), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see java.lang.Object#toString() >+ */ >+ @Override >+ public String toString() { >+ return this.delegate.toString(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectListProperty#values(org.eclipse >+ * .emf.ecore.EStructuralFeature[]) >+ */ >+ public IEObjectListProperty values(EStructuralFeature... feature) { >+ return this.values(EMFProperties.value(feature)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectListProperty#values(org.batoo. >+ * utils.ui.databinding.IEObjectValueProperty) >+ */ >+ public IEObjectListProperty values(IEObjectValueProperty property) { >+ return new EObjectListPropertyDecorator(super.values(property), property.getFeature()); >+ } >+} >Index: src/org/eclipse/emf/databinding/IEObjectSetProperty.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/IEObjectSetProperty.java >diff -N src/org/eclipse/emf/databinding/IEObjectSetProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/IEObjectSetProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,42 @@ >+package org.eclipse.emf.databinding; >+ >+ >+import org.eclipse.core.databinding.property.set.ISetProperty; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * An {@link ISetProperty} extension interface with convenience methods for >+ * creating nested EObject properties. >+ * >+ * @since 1.2 >+ * @noextend This interface is not intended to be extended by clients. >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+public interface IEObjectSetProperty extends IEObjectProperty, ISetProperty { >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * value property. >+ * >+ * @param feature >+ * the value property to observe. May be nested e.g. "parent.name" >+ * @return a master-detail combination of this property and the specified >+ * value property. >+ * @see #values(IEObjectValueProperty) >+ */ >+ public IEObjectMapProperty values(EStructuralFeature... feature); >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * value property. The returned property will observe the specified value >+ * property for all elements observed by this set property, mapping from >+ * this set property's elements (keys) to the specified value property's >+ * value for each element (values). >+ * >+ * @param property >+ * the detail property to observe >+ * @return a master-detail combination of this property and the specified >+ * value property. >+ */ >+ public IEObjectMapProperty values(IEObjectValueProperty property); >+} >Index: src/org/eclipse/emf/databinding/EMFProperties.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/EMFProperties.java >diff -N src/org/eclipse/emf/databinding/EMFProperties.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/EMFProperties.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,124 @@ >+package org.eclipse.emf.databinding; >+ >+ >+import org.eclipse.core.databinding.property.list.IListProperty; >+import org.eclipse.core.databinding.property.map.IMapProperty; >+import org.eclipse.core.databinding.property.value.IValueProperty; >+import org.eclipse.emf.databinding.internal.EObjectListProperty; >+import org.eclipse.emf.databinding.internal.EObjectListPropertyDecorator; >+import org.eclipse.emf.databinding.internal.EObjectMapProperty; >+import org.eclipse.emf.databinding.internal.EObjectMapPropertyDecorator; >+import org.eclipse.emf.databinding.internal.EObjectValueProperty; >+import org.eclipse.emf.databinding.internal.EObjectValuePropertyDecorator; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * A factory for creating properties for Java objects that conform to the <a >+ * href="http://java.sun.com/products/javabeans/docs/spec.html">JavaBean >+ * specification</a> for bound properties. >+ * >+ * @since 1.2 >+ */ >+public class EMFProperties { >+ >+ /** >+ * Returns a list property for the given property name of the given bean >+ * class. >+ * >+ * @param feature >+ * the property name >+ * @return a list property for the given property name of the given bean >+ * class. >+ */ >+ public static IEObjectListProperty list(EStructuralFeature feature) { >+ final IListProperty property = new EObjectListProperty(feature); >+ >+ return new EObjectListPropertyDecorator(property, feature); >+ } >+ >+ /** >+ * Returns a map property for the given property name of the given bean >+ * class. >+ * >+ * @param feature >+ * the property name >+ * @return a map property for the given property name of the given bean >+ * class. >+ */ >+ public static IEObjectMapProperty map(EStructuralFeature feature) { >+ final IMapProperty property = new EObjectMapProperty(feature); >+ >+ return new EObjectMapPropertyDecorator(property, feature); >+ } >+ >+ /** >+ * Returns a value property for the given property name of the given bean >+ * class. >+ * >+ * @param features >+ * the property name. May be nested e.g. "parent, name" >+ * @return a value property for the given property name of the given bean >+ * class. >+ */ >+ public static IEObjectValueProperty value(EStructuralFeature... features) { >+ final IValueProperty property = new EObjectValueProperty(features[0]); >+ >+ IEObjectValueProperty objectValueProperty = new EObjectValuePropertyDecorator(property, features[0]); >+ for ( int i = 1; i < features.length; i++ ) { >+ objectValueProperty = objectValueProperty.value(features[i]); >+ } >+ return objectValueProperty; >+ } >+ >+ /** >+ * Returns a value property for the given property name of the given bean >+ * class. >+ * >+ * @param feature >+ * the property name. May be nested e.g. "parent, name" >+ * @return a value property for the given property name of the given bean >+ * class. >+ */ >+ public static IEObjectValueProperty value(EStructuralFeature feature) { >+ final EStructuralFeature[] wrappedFeature = new EStructuralFeature[] { feature }; >+ >+ return EMFProperties.value(wrappedFeature); >+ } >+ >+ /** >+ * Returns a value property array for the given property names of the given >+ * bean class. >+ * >+ * @param features >+ * array of property names. >+ * @return a value property array for the given property names of the given >+ * bean class. >+ */ >+ public static IEObjectValueProperty[] values(EStructuralFeature... features) { >+ final EStructuralFeature[][] wrappedFeatures = new EStructuralFeature[features.length][]; >+ >+ for ( int i = 0; i < features.length; i++ ) { >+ wrappedFeatures[i] = new EStructuralFeature[] { features[i] }; >+ } >+ >+ return EMFProperties.values(wrappedFeatures); >+ } >+ >+ /** >+ * Returns a value property array for the given property names of the given >+ * bean class. >+ * >+ * @param features >+ * array of property names. May be nested e.g. "parent, name" >+ * @return a value property array for the given property names of the given >+ * bean class. >+ */ >+ public static IEObjectValueProperty[] values(EStructuralFeature[]... features) { >+ final IEObjectValueProperty[] properties = new IEObjectValueProperty[features.length]; >+ for ( int i = 0; i < properties.length; i++ ) { >+ properties[i] = EMFProperties.value(features[i]); >+ } >+ return properties; >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectObservableValueDecorator.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectObservableValueDecorator.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectObservableValueDecorator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectObservableValueDecorator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,64 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.observable.IObservable; >+import org.eclipse.core.databinding.observable.IObserving; >+import org.eclipse.core.databinding.observable.value.DecoratingObservableValue; >+import org.eclipse.core.databinding.observable.value.IObservableValue; >+import org.eclipse.emf.databinding.IEObjectObservable; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * {@link IEObjectObservable} decorator for an {@link IObservableValue}. >+ * >+ * @since 3.5 >+ */ >+public class EObjectObservableValueDecorator extends DecoratingObservableValue implements IEObjectObservable { >+ >+ private EStructuralFeature feature; >+ >+ /** >+ * @param decorated >+ * @param feature >+ */ >+ public EObjectObservableValueDecorator(IObservableValue decorated, EStructuralFeature feature) { >+ super(decorated, true); >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.observable.value.DecoratingObservableValue >+ * #dispose() >+ */ >+ @Override >+ public synchronized void dispose() { >+ this.feature = null; >+ super.dispose(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.batoo.utils.ui.databinding.IEObjectObservable#getFeature() >+ */ >+ public EStructuralFeature getFeature() { >+ return this.feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.core.databinding.observable.IObserving#getObserved() >+ */ >+ public Object getObserved() { >+ final IObservable decorated = this.getDecorated(); >+ if ( decorated instanceof IObserving ) { >+ return ( ( IObserving ) decorated ).getObserved(); >+ } >+ return null; >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectPropertyListener.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectPropertyListener.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectPropertyListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectPropertyListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,82 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.observable.Diffs; >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.value.ValueDiff; >+import org.eclipse.core.databinding.property.IProperty; >+import org.eclipse.core.databinding.property.ISimplePropertyListener; >+import org.eclipse.core.databinding.property.NativePropertyListener; >+import org.eclipse.emf.common.notify.Adapter; >+import org.eclipse.emf.common.notify.Notification; >+import org.eclipse.emf.common.notify.impl.AdapterImpl; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+public class EObjectPropertyListener extends NativePropertyListener { >+ >+ private final EStructuralFeature feature; >+ >+ private final Realm realm; >+ >+ private AdapterImpl listener; >+ >+ EObjectPropertyListener(IProperty property, EStructuralFeature feature, ISimplePropertyListener listener) { >+ this(Realm.getDefault(), property, feature, listener); >+ } >+ >+ EObjectPropertyListener(Realm realm, IProperty property, EStructuralFeature feature, ISimplePropertyListener listener) { >+ super(property, listener); >+ this.realm = realm; >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.NativePropertyListener#doAddTo( >+ * java.lang.Object) >+ */ >+ @Override >+ protected void doAddTo(Object source) { >+ ( ( EObject ) source ).eAdapters().add(this.getListener()); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.NativePropertyListener#doRemoveFrom >+ * (java.lang.Object) >+ */ >+ @Override >+ protected void doRemoveFrom(Object source) { >+ if ( this.listener != null ) { >+ ( ( EObject ) source ).eAdapters().remove(this.listener); >+ } >+ } >+ >+ private Adapter getListener() { >+ if ( this.listener != null ) { >+ return this.listener; >+ } >+ >+ return this.listener = new AdapterImpl() { >+ >+ @Override >+ public void notifyChanged(final Notification notification) { >+ if ( ( EObjectPropertyListener.this.feature == notification.getFeature() ) && !notification.isTouch() ) { >+ final ValueDiff diff = Diffs.createValueDiff(notification.getOldValue(), notification.getNewValue()); >+ EObjectPropertyListener.this.realm.exec(new Runnable() { >+ >+ public void run() { >+ EObjectPropertyListener.this.fireChange(notification.getNotifier(), diff); >+ } >+ }); >+ } >+ } >+ }; >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectValuePropertyDecorator.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectValuePropertyDecorator.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectValuePropertyDecorator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectValuePropertyDecorator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,222 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.list.IObservableList; >+import org.eclipse.core.databinding.observable.map.IObservableMap; >+import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; >+import org.eclipse.core.databinding.observable.set.IObservableSet; >+import org.eclipse.core.databinding.observable.value.IObservableValue; >+import org.eclipse.core.databinding.property.value.IValueProperty; >+import org.eclipse.core.databinding.property.value.ValueProperty; >+import org.eclipse.emf.databinding.EMFProperties; >+import org.eclipse.emf.databinding.IEObjectListProperty; >+import org.eclipse.emf.databinding.IEObjectMapProperty; >+import org.eclipse.emf.databinding.IEObjectValueProperty; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * @since 3.5 >+ * >+ */ >+public class EObjectValuePropertyDecorator extends ValueProperty implements IEObjectValueProperty { >+ >+ private final IValueProperty delegate; >+ >+ private final EStructuralFeature feature; >+ >+ /** >+ * @param delegate >+ * @param feature >+ */ >+ public EObjectValuePropertyDecorator(IValueProperty delegate, EStructuralFeature feature) { >+ this.delegate = delegate; >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.batoo.utils.ui.databinding.IEObjectProperty#getFeature() >+ */ >+ public EStructuralFeature getFeature() { >+ return this.feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.IValueProperty#getValueType() >+ */ >+ public Object getValueType() { >+ return this.delegate.getValueType(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectValueProperty#list(org.eclipse >+ * .emf.ecore.EStructuralFeature) >+ */ >+ public IEObjectListProperty list(EStructuralFeature feature) { >+ return this.list(EMFProperties.list(feature)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectValueProperty#list(org.batoo.utils >+ * .ui.databinding.IEObjectListProperty) >+ */ >+ public IEObjectListProperty list(IEObjectListProperty property) { >+ return new EObjectListPropertyDecorator(super.list(property), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectValueProperty#map(org.eclipse. >+ * emf.ecore.EStructuralFeature) >+ */ >+ public IEObjectMapProperty map(EStructuralFeature feature) { >+ return this.map(EMFProperties.map(feature)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectValueProperty#map(org.batoo.utils >+ * .ui.databinding.IEObjectMapProperty) >+ */ >+ public IEObjectMapProperty map(IEObjectMapProperty property) { >+ return new EObjectMapPropertyDecorator(super.map(property), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.ValueProperty#observe(java >+ * .lang.Object) >+ */ >+ @Override >+ public IObservableValue observe(Object source) { >+ return new EObjectObservableValueDecorator(this.delegate.observe(source), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.IValueProperty#observe(org >+ * .eclipse.core.databinding.observable.Realm, java.lang.Object) >+ */ >+ public IObservableValue observe(Realm realm, Object source) { >+ return new EObjectObservableValueDecorator(this.delegate.observe(realm, source), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.IValueProperty#observeDetail >+ * (org.eclipse.core.databinding.observable.list.IObservableList) >+ */ >+ public IObservableList observeDetail(IObservableList master) { >+ return new EObjectObservableListDecorator(this.delegate.observeDetail(master), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.IValueProperty#observeDetail >+ * (org.eclipse.core.databinding.observable.map.IObservableMap) >+ */ >+ public IObservableMap observeDetail(IObservableMap master) { >+ return new EObjectObservableMapDecorator(this.delegate.observeDetail(master), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.IValueProperty#observeDetail >+ * (org.eclipse.core.databinding.observable.set.IObservableSet) >+ */ >+ public IObservableMap observeDetail(IObservableSet master) { >+ return new EObjectObservableMapDecorator(this.delegate.observeDetail(master), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.ValueProperty#observeDetail >+ * (org.eclipse.core.databinding.observable.value.IObservableValue) >+ */ >+ @Override >+ public IObservableValue observeDetail(IObservableValue master) { >+ return new EObjectObservableValueDecorator(this.delegate.observeDetail(master), this.feature); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see java.lang.Object#toString() >+ */ >+ @Override >+ public String toString() { >+ return this.delegate.toString(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectValueProperty#value(org.eclipse >+ * .emf.ecore.EStructuralFeature[]) >+ */ >+ public IEObjectValueProperty value(EStructuralFeature... features) { >+ return this.value(EMFProperties.value(features)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.batoo.utils.ui.databinding.IEObjectValueProperty#value(org.batoo. >+ * utils.ui.databinding.IEObjectValueProperty) >+ */ >+ public IEObjectValueProperty value(IEObjectValueProperty property) { >+ return new EObjectValuePropertyDecorator(super.value(property), property.getFeature()); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.ValueProperty#valueFactory() >+ */ >+ @Override >+ public IObservableFactory valueFactory() { >+ return this.delegate.valueFactory(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.value.ValueProperty#valueFactory >+ * (org.eclipse.core.databinding.observable.Realm) >+ */ >+ @Override >+ public IObservableFactory valueFactory(Realm realm) { >+ return this.delegate.valueFactory(realm); >+ } >+} >Index: src/org/eclipse/emf/databinding/IEObjectObservable.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/IEObjectObservable.java >diff -N src/org/eclipse/emf/databinding/IEObjectObservable.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/IEObjectObservable.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+/** >+ * >+ */ >+package org.eclipse.emf.databinding; >+ >+ >+import org.eclipse.core.databinding.observable.IObserving; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * @author hceylan >+ * >+ */ >+public interface IEObjectObservable extends IObserving { >+ >+ EStructuralFeature getFeature(); >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectListPropertyListener.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectListPropertyListener.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectListPropertyListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectListPropertyListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,150 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import java.util.Collection; >+ >+import org.eclipse.core.databinding.observable.Diffs; >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.list.ListDiff; >+import org.eclipse.core.databinding.observable.list.ListDiffEntry; >+import org.eclipse.core.databinding.property.IProperty; >+import org.eclipse.core.databinding.property.ISimplePropertyListener; >+import org.eclipse.core.databinding.property.NativePropertyListener; >+import org.eclipse.emf.common.notify.Adapter; >+import org.eclipse.emf.common.notify.Notification; >+import org.eclipse.emf.common.notify.impl.AdapterImpl; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+public class EObjectListPropertyListener extends NativePropertyListener { >+ >+ private final EStructuralFeature feature; >+ >+ private final Realm realm; >+ >+ private AdapterImpl listener; >+ >+ EObjectListPropertyListener(IProperty property, EStructuralFeature feature, ISimplePropertyListener listener) { >+ this(Realm.getDefault(), property, feature, listener); >+ } >+ >+ EObjectListPropertyListener(Realm realm, IProperty property, EStructuralFeature feature, ISimplePropertyListener listener) { >+ super(property, listener); >+ this.realm = realm; >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.NativePropertyListener#doAddTo( >+ * java.lang.Object) >+ */ >+ @Override >+ protected void doAddTo(Object source) { >+ ( ( EObject ) source ).eAdapters().add(this.getListener()); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.NativePropertyListener#doRemoveFrom >+ * (java.lang.Object) >+ */ >+ @Override >+ protected void doRemoveFrom(Object source) { >+ if ( this.listener != null ) { >+ ( ( EObject ) source ).eAdapters().remove(this.listener); >+ } >+ } >+ >+ private Adapter getListener() { >+ if ( this.listener != null ) { >+ return this.listener; >+ } >+ >+ return this.listener = new AdapterImpl() { >+ >+ @Override >+ public void notifyChanged(final Notification notification) { >+ if ( ( EObjectListPropertyListener.this.feature == notification.getFeature() ) && !notification.isTouch() ) { >+ final ListDiff diff; >+ switch (notification.getEventType()) { >+ case Notification.ADD: { >+ diff = >+ Diffs.createListDiff(Diffs.createListDiffEntry(notification.getPosition(), true, notification >+ .getNewValue())); >+ break; >+ } >+ case Notification.ADD_MANY: { >+ final Collection< ? > newValues = ( Collection< ? > ) notification.getNewValue(); >+ final ListDiffEntry[] listDiffEntries = new ListDiffEntry[newValues.size()]; >+ int position = notification.getPosition(); >+ int index = 0; >+ for ( final Object newValue : newValues ) { >+ listDiffEntries[index++] = Diffs.createListDiffEntry(position++, true, newValue); >+ } >+ diff = Diffs.createListDiff(listDiffEntries); >+ break; >+ } >+ case Notification.REMOVE: { >+ diff = >+ Diffs.createListDiff(Diffs.createListDiffEntry(notification.getPosition(), false, notification >+ .getOldValue())); >+ break; >+ } >+ case Notification.REMOVE_MANY: { >+ final Collection< ? > oldValues = ( Collection< ? > ) notification.getOldValue(); >+ final ListDiffEntry[] listDiffEntries = new ListDiffEntry[oldValues.size()]; >+ int position = notification.getPosition(); >+ int index = 0; >+ for ( final Object oldValue : oldValues ) { >+ listDiffEntries[index++] = Diffs.createListDiffEntry(position++, false, oldValue); >+ } >+ diff = Diffs.createListDiff(listDiffEntries); >+ break; >+ } >+ case Notification.SET: >+ case Notification.RESOLVE: { >+ final ListDiffEntry[] listDiffEntries = new ListDiffEntry[2]; >+ listDiffEntries[0] = >+ Diffs.createListDiffEntry(notification.getPosition(), false, notification.getOldValue()); >+ listDiffEntries[1] = >+ Diffs.createListDiffEntry(notification.getPosition(), true, notification.getNewValue()); >+ diff = Diffs.createListDiff(listDiffEntries); >+ break; >+ } >+ case Notification.MOVE: { >+ final Object movedValue = notification.getNewValue(); >+ final ListDiffEntry[] listDiffEntries = new ListDiffEntry[2]; >+ listDiffEntries[0] = Diffs.createListDiffEntry(( Integer ) notification.getOldValue(), false, movedValue); >+ listDiffEntries[1] = Diffs.createListDiffEntry(notification.getPosition(), true, movedValue); >+ diff = Diffs.createListDiff(listDiffEntries); >+ break; >+ } >+ case Notification.UNSET: { >+ // This just represents going back to the unset >+ // state, but that doesn't affect the contents of >+ // the list. >+ // >+ return; >+ } >+ default: { >+ throw new RuntimeException("unhandled case"); >+ } >+ } >+ EObjectListPropertyListener.this.realm.exec(new Runnable() { >+ >+ public void run() { >+ EObjectListPropertyListener.this.fireChange(notification.getNotifier(), diff); >+ } >+ }); >+ } >+ } >+ }; >+ >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/IEObjectListProperty.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/IEObjectListProperty.java >diff -N src/org/eclipse/emf/databinding/IEObjectListProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/IEObjectListProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+package org.eclipse.emf.databinding; >+ >+ >+import org.eclipse.core.databinding.property.list.IListProperty; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * An {@link IListProperty} extension interface with convenience methods for >+ * creating nested EObject properties. >+ * >+ * @since 1.2 >+ */ >+public interface IEObjectListProperty extends IEObjectProperty, IListProperty { >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * value property. >+ * >+ * @param feature >+ * @return a nested combination of this property and the specified value >+ * property. >+ * @see #values(IEObjectValueProperty) >+ */ >+ public IEObjectListProperty values(EStructuralFeature... feature); >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * value property. The returned property will observe the specified value >+ * property for all elements observed by this list property. >+ * >+ * @param property >+ * the detail property to observe >+ * @return a master-detail combination of this property and the specified >+ * value property. >+ */ >+ public IEObjectListProperty values(IEObjectValueProperty property); >+ >+} >Index: src/org/eclipse/emf/databinding/internal/EObjectMapPropertyListener.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/internal/EObjectMapPropertyListener.java >diff -N src/org/eclipse/emf/databinding/internal/EObjectMapPropertyListener.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/internal/EObjectMapPropertyListener.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,88 @@ >+package org.eclipse.emf.databinding.internal; >+ >+ >+import org.eclipse.core.databinding.observable.Diffs; >+import org.eclipse.core.databinding.observable.Realm; >+import org.eclipse.core.databinding.observable.map.MapDiff; >+import org.eclipse.core.databinding.property.IProperty; >+import org.eclipse.core.databinding.property.ISimplePropertyListener; >+import org.eclipse.core.databinding.property.NativePropertyListener; >+import org.eclipse.emf.common.notify.Adapter; >+import org.eclipse.emf.common.notify.Notification; >+import org.eclipse.emf.common.notify.impl.AdapterImpl; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+public class EObjectMapPropertyListener extends NativePropertyListener { >+ >+ private final EStructuralFeature feature; >+ >+ private final Realm realm; >+ >+ private AdapterImpl listener; >+ >+ EObjectMapPropertyListener(IProperty property, EStructuralFeature feature, ISimplePropertyListener listener) { >+ this(Realm.getDefault(), property, feature, listener); >+ } >+ >+ EObjectMapPropertyListener(Realm realm, IProperty property, EStructuralFeature feature, ISimplePropertyListener listener) { >+ super(property, listener); >+ this.realm = realm; >+ this.feature = feature; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.NativePropertyListener#doAddTo( >+ * java.lang.Object) >+ */ >+ @Override >+ protected void doAddTo(Object source) { >+ ( ( EObject ) source ).eAdapters().add(this.getListener()); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.core.databinding.property.NativePropertyListener#doRemoveFrom >+ * (java.lang.Object) >+ */ >+ @Override >+ protected void doRemoveFrom(Object source) { >+ if ( this.listener != null ) { >+ ( ( EObject ) source ).eAdapters().remove(this.listener); >+ } >+ } >+ >+ private Adapter getListener() { >+ if ( this.listener != null ) { >+ return this.listener; >+ } >+ >+ return this.listener = new AdapterImpl() { >+ >+ @Override >+ public void notifyChanged(final Notification notification) { >+ if ( ( EObjectMapPropertyListener.this.feature == notification.getFeature() ) && !notification.isTouch() ) { >+ // TODO >+ // This assumes we only get a SET notification, which isn't >+ // a good assumption. >+ // >+ final MapDiff diff = >+ Diffs.createMapDiffSingleChange(notification.getNotifier(), notification.getOldValue(), notification >+ .getNewValue()); >+ EObjectMapPropertyListener.this.realm.exec(new Runnable() { >+ >+ public void run() { >+ EObjectMapPropertyListener.this.fireChange(notification.getNotifier(), diff); >+ } >+ }); >+ } >+ } >+ }; >+ } >+ >+} >Index: src/org/eclipse/emf/databinding/IEObjectValueProperty.java >=================================================================== >RCS file: src/org/eclipse/emf/databinding/IEObjectValueProperty.java >diff -N src/org/eclipse/emf/databinding/IEObjectValueProperty.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/emf/databinding/IEObjectValueProperty.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,98 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Matthew Hall and others. 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: Matthew Hall - initial API and implementation (bug 195222) >+ ******************************************************************************/ >+ >+package org.eclipse.emf.databinding; >+ >+ >+import org.eclipse.core.databinding.property.value.IValueProperty; >+import org.eclipse.emf.ecore.EStructuralFeature; >+ >+/** >+ * An {@link IValueProperty} extension interface with convenience methods for >+ * creating nested bean properties. >+ * >+ * @since 1.2 >+ * @noextend This interface is not intended to be extended by clients. >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+public interface IEObjectValueProperty extends IEObjectProperty, IValueProperty { >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * list property. >+ * >+ * @param feature >+ * the list property to observe >+ * @return a master-detail combination of this property and the specified >+ * list property. >+ * @see #list(IEObjectListProperty) >+ */ >+ public IEObjectListProperty list(EStructuralFeature feature); >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * list property. The returned property will observe the specified list >+ * property for the value of the master property. >+ * >+ * @param property >+ * the detail property to observe >+ * @return a master-detail combination of this property and the specified >+ * list property. >+ */ >+ public IEObjectListProperty list(IEObjectListProperty property); >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * map property. >+ * >+ * @param feature >+ * the map property to observe >+ * @return a master-detail combination of this property and the specified >+ * map property. >+ * @see #map(IEObjectMapProperty) >+ */ >+ public IEObjectMapProperty map(EStructuralFeature feature); >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * map property. The returned property will observe the specified map >+ * property for the value of the master property. >+ * >+ * @param property >+ * the detail property to observe >+ * @return a master-detail combination of this property and the specified >+ * map property. >+ */ >+ public IEObjectMapProperty map(IEObjectMapProperty property); >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * value property. >+ * >+ * @param features >+ * the value property to observe. May be nested e.g. "parent.name" >+ * @return a master-detail combination of this property and the specified >+ * value property. >+ * @see #value(IEObjectValueProperty) >+ */ >+ public IEObjectValueProperty value(EStructuralFeature... features); >+ >+ /** >+ * Returns a master-detail combination of this property and the specified >+ * value property. The returned property will observe the specified detail >+ * value property for the value of the master value property. >+ * >+ * @param property >+ * the detail property to observe >+ * @return a master-detail combination of this property and the specified >+ * value property. >+ */ >+ public IEObjectValueProperty value(IEObjectValueProperty property); >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 262160
:
123633
|
124701
|
125052
|
125836
|
125841
|
132310
|
132579
|
132670
| 134185 |
134272
|
134465
|
134529
|
134710
|
136365
|
136370