Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 13:56 Go to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 44
Registered: June 2015
Member
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 #1698092 is a reply to message #1698036] Thu, 11 June 2015 07:22 Go to previous messageGo to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 44
Registered: June 2015
Member
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 ?

Regards,

Laurent
Re: [CDO] Elements choice remains empty in properties view [message #1698359 is a reply to message #1698092] Mon, 15 June 2015 05:45 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
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 07:34 Go to previous message
Laurent Le Moux is currently offline Laurent Le MouxFriend
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
Previous Topic:Add new child command to an existing metamodel without modifying it
Next Topic:Generate Java annotations from EAnnotation's
Goto Forum:
  


Current Time: Thu Mar 28 23:23:08 GMT 2024

Powered by FUDForum. Page generated in 0.02467 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top