|
|
|
|
Re: viewer selection on wrapped Items[RESOLVED] [message #420841 is a reply to message #420840] |
Sat, 12 July 2008 12:03 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
SeB,
Comments below.
SeB.fr wrote:
> Hello Ed and Tom,
>
> See my comments below and thank you so much.
>
> Ed Merks wrote:
>
>> SeB,
>
>> Comments below.
>
>> SeB.fr wrote:
>>> Hello all and Ed.
>>>
>>> I have 2 JFace Table Viewers showing 2 lists of 2 different models.
>>> One table is holding the actual elements model while the other one
>>> is holding FeatureMapEntryWrapperItemProvider.
>>> I do not understand why is that ?
>> You've not described where the input to the viewers come from so that
>> makes guessing a little hard.
>
> 1st model showing unwrapped element comes from a pure ECore model
> whereas the second showing wrapped elements come from xml schema.
> I still do not get why one is wrapped and not the other ???
Wrappers are needed whenever the "tree" might end up showing the same
object multiple times. Once a feature map is part of the tree, we
simply assume that this might be the case; not only that, but the
feature map entries themselves definitely require wrappers since they
aren't EObjects that we can adapt directly using item providers.
>
>
>>> The problem is that I would like to set the selection on my second
>>> table from one actual model.
>>> I have tried to use UnwrappingSelectionProvider bu it seems to be
>>> working one way, that is as a provider unwrapping element but not
>>> the other way round, wrapping them back.
>> AdapterFactoryEditingDomain has a getWrapper method.
>
> I am using a TransactionalEditngDomain in which there is no getWrapper().
Yes, it's not a method in the API, it's only a method in the
implementation class.
> I have copied the method is my hown class and override the equals()
> method of the FeatureMapEntryWrapperItemProvider to return true when
> the getValue() are equals (this might be woth implementing in the
> framework?). I would suggest moving the getWrapper(Object) method to
> EcoreUtil with an additionnal parameter : getWrapper(Object,
> EditingDomain)
Perhaps it should be in the EditingDomain API itself. All
implementations derive from AdapterFactoryEditingDomain anyway, though I
don't think we documented that as a rule...
I suppose looking at the method though, it could be easily written as a
static method much like the unwrap method. Feel free to open a bugzilla
feature request to provide a static method like unwrap one; it doesn't
belong in EcoreUtil since that plugin has no knowledge about .Edit stuff.
> This would be perfect.
>
>
>>>
>>> How do I set the selection from an actual element?
>> You might want to modify your second table's content provider to
>> unwrap the values returned by getElements...
>
> I have also tried to overried the getElements of the table content
> provider and it works equally well.
>
>
>>>
>>> Thanks.
>>>
>>> SeB.
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: viewer selection on wrapped Items[RESOLVED] [message #420843 is a reply to message #420842] |
Sat, 12 July 2008 15:43 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Tom,
Typically they'd likely not be under a common parent, but there's no
guarantee. In any case, feature map entries always need wrappers
because we can't adapt them and we don't generally know the owning list
given just the entry...
Tom Schindl wrote:
> Ed Merks schrieb:
>> SeB,
>>
>> Comments below.
>>
>>
>> SeB.fr wrote:
>>> Hello Ed and Tom,
>>>
>>> See my comments below and thank you so much.
>>>
>>> Ed Merks wrote:
>>>
>>>> SeB,
>>>
>>>> Comments below.
>>>
>>>> SeB.fr wrote:
>>>>> Hello all and Ed.
>>>>>
>>>>> I have 2 JFace Table Viewers showing 2 lists of 2 different models.
>>>>> One table is holding the actual elements model while the other one
>>>>> is holding FeatureMapEntryWrapperItemProvider.
>>>>> I do not understand why is that ?
>>>> You've not described where the input to the viewers come from so
>>>> that makes guessing a little hard.
>>>
>>> 1st model showing unwrapped element comes from a pure ECore model
>>> whereas the second showing wrapped elements come from xml schema.
>>> I still do not get why one is wrapped and not the other ???
>> Wrappers are needed whenever the "tree" might end up showing the same
>> object multiple times. Once a feature map is part of the tree, we
>> simply assume that this might be the case; not only that, but the
>> feature map entries themselves definitely require wrappers since they
>> aren't EObjects that we can adapt directly using item providers.
>
> Can they end up in the same path else this is not needed anymore
> because TreeViewer's can deal with same object under different
> tree-paths case.
>
> Tom
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02689 seconds