Home » Modeling » EMF » [CDO] Elements choice remains empty in properties view(Unable to edit the reference attribute of an element)
[CDO] Elements choice remains empty in properties view [message #1698036] |
Wed, 10 June 2015 09:56  |
Eclipse User |
|
|
|
Hi all,
Using the CDO explorer, I can modify a reference attribute of an element A in the properties view. Typically specify 'A references B'. A popup lets me choose the element B existing in the repository and 'attach' it to element A.
I implemented a RCP application with a model editor. When I now select the same element A in my editor, the properties view displays its attributes. But, when I try to edit its reference, the popup displays an empty list of choices.
Any idea why the behavior is different considering that both the CDO explorer and the RCP application use the same generated EMF and EMF.Edit classes ?
Is there may be something I need to specify in my RCP application configuration ?
Kind regards,
Laurent
|
|
| |
Re: [CDO] Elements choice remains empty in properties view [message #1698359 is a reply to message #1698092] |
Mon, 15 June 2015 01:45   |
Eclipse User |
|
|
|
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
|
|
|
Re: [CDO] Elements choice remains empty in properties view [message #1698371 is a reply to message #1698359] |
Mon, 15 June 2015 03:34  |
Eclipse User |
|
|
|
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: Wed Jul 23 12:27:20 EDT 2025
Powered by FUDForum. Page generated in 0.06710 seconds
|