|
Re: Easy way of Filtering in EMF List Dialogs [message #1758887 is a reply to message #1758879] |
Tue, 04 April 2017 07:46 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Here's an example from org.eclipse.emf.ecore.provider.EReferenceItemProvider.addEKeysPropertyDescriptor(Object) /**
* This adds a property descriptor for the Keys feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected void addEKeysPropertyDescriptor(Object object)
{
itemPropertyDescriptors.add
(new ItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_EReference_eKeys_feature"),
getString("_UI_EReference_eKeys_description"),
EcorePackage.Literals.EREFERENCE__EKEYS,
true,
false,
false,
null,
null,
null)
{
@Override
public Collection<?> getChoiceOfValues(Object object)
{
EReference eReference = (EReference)object;
List<Object> result = new ArrayList<Object>();
if (eReference.getEType() instanceof EClass)
{
result.addAll(eReference.getEReferenceType().getEAllAttributes());
}
return result;
}
});
} So the idea is just to specialize the item property descriptor's getChoiceOfValues method to return only the choices you want. You might call supergetChoiceOfValues and filter it down to what you want, or, as in this case, gather the choices in some other way.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03206 seconds