Home » Modeling » EMF » [CDO] Elements choice remains empty in properties view(Unable to edit the reference attribute of an element)
| |
Re: [CDO] Elements choice remains empty in properties view [message #1698359 is a reply to message #1698092] |
Mon, 15 June 2015 05:45 |
|
Am 11.06.2015 um 09:22 schrieb Laurent Le Moux:
> Hi again,
>
> The execution stack shows that ItemPropertyDescriptor.getReachableObjectsOfType looks for 'element A' CDOResource and
> resource set.
> From there, a loop processes the resource set content.
> In the CDO explorer, the resource set seems to contain almost all CDO repository resources I created.
> In my RCP application, the only resource in the resource set is the element one...
>
> It explains why avalaible elements in the repository belonging to other resources are not found and why I get an empty
> choice list back.
>
> Can anyone tell me why the resource.getResourceSet returns a different result and what to do to get the same behavior
> as for the CDO explorer ?
Without being able to reproduce your problem it's hard. You cold set breakpoints in methods like these:
org.eclipse.emf.edit.provider.ItemPropertyDescriptor.getComboBoxObjects(Object)
org.eclipse.emf.edit.provider.ItemPropertyDescriptor.getReachableObjectsOfType(EObject, EGenericType)
If they're too often you can also override the getChoiceOfValues() method of the respective ItemPropertyDescriptor of
your generated ItemProvider,. for example:
protected void addSalesOrdersPropertyDescriptor(Object object)
{
itemPropertyDescriptors
.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_Customer_salesOrders_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Customer_salesOrders_feature", "_UI_Customer_type"),
CompanyPackage.Literals.CUSTOMER__SALES_ORDERS, true, false, true, null, null, null)
{
@Override
public Collection<?> getChoiceOfValues(Object object)
{
return super.getChoiceOfValues(object); // <---- breakpoint here
}
});
}
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Elements choice remains empty in properties view [message #1698371 is a reply to message #1698359] |
Mon, 15 June 2015 07:34 |
Laurent Le Moux Messages: 44 Registered: June 2015 |
Member |
|
|
Hi Eike,
Thanks for your answer. I was about to send a new post because I finally went for another option. I do not want my RCP application to look in all the repository resources for objects to be displayed in the properties view.
So I did override getComboBoxObjects to run an OCL query that provides me with the expected elements.
/**
* This adds a property descriptor for the Implique feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected void addImpliquePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(new OCLItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Fonction_implique_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Fonction_implique_feature", "_UI_Fonction_type"),
MetamodelePackage.Literals.FONCTION__IMPLIQUE,
true,
false,
true,
null,
null,
null) {
@Override
protected Collection<?> getComboBoxObjects(Object object) {
return transaction.createQuery("ocl", "metamodele::Acteur.allInstances()").getResult(Acteur.class);
}
});
}
Regards,
Laurent
|
|
|
Goto Forum:
Current Time: Mon Sep 23 03:39:34 GMT 2024
Powered by FUDForum. Page generated in 0.84582 seconds
|