Community
Participate
Working Groups
There are certain tasks with the databinding framework that are verbose and messy, but where simple convenience methods would simplify the user code significantly. Examples: * Create a update strategy with a converter (type inference doesn't work for chained methods) * Create update strategies with the NEVER policy * Create simple conversion properties * Binding enum values This ticket is meant as an umbrella for work with such convenience code.
New Gerrit change created: https://git.eclipse.org/r/155303
New Gerrit change created: https://git.eclipse.org/r/155304
New Gerrit change created: https://git.eclipse.org/r/155306
New Gerrit change created: https://git.eclipse.org/r/155305
New Gerrit change created: https://git.eclipse.org/r/155307
The following demonstrates the convenience improvements that are made in the Gerrit changes. Snippets are also updated to demonstrate these additions. These examples are all pretty common tasks to do with the databinding framework. ### Update strategy `never` methods --- Code before changes bindingContext.bindValue(value1, value2, null, new UpdateValueStrategy<>(false, UpdateValueStrategy.POLICY_NEVER)); --- Code after changes bindingContext.bindValue(value1, value2, null, UpdateValueStrategy.never())); ### Update strategy `create` methods --- Code before changes bindingContext.bindValue(value1, value2, null, new UpdateValueStrategy<String, ExampleBean>().setConverter(exampleConverter)); --- Code after changes bindingContext.bindValue(value1, value2, null, UpdateValueStrategy.create(exampleConverter)); (The methods on UpdateValueStrategy already existed, but not the once for lists and sets.) ### `Properties#convertedValue` method --- Code before changes IValueProperty<Boolean, Font> fontProperty = BindingProperties.convertedValue( IConverter.create(boolean.class, boolean.clss, stale -> stale ? italicFont : shellFont); --- Code after changes IValueProperty<Boolean, Font> fontProperty = Properties.convertedValue(stale -> stale ? italicFont : shellFont); ### IConverter `create` method without type arguments --- Code before changes IConverter c = IConverter.create(boolean.class, boolean.clss, stale -> stale ? italicFont : shellFont); --- Code after changes IConverter c = IConverter.create(stale -> stale ? italicFont : shellFont);
I plan to merge these additions in a couple of days if I don't hear any objections.
Gerrit change https://git.eclipse.org/r/155303 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=661052a4600cefd294c2e2dc138a4e2adeeefdb6
Gerrit change https://git.eclipse.org/r/155304 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=bd585d25da1a0af341836fd90ec088984cc77ace
Gerrit change https://git.eclipse.org/r/155305 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7a4f6ad230dec5a5b8732c7bbf5ae24704bd50d2
Gerrit change https://git.eclipse.org/r/155306 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=aa97cac23006b6850cc5a6dba3246b4aa86f5c5e