Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1/2] Databinding binds to deprecated classes (Properties Classes) #323 #329

Merged
merged 2 commits into from
Nov 5, 2022

Conversation

col-panic
Copy link
Contributor

@col-panic col-panic commented Oct 10, 2022

This PR updates the Properties class references to the new locations. It only implements a partial solution of the deprecated class databinding. For the properties files the replacement is quite simple, as the only change (wrt to windowbuilder) is the package renaming.

  • org.eclipse.core.databinding.beans.BeanProperties -> org.eclipse.core.databinding.beans.typed.BeanProperties
  • org.eclipse.core.databinding.beans.PojoProperties -> org.eclipse.core.databinding.beans.typed.PojoProperties
  • org.eclipse.jface.databinding.swt.WidgetProperties -> org.eclipse.jface.databinding.swt.typed.WidgetProperties
  • org.eclipse.jface.databinding.viewers.ViewerProperties -> org.eclipse.jface.databinding.viewers.typed.ViewerProperties

Bound for separate PR as the implementation substantially differs, and a drop-in-replacement is not easily possible:

  • org.eclipse.core.databinding.beans.BeansObservables.observe* -> reimplement required functions in org.eclipse.core.databinding.beans.typed.BeanProperties
  • org.eclipse.jface.databinding.swt.SWTObservables.observe* -> reimplement required functions in org.eclipse.jface.databinding.swt.typed.WidgetProperties
  • org.eclipse.core.databinding.beans.PojoObservables? -> reimplement required functions in org.eclipse.core.databinding.beans.typed.PojoProperties
  • org.eclipse.jface.databinding.viewers.ViewersObservables -> reimplement required functions in org.eclipse.jface.databinding.viewers.typed.ViewerProperties

General info
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=546820
see https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=4f25fbf41f9411ded14d3cec0e951e7bcaf51319

@github-actions
Copy link

Unit Test Results

    4 files      4 suites   1m 28s ⏱️
  83 tests   83 ✔️ 0 💤 0
166 runs  166 ✔️ 0 💤 0

Results for commit fd3d6d3.

@col-panic
Copy link
Contributor Author

Replacing the Observables seems to be much more complicated. Take the following example

IObservableValue passObserveWidget = SWTObservables.observeText(passText, SWT.Modify);
IObservableValue passObserveValue = BeansObservables.observeValue(mySampleBean, "pass");

should become

ISWTObservableValue<String> passObserveWidget = WidgetProperties.text().observe(passText);
IObservableValue<Object> passObserveValue = BeanProperties.value("pass").observe(mySampleBean);

the problem is the split into required submethods. This does not seem to easily match the existing structure (as far as I understand it up to now). A rather easy approach would be to offer methods like WidgetProperties.observeText(...) such that it becomes a drop-in replacement.

@wimjongman
Copy link
Contributor

so you say that Eclipse dropped data binding, and there is no drop-in replacement.

@col-panic
Copy link
Contributor Author

so you say that Eclipse dropped data binding, and there is no drop-in replacement.

uhm, don't know?! I just see, that updating WindowBuilder gets much more complicated from this point on.

@wimjongman
Copy link
Contributor

A rather easy approach would be to offer methods like WidgetProperties.observeText(...) such that it becomes a drop-in replacement.

Thanks for the analysis. This has to be changed in Eclipse data binding correct?

@wimjongman wimjongman linked an issue Oct 24, 2022 that may be closed by this pull request
@merks
Copy link
Contributor

merks commented Oct 24, 2022

Couldn't one write one's own utility class for this purpose?

@wimjongman
Copy link
Contributor

Couldn't one write one's own utility class for this purpose?

I don't see how. All WindowBuilder generated classes are SWT/JFace pojos.

@merks
Copy link
Contributor

merks commented Oct 24, 2022

I see, so there are no helper libraries involved at all just purely the generated classes and the libraries of the targets. Sorry for the noise.

@wimjongman
Copy link
Contributor

I see, so there are no helper libraries involved at all just purely the generated classes and the libraries of the targets. Sorry for the noise.

No noise, we can use all the ideas we can get.

I filed issue: eclipse-platform/eclipse.platform.ui#426

@col-panic
Copy link
Contributor Author

As commented in eclipse-platform/eclipse.platform.ui#426 - if there are going to be new Classes/Functions to be added in the next release, it might already might sense to do a partial commit. The existing code is wrong anyway, so at least some parts could be fixed.

@vogella
Copy link
Contributor

vogella commented Nov 2, 2022

@col-panic can you finish the commit with the existing drop-in replacements so that we can already support part of the scenarios?

@col-panic
Copy link
Contributor Author

@vogella I think so. will do some more checks and open a new issue for the missing parts then.

@col-panic col-panic changed the title Databinding binds to deprecated classes #323 [1/2] Databinding binds to deprecated classes (Properties Classes) #323 Nov 2, 2022
@col-panic col-panic marked this pull request as ready for review November 2, 2022 09:23
@col-panic
Copy link
Contributor Author

@vogella @wimjongman please have a review on the state of this PR. I want to separate works on the missing part, as this is already confusing enough to me. Besides, the parts fixed in here are already a partial solution - for what my manual tests were worth.

@wimjongman
Copy link
Contributor

Hey @col-panic. These changes look good to me. Thank you. Did you test if the new bindings can also be parsed back again?

@col-panic
Copy link
Contributor Author

col-panic commented Nov 5, 2022

yes, thats the state so far

grafik
grafik

not sure about adding type safety right now.

@wimjongman
Copy link
Contributor

Okay great. Can I squash this, or is that inconvenient for you?

@col-panic
Copy link
Contributor Author

col-panic commented Nov 5, 2022 via email

@wimjongman wimjongman merged commit 4ea8ed6 into eclipse-windowbuilder:master Nov 5, 2022
@col-panic
Copy link
Contributor Author

For advanced databindings, there are even methods missing, that got removed from the resp. type counterparts. One example is https://github.com/eclipse-platform/eclipse.platform.ui/blob/eb5f64917709bd7c903f72569d1344fbeda305bc/bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/swt/WidgetProperties.java#L238 which is used in radio button databinding

@wimjongman
Copy link
Contributor

Oops. I think that information should go to platform.

@col-panic
Copy link
Contributor Author

I'm not sure, this all seems to go a lot deeper, and seems quite overwhelming. There is a lot of code, due to the following setting
grafik

vs

grafik

(second is the default)

which allows to configure code generation between the observable and the properties style.

As far as I understand this now, the Observable way is generally not taken anymore (and in the future not available anymore) - so there seems to be a lot of stuff that makes sense to be cleaned up. And some code I tested still wants to simply generate the bindings old-school as it was never updated.

So it might sense to first remove this entire option, and migrate everything to new style. There are also so many scenarios where I don't know how to test extensively. This all seems to be a really big pile of work, if done right.

@vogella do you probably have an "uber-databinding" sample that includes all possible widgets and a fitting model which could then be used for testing the databinding generation? It was me simply trying to databind checkButtons where I found out about the WidgetProperties#selection not being available anymore ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Databinding binds to deprecated classes
4 participants