Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367546 - [Databinding] After calling refresh on JFace Viewers the method providing data is called two times
Summary: [Databinding] After calling refresh on JFace Viewers the method providing dat...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-25 17:02 EST by jan CLA
Modified: 2019-11-14 03:07 EST (History)
2 users (show)

See Also:


Attachments
Example with binding and refresh (17.25 KB, application/x-zip-compressed)
2011-12-25 17:21 EST, jan CLA
no flags Details
Patch that removes problem with the refresh (895 bytes, patch)
2012-01-07 04:57 EST, jan CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jan CLA 2011-12-25 17:02:39 EST
Build Identifier: Version: Indigo Service Release 1, Build id: 20110916-0149

Calling refresh method on any JFace Viewers causes that data must be provided two times if binding via Property API is used. Binding was defined in WindowBuilderPro.

I think there is no reason for calling method providing data two times especially if getting them is time consuming.

The failure is caused by method getElements in the ObservableCollection.

	public Object[] getElements(Object inputElement) {
		if (observableCollection == null)
			return new Object[0];

		knownElements.addAll(observableCollection);
		if (realizedElements != null) {
			if (!realizedElements.equals(knownElements)) {
				asyncUpdateRealizedElements();
			}
		}

>>>>		return observableCollection.toArray();
	}

In my view this line should be different, maybe knownElements.toArray(), but I didn't verify it.

Jan




Reproducible: Always

Steps to Reproduce:
I will enclose an example.
Comment 1 jan CLA 2011-12-25 17:21:28 EST
Created attachment 208800 [details]
Example with binding and refresh

After button "Refresh" is pressed, data are provided two times. If data should be provided, message box is displayed.
Comment 2 jan CLA 2012-01-07 04:57:17 EST
Created attachment 209165 [details]
Patch that removes problem with the refresh

This patch fixes the problem with getting data after refresh and even during initialization, but I am not sure if there are not side effects.
I didn't get why there several collections of the elements. Is there any document the architecture and how they should / could be used?
Comment 3 Lars Vogel CLA 2019-11-14 03:07:17 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.