Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
JFace Data Binding/The New Binding API/Bind Proposals
This page contains proposals for new stuff for the binding API. If you have requirements you would like to see, please edit this page or create a bug.
The above examples have all used static methods in the
Bind class. However sometimes we need to group bindings together. For example, the
dispose method in the old
DataBindingContext class disposes all bindings in the context. To support the same concept,
Bind allows the creation of a
Bind instance to give context.
Bind bindingContext = Bind.createContext();
Transaction Bind instance
Sometimes you don't want changes to go from the target to the model immediately. For example if the target controls are in a dialog box then you may want the values to be set in the model only if and when the user presses the 'OK' button. Another example would be an editor part where you don't want parts outside the editor to see the changes until the editor has been saved. To do this you create a 'transaction' binding context:
Bind bindingContext = Bind.createTransactionalContext();
Changes to the model will now be set in the target but changes to the target are not immediately set in the model. When changes need to be set in the model (for example when the user presses the 'OK' button in a dialog or the user saves an editor) then the following code should be called:
commit is never called (for example the user pressed the 'Cancel' button) then the model is never updated.
The transactional binding context also has an
isDirty method. This method returns an IObservableValue<Boolean> that can be bound to the enablement of the 'OK' button in a dialog or the dirty state of an editor.