custom createItemPropertyDescriptor [message #1815615] |
Mon, 07 October 2019 05:09  |
Eclipse User |
|
|
|
Hello, I managed to restrict the list of eObjects in the provider of the property descriptor. I followed this tutorial : http://gmfsamples.tuxfamily.org/wiki/doku.php?id=emf_tutorial3
I have to restrict the list for most references of my eObjects based on one of their eContainer. I'm not sure that modifying all the generated mehods is the most efficient way since I have lots of them and if I change something on the metamodel there is a chance that it will break everything because of the Generated Not.
Is there a way to override getChoiceOfValues for all my properties decriptor at once. I would need to pass the object and the reference that is modified to get the right content.
|
|
|
Re: custom createItemPropertyDescriptor [message #1815638 is a reply to message #1815615] |
Mon, 07 October 2019 11:41   |
Eclipse User |
|
|
|
One approach would be to use the GenModel property Edit -> Provide Root Extends Class to specify the fully qualified name of some hand-written extension of ItemProviderAdapter. Then all you generated item providers will extends this class and you could override org.eclipse.emf.edit.provider.ItemProviderAdapter.createItemPropertyDescriptor(AdapterFactory, ResourceLocator, String, String, EStructuralFeature, boolean, boolean, boolean, Object, String, String[], Object) in this one class. You might add your own EAnnotations to your EStructuralFeatures which you could use to implement different behaviors in your specialized "central" property descriptor.
|
|
|
|
Re: custom createItemPropertyDescriptor [message #1815741 is a reply to message #1815724] |
Wed, 09 October 2019 11:07  |
Eclipse User |
|
|
|
The EAnnotation idea was just if you want to somehow selectively control various behaviors on a per-feature basis. The underlying implementation of org.eclipse.emf.edit.provider.ItemPropertyDescriptor.getComboBoxObjects(Object) also does rather brute force visiting of all objects in the resource set to find ones of the correct type. You might just call super and filter to those in in your special "containers". But whatever works, if it performs reasonably, is just fine of course.
|
|
|
Powered by
FUDForum. Page generated in 0.04654 seconds