Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 171616 - [DataBinding] Introduce IBeanObservable
Summary: [DataBinding] Introduce IBeanObservable
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.3 M5   Edit
Assignee: Brad Reynolds CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 154132 168944
  Show dependency tree
 
Reported: 2007-01-24 19:56 EST by Brad Reynolds CLA
Modified: 2007-02-25 00:09 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Reynolds CLA 2007-01-24 19:56:51 EST
On the newsgroup[1] there was a question about how to retrieve the model object in and instance of IBindingListener.  Currently the only way to do this is by referencing the bean in the listener.  That works but it seems like we should be able to provide a mixin interface, must like ISWTObservable, for bean observables.  It would look something like...

public interface IBeanObservable {
    public Object getBean();
    public PropertyDescriptor getPropertyDescriptor();
}

I still need to think about it a bit but wanted to get a bug logged.  Comments are encouraged.

[1] http://www.eclipse.org/newsportal/article.php?id=61666&group=eclipse.platform#61666
Comment 1 Dave Orme CLA 2007-01-24 20:40:34 EST
Yes.

This is needed.

We had to add this behavior to the old API...
Comment 2 Boris Bokowski CLA 2007-01-24 20:47:52 EST
+1

IBeanObservable is not intended to be implemented by clients, right?
Comment 3 Brad Reynolds CLA 2007-01-24 20:56:22 EST
(In reply to comment #2)
> +1
> 
> IBeanObservable is not intended to be implemented by clients, right?
> 
Correct.  

I think I'll need to change my strategy a bit after looking through the code though.  Every observable retrieved will be able to expose the PropertyDescriptor but not all have a bean to expose (e.g. maps).  Plus we return quite a few types of bean observables: IObservableValue, IObservableList, IObservableSet, and IObservableMap.  So I need to think about that a bit because I'm not too fond of exposing 5 new interfaces: IBeanObservable, IBeanObservableValue, IBeanObservableList, IBeanObservableSet, and IBeanObservableMap.
Comment 4 Brad Reynolds CLA 2007-01-25 22:32:46 EST
Here's what I'm proposing after speaking with Boris for a bit on the subject...

public interface IBeanObservable {
     public PropertyDescriptor getPropertyDescriptor();
     public Object getObserved();
}

The implementations returned will implement this interface and when needed the client will have to down cast to it rather than having an interface for every type (e.g. IBeanObservableValue, IBeanObservableList, etc.).  The reason for the name of getObserved() and not getBean() is that it won't be a bean in all cases.  For example an IObservableMap will be observing an IObservableSet and the detail observables will be observing another observable as well.  The only return values that won't implement the interface will be the implementations returned for the observable factories because they're not implementations of IObservable.
Comment 5 Brad Reynolds CLA 2007-01-27 19:51:42 EST
FIXED > 20070127.

All observables returned from the factory implement IBeanObservable.
Comment 6 Brad Reynolds CLA 2007-02-06 21:05:42 EST
VERIFIED in I20070206-0010.