databinding missing IEMFSetProperty [message #499151] |
Fri, 20 November 2009 07:28 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
Hi.
Is there anything like an IEMFSetProperty? I was looking for it but
couldn't find anything.
I need this in order to bind a reference list to a checkbox table
viewer. This should be similar as in the
org.eclipse.jface.examples.databinding.snippets.Snippet018Ch eckboxTableViewerCheckedSelection
example.
Somewhere I have read this should be coming in 2.6. Any code snippets
yet that I could use?
Is there any other way how I could solve that, e.g. create a SetProperty
that wraps an IEMFListProperty?
Thanx in advance.
-- Thomas
|
|
|
|
Re: databinding missing IEMFSetProperty [message #499164 is a reply to message #499155] |
Fri, 20 November 2009 08:39 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
Tom Schindl schrieb:
> Hi,
>
> 1. Status quo:
> --------------
> We are not having IEMFSetProperty yet because EMF itself has no
> Set-Implementations (though in EMF Lists by default act in a set-like
> fashion only allowing one instance at a time).
>
> 2. Future:
> ----------
> I guess I wrote in my blog that we'll probably add IEMFSetProperty but I
> had no time yet to work on it.
>
> The question is which EMF-Feature do you want to bind to the
> TableViewer-Selection (must likely an EMF-MultiValue-Feature == EList)?
>
> I guess an implementation based upon the IEMFListProperty implementation
> should be quite straight forward but as outlined above I've had no time
> to explore/implement this.
>
> So please file a feature request and if you manage to implement it a
> patch is welcome, naturally :-)
>
New Feature Request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=295683
Bug 295683 - Need an IEMFSetProperty
> 3. Until then:
> --------------
> A dirty work around would be to bind create an WritableSet and
> synchronize your EMF-List and the WritableSet. Dirty but would probably
> work. Still if I where you I'd try to implement the IEMFSetProperty
> based upon the information above.
>
> Tom
>
> Thomas Kowatsch schrieb:
>> Hi.
>> Is there anything like an IEMFSetProperty? I was looking for it but
>> couldn't find anything.
>> I need this in order to bind a reference list to a checkbox table
>> viewer. This should be similar as in the
>> org.eclipse.jface.examples.databinding.snippets.Snippet018Ch eckboxTableViewerCheckedSelection
>> example.
>> Somewhere I have read this should be coming in 2.6. Any code snippets
>> yet that I could use?
>> Is there any other way how I could solve that, e.g. create a SetProperty
>> that wraps an IEMFListProperty?
>> Thanx in advance.
>> -- Thomas
|
|
|
Re: databinding missing IEMFSetProperty [message #499180 is a reply to message #499155] |
Fri, 20 November 2009 10:17 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
Hi Tom.
Tom Schindl schrieb:
> Hi,
>
> 1. Status quo:
> --------------
> We are not having IEMFSetProperty yet because EMF itself has no
> Set-Implementations (though in EMF Lists by default act in a set-like
> fashion only allowing one instance at a time).
>
> 2. Future:
> ----------
> I guess I wrote in my blog that we'll probably add IEMFSetProperty but I
> had no time yet to work on it.
>
> The question is which EMF-Feature do you want to bind to the
> TableViewer-Selection (must likely an EMF-MultiValue-Feature == EList)?
>
> I guess an implementation based upon the IEMFListProperty implementation
> should be quite straight forward but as outlined above I've had no time
> to explore/implement this.
Hmm I had a look into it and it does not seam to be so stright forward
as you mentioned (at least for me).
Most of the time this is just beacause of the lack of corresponding Set
classes. E.g. a SetProperty#values(IValueProperty) returns an
IMapProperty and not an ISetProperty! This makes it not being so
straight forward for me, as I am not so deep into databinding...
I would at least more information or some more hints to follow that.
>
> So please file a feature request and if you manage to implement it a
> patch is welcome, naturally :-)
>
> 3. Until then:
> --------------
> A dirty work around would be to bind create an WritableSet and
> synchronize your EMF-List and the WritableSet. Dirty but would probably
> work. Still if I where you I'd try to implement the IEMFSetProperty
> based upon the information above.
Could you explain that way a bit deeper, as I can't see anx WritableSet
implementation that I could use to synchronize...
>
> Tom
>
> Thomas Kowatsch schrieb:
>> Hi.
>> Is there anything like an IEMFSetProperty? I was looking for it but
>> couldn't find anything.
>> I need this in order to bind a reference list to a checkbox table
>> viewer. This should be similar as in the
>> org.eclipse.jface.examples.databinding.snippets.Snippet018Ch eckboxTableViewerCheckedSelection
>> example.
>> Somewhere I have read this should be coming in 2.6. Any code snippets
>> yet that I could use?
>> Is there any other way how I could solve that, e.g. create a SetProperty
>> that wraps an IEMFListProperty?
>> Thanx in advance.
>> -- Thomas
|
|
|
Re: databinding missing IEMFSetProperty [message #499206 is a reply to message #499180] |
Fri, 20 November 2009 12:34 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
Hi Tom.
I think I understand the dirty hack now.
I attached below a code snippet for you to check if this is generally
correct.
I know it is a very dirty implementation at the moment and can be
enhanced. But I only wanted to be sure that this is the correct
direction I go.
Thanx in advance.
-- Thomas
final IObservableList targetList=
IEMFEditListProperty.observeDeatil(master);
final WritableSet orgSet= new WritableSet();
orgSet.addChangeListener(new IChangeListener() {
@Override
public void handleChange (ChangeEvent event) {
if (!internalChange) {
// mark an internal change
internalChange= true;
try {
targetList.clear();
targetList.addAll(Arrays.asList(viewer.getCheckedElements()) );
} finally {
internalChange= false;
}
}
}
});
targetList.addChangeListener(new IChangeListener() {
@Override
public void handleChange (ChangeEvent event) {
if (!_internalChange) {
// mark an internal change
_internalChange= true;
try {
orgSet.clear();
List<?> list= Arrays.asList(targetList.toArray());
orgSet.addAll(list);
} finally {
_internalChange= false;
}
}
}
});
ctx.bindSet(ViewersObservables.observeCheckedElements(this,
Organisation.class), orgSet);
|
|
|
|
Re: databinding missing IEMFSetProperty [message #499228 is a reply to message #499211] |
Fri, 20 November 2009 13:34 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
That would be absolutely perfect, Tom :-)
Tom Schindl schrieb:
> Hi Thomas,
>
> Yes - you are on the right track :-). Maybe I can spend some minutes
> today in the afternoon to see if I can implement a IEMFSetProperty.
>
> Tom
>
> Thomas Kowatsch schrieb:
>> Hi Tom.
>>
>> I think I understand the dirty hack now.
>> I attached below a code snippet for you to check if this is generally
>> correct.
>> I know it is a very dirty implementation at the moment and can be
>> enhanced. But I only wanted to be sure that this is the correct
>> direction I go.
>>
>> Thanx in advance.
>> -- Thomas
>>
>> final IObservableList targetList=
>> IEMFEditListProperty.observeDeatil(master);
>>
>> final WritableSet orgSet= new WritableSet();
>> orgSet.addChangeListener(new IChangeListener() {
>> @Override
>> public void handleChange (ChangeEvent event) {
>> if (!internalChange) {
>> // mark an internal change
>> internalChange= true;
>> try {
>> targetList.clear();
>> targetList.addAll(Arrays.asList(viewer.getCheckedElements()) );
>> } finally {
>> internalChange= false;
>> }
>> }
>> }
>> });
>>
>> targetList.addChangeListener(new IChangeListener() {
>> @Override
>> public void handleChange (ChangeEvent event) {
>> if (!_internalChange) {
>> // mark an internal change
>> _internalChange= true;
>> try {
>> orgSet.clear();
>> List<?> list= Arrays.asList(targetList.toArray());
>> orgSet.addAll(list);
>> } finally {
>> _internalChange= false;
>> }
>> }
>> }
>> });
>>
>> ctx.bindSet(ViewersObservables.observeCheckedElements(this,
>> Organisation.class), orgSet);
|
|
|
|
|
Re: databinding missing IEMFSetProperty [message #500021 is a reply to message #499211] |
Tue, 24 November 2009 17:42 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
Hi Tom.
I have seen and used your patch. Looks good ans seems to work.
Do you know when you can add the command execution stuff for the edit part?
Cheers.
-- Thomas
Tom Schindl schrieb:
> Hi Thomas,
>
> Yes - you are on the right track :-). Maybe I can spend some minutes
> today in the afternoon to see if I can implement a IEMFSetProperty.
>
> Tom
>
> Thomas Kowatsch schrieb:
>> Hi Tom.
>>
>> I think I understand the dirty hack now.
>> I attached below a code snippet for you to check if this is generally
>> correct.
>> I know it is a very dirty implementation at the moment and can be
>> enhanced. But I only wanted to be sure that this is the correct
>> direction I go.
>>
>> Thanx in advance.
>> -- Thomas
>>
>> final IObservableList targetList=
>> IEMFEditListProperty.observeDeatil(master);
>>
>> final WritableSet orgSet= new WritableSet();
>> orgSet.addChangeListener(new IChangeListener() {
>> @Override
>> public void handleChange (ChangeEvent event) {
>> if (!internalChange) {
>> // mark an internal change
>> internalChange= true;
>> try {
>> targetList.clear();
>> targetList.addAll(Arrays.asList(viewer.getCheckedElements()) );
>> } finally {
>> internalChange= false;
>> }
>> }
>> }
>> });
>>
>> targetList.addChangeListener(new IChangeListener() {
>> @Override
>> public void handleChange (ChangeEvent event) {
>> if (!_internalChange) {
>> // mark an internal change
>> _internalChange= true;
>> try {
>> orgSet.clear();
>> List<?> list= Arrays.asList(targetList.toArray());
>> orgSet.addAll(list);
>> } finally {
>> _internalChange= false;
>> }
>> }
>> }
>> });
>>
>> ctx.bindSet(ViewersObservables.observeCheckedElements(this,
>> Organisation.class), orgSet);
|
|
|
|
Re: databinding missing IEMFSetProperty [message #500169 is a reply to message #500072] |
Wed, 25 November 2009 08:59 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
Hi Tom, great man... :-)
Tom Schindl schrieb:
> Hi Thomas,
>
> I'll take a look at it tomorrow morning because I have a half day off.
>
> Tom
>
> Thomas Kowatsch schrieb:
>> Hi Tom.
>> I have seen and used your patch. Looks good ans seems to work.
>> Do you know when you can add the command execution stuff for the edit part?
>> Cheers.
>> -- Thomas
>>
>> Tom Schindl schrieb:
>>> Hi Thomas,
>>>
>>> Yes - you are on the right track :-). Maybe I can spend some minutes
>>> today in the afternoon to see if I can implement a IEMFSetProperty.
>>>
>>> Tom
>>>
>>> Thomas Kowatsch schrieb:
>>>> Hi Tom.
>>>>
>>>> I think I understand the dirty hack now.
>>>> I attached below a code snippet for you to check if this is generally
>>>> correct.
>>>> I know it is a very dirty implementation at the moment and can be
>>>> enhanced. But I only wanted to be sure that this is the correct
>>>> direction I go.
>>>>
>>>> Thanx in advance.
>>>> -- Thomas
>>>>
>>>> final IObservableList targetList=
>>>> IEMFEditListProperty.observeDeatil(master);
>>>> final WritableSet orgSet= new WritableSet();
>>>> orgSet.addChangeListener(new IChangeListener() {
>>>> @Override
>>>> public void handleChange (ChangeEvent event) {
>>>> if (!internalChange) {
>>>> // mark an internal change
>>>> internalChange= true;
>>>> try {
>>>> targetList.clear();
>>>> targetList.addAll(Arrays.asList(viewer.getCheckedElements()) );
>>>> } finally {
>>>> internalChange= false;
>>>> }
>>>> }
>>>> }
>>>> });
>>>>
>>>> targetList.addChangeListener(new IChangeListener() {
>>>> @Override
>>>> public void handleChange (ChangeEvent event) {
>>>> if (!_internalChange) {
>>>> // mark an internal change
>>>> _internalChange= true;
>>>> try {
>>>> orgSet.clear();
>>>> List<?> list= Arrays.asList(targetList.toArray());
>>>> orgSet.addAll(list);
>>>> } finally {
>>>> _internalChange= false;
>>>> }
>>>> }
>>>> }
>>>> });
>>>>
>>>> ctx.bindSet(ViewersObservables.observeCheckedElements(this,
>>>> Organisation.class), orgSet);
|
|
|
|
Re: databinding missing IEMFSetProperty [message #500226 is a reply to message #500177] |
Wed, 25 November 2009 12:55 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
Hi Tom.
Updated from head and it works fine.
Thank you very much.
Only one thing: you forgot a System.err.println() in
EMFEditSetProperty#doSetSet()...
Cheers.
--Thomas
Tom Schindl schrieb:
> You're welcome.
>
> The changes are in HEAD and hopefully show up in the next build. I love
> the properties stuff - it's never been so easy to implement stuff like this.
>
> Tom
>
> Thomas Kowatsch schrieb:
>> Hi Tom, great man... :-)
>>
>> Tom Schindl schrieb:
>>> Hi Thomas,
>>>
>>> I'll take a look at it tomorrow morning because I have a half day off.
>>>
>>> Tom
>>>
>>> Thomas Kowatsch schrieb:
>>>> Hi Tom.
>>>> I have seen and used your patch. Looks good ans seems to work.
>>>> Do you know when you can add the command execution stuff for the edit
>>>> part?
>>>> Cheers.
>>>> -- Thomas
>>>>
>>>> Tom Schindl schrieb:
>>>>> Hi Thomas,
>>>>>
>>>>> Yes - you are on the right track :-). Maybe I can spend some minutes
>>>>> today in the afternoon to see if I can implement a IEMFSetProperty.
>>>>>
>>>>> Tom
>>>>>
>>>>> Thomas Kowatsch schrieb:
>>>>>> Hi Tom.
>>>>>>
>>>>>> I think I understand the dirty hack now.
>>>>>> I attached below a code snippet for you to check if this is generally
>>>>>> correct.
>>>>>> I know it is a very dirty implementation at the moment and can be
>>>>>> enhanced. But I only wanted to be sure that this is the correct
>>>>>> direction I go.
>>>>>>
>>>>>> Thanx in advance.
>>>>>> -- Thomas
>>>>>>
>>>>>> final IObservableList targetList=
>>>>>> IEMFEditListProperty.observeDeatil(master);
>>>>>> final WritableSet orgSet= new WritableSet();
>>>>>> orgSet.addChangeListener(new IChangeListener() {
>>>>>> @Override
>>>>>> public void handleChange (ChangeEvent event) {
>>>>>> if (!internalChange) {
>>>>>> // mark an internal change
>>>>>> internalChange= true;
>>>>>> try {
>>>>>> targetList.clear();
>>>>>>
>>>>>> targetList.addAll(Arrays.asList(viewer.getCheckedElements()) );
>>>>>> } finally {
>>>>>> internalChange= false;
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>> });
>>>>>>
>>>>>> targetList.addChangeListener(new IChangeListener() {
>>>>>> @Override
>>>>>> public void handleChange (ChangeEvent event) {
>>>>>> if (!_internalChange) {
>>>>>> // mark an internal change
>>>>>> _internalChange= true;
>>>>>> try {
>>>>>> orgSet.clear();
>>>>>> List<?> list= Arrays.asList(targetList.toArray());
>>>>>> orgSet.addAll(list);
>>>>>> } finally {
>>>>>> _internalChange= false;
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>> });
>>>>>>
>>>>>> ctx.bindSet(ViewersObservables.observeCheckedElements(this,
>>>>>> Organisation.class), orgSet);
|
|
|
|
Powered by
FUDForum. Page generated in 0.05122 seconds