Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » viewer selection on wrapped Items
viewer selection on wrapped Items [message #420816] Thu, 10 July 2008 22:29 Go to next message
eclipse is currently offline eclipseFriend
Messages: 19
Registered: July 2009
Junior Member
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 ?
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.

How do I set the selection from an actual element?

Thanks.

SeB.
Re: viewer selection on wrapped Items [message #420818 is a reply to message #420816] Fri, 11 July 2008 07:40 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Does the Wrapping/Unwrapping always create a new wrapper instance?

Viewers are searching the elements list using o1 == o2 and o1.equals(o2)
so if the above question is answered with yes you need to set an
IElementComparer on your viewer which helps the code to find the
appropiate element.

Tom

SeB.fr schrieb:
> 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 ?
> 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.
>
> How do I set the selection from an actual element?
>
> Thanks.
>
> SeB.
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: viewer selection on wrapped Items [message #420824 is a reply to message #420816] Fri, 11 July 2008 11:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
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.
> 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.
>
> 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...
>
> Thanks.
>
> SeB.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: viewer selection on wrapped Items[RESOLVED] [message #420840 is a reply to message #420824] Sat, 12 July 2008 08:37 Go to previous messageGo to next message
eclipse is currently offline eclipseFriend
Messages: 19
Registered: July 2009
Junior Member
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 ???


>> 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().
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)
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.
>>
Re: viewer selection on wrapped Items[RESOLVED] [message #420841 is a reply to message #420840] Sat, 12 July 2008 12:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
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 #420842 is a reply to message #420841] Sat, 12 July 2008 15:08 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: viewer selection on wrapped Items[RESOLVED] [message #420843 is a reply to message #420842] Sat, 12 July 2008 15:43 Go to previous message
Ed Merks is currently offline Ed MerksFriend
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/
Previous Topic:[CDO] objects between transactions
Next Topic:Package with uri 'null' not found. Exception
Goto Forum:
  


Current Time: Sat Apr 27 00:19:02 GMT 2024

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

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

Back to the top