Editors
Building data editing forms in Eclipse RCP with SWT means writing repetitive code for text fields, validation, buttons and layout. Such code is tedious to write and easy to get wrong.
The Amalgama Platform’s editor components help eliminate this boilerplate code. Each editor is created by a factory method of the Sections class, configured step by step with the returned builder and built with .create(). The result is a section: a label, an input control with validation of the entered value, and optional buttons.
Where to use them: in property dialogs, configuration panels, model editors, and anywhere else users edit data.
There are three editing patterns for every data type:
-
Standalone: Edits a single value. The editor reads the current value from a
Supplierand passes each new value to a handler, which saves it. -
Container: Edits a property of an object stored in a
WritableValue. The editor reads the property value from the object in the container and writes the new value back to the same object. When another object is put into the container, all editors bound to it show the properties of the new object. -
EMF: Works like the container pattern, but for EMF models: the
WritableValueholds anEObject, and the editor is bound to one of its features. The editor takes the current value from this feature and saves each new value to it. Putting anotherEObjectinto the container switches every editor bound to it to the features of that object.
The complete source code of all examples is available in the GitHub repository.