Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347216 - jFace/SWT - DataBindingContext.udpateTargets() does not work properly with nested properties and external actions
Summary: jFace/SWT - DataBindingContext.udpateTargets() does not work properly with ne...
Status: CLOSED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-25 15:14 EDT by Gianni Paglia CLA
Modified: 2011-05-26 02:44 EDT (History)
0 users

See Also:


Attachments
java sources I used to reproduce the behaviour (2.94 KB, application/octet-stream)
2011-05-25 15:17 EDT, Gianni Paglia CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gianni Paglia CLA 2011-05-25 15:14:31 EDT
Build Identifier: 20110301-1815

I have created an ApplicationWindow subclass named TestBinding with a Text widget called proxyHost
I have created a public method in TestBinding that calls updateTargets() on the DataBindingContext (so that I can trigget the updateTargets() from an external action)

I have a domain object pojo (class DomainModel) containing another pojo (class Config).
I have set up a binding between the Text widget (proxyHost)  and the nested property "config.proxyHost" within the domainModel pojo (I have the proper setters and getters, I can access the property as domainObject.getConfig().getProxyHost()

I have configured 3 actions, 2 internals and 1 external.
The external action is a subclass of Action, with a 2 parameter constructor accepting the TestBinding object and the DomainModel object so I can access, from the external action, the DomainObject object and the TestBinding object.
In the actions run() method I do the following:
- set the nested property to a specific string (domainObject.getConfig().setProxyHost("XXX"))
- call the updateTargets() on the DataBindingContext (in the external action I do this calling the exposed updateTargets() method on the TestBinding object)


The behaviour is the following:
- the internal actions behave correctly
- if I trigger the external action from the menu, the target is not updated (i.e. the proxyHost Text is not updated on the screen)
- once I have triggered the external action once, the internal actions will also stop working and the target (the proxyHost Text) is no longer updated

This behaviour is present with both the following binding statements:

IObservableValue domainModelgetConfigProxyHostObserveValue = 
  PojoObservables.observeValue(domainModel, "config.proxyHost");
IObservableValue domainModelgetConfigProxyHostObserveValue = 
  PojoObservables.observeValue(domainModel.getConfig(), "proxyHost");

I attach a rar with the java sources I have used.

Regards

Gianni

Reproducible: Always
Comment 1 Gianni Paglia CLA 2011-05-25 15:17:46 EDT
Created attachment 196599 [details]
java sources I used to reproduce the behaviour
Comment 2 Gianni Paglia CLA 2011-05-26 02:44:27 EDT
I have understood this is not at all a bug.
The behaviour depends on the fact that the createContents method (which initializes the DataBindingContext) runs after createActions() and therefor the external action is initialized with an invalid DataBindingContext object.

I therefore close the bug.

G