[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Does jface databinding support treeviewer?

hao wrote:
contentProvider.getKnownElements is passed to the ListeningLabelProvider
constructor....

I am sorry but still confusing about the contectprovider's getKnowElements(). Let's start with steps of setting those providers:
1. Creat content provider,
2. Set content provider,
3. Create label provider,
4. Set label provider,
5. Set input.


Before the input is set (at step 5), I believe the ObservableSet returned by contentProvider.getKnownElements() is a empty set. The PersonGroupLabelProvider implementation actually use another 2 sets of ObservableSet - personPhoneKnownElements & personPhoneGroupKnownElements. Only when addListenerTo() method is called the elements are added into the 2 sets of ObservableSet - personPhoneKnownElements & personPhoneGroupKnownElements. From the implementation of PersonGroupLabelProvider, I do not see the super class addListenerTo' addListenerTo() method is got called even when the treeviewer input is set.

Thanks!
hao


The known elements set is populated by the content provider when the viewer elements are first discovered (after you set the input). After that initial step, the content provider watches the input for additions / removals in the collection, and adds / removes elements from the known elements set accordingly.


Matthew