Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » DataBinding Help(Need help to upgrade the current databinding code)
DataBinding Help [message #1827999] Thu, 28 May 2020 20:26 Go to next message
Yigal Spinner is currently offline Yigal SpinnerFriend
Messages: 122
Registered: July 2009
Senior Member
We have code that was created in Eclipse Galileo. I need to upgrade the Eclipse to the latest version. I run into an issue that the interface IObservableValue changed definition to IObservableValue<T>

I'm looking for new example how the EMF databinding should be defined but can't find any information

My code is simple:
    public boolean doDataBinding(EditingDomain domain, EObject input) {
        binding = new EMFDataBindingContext();

        IWidgetValueProperty<Text, String> prop = WidgetProperties.text(SWT.Modify);

        IEMFValueProperty value = EMFEditProperties.value(domain, fldFeature);
        IObservableValue<?> ob = value.observe(input);
        binding.bindValue(prop.observeDelayed(FIELD_INPUT_DELAY, txtControl), ob);
        return false;

The warning I get on the code "value.observe(input)" is:
Type safety: The method observe(Object) belongs to the raw type IValueProperty. References to generic type IValueProperty<S,T> should be parameterized

How do I do that???
Where can I find sample code that will help me do databinding for all types of widgets?

Re: DataBinding Help [message #1828006 is a reply to message #1827999] Fri, 29 May 2020 04:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 32668
Registered: July 2009
Senior Member
The EMF APIs have not been modified to introduce generics so there's no way to avoid this problem. Others have added their own "helper" static method to centralize the annotations to suppress the warnings.

Ed Merks
Professional Support:
Re: DataBinding Help [message #1828009 is a reply to message #1828006] Fri, 29 May 2020 06:45 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7564
Registered: July 2009
Senior Member

Presumably your code works, so Java is 'happy' with the partial type information. The easiest approach is to add e.g. @SuppressWarnings("rawtypes") perhaps to individual declarations, perhaps to methods / classes / projects.

If some parameters are already defined then you need to go along with them, otherwise <?> or <Object> will probably do.

Ultimately genetics enable you to write safer code so its best to use them rather than fight them. As Ed Merks writes, helper methods can help.I have a variety of XXXUtil classes for such purposes.


Ed Willink
Previous Topic:Manage Tool Documentation
Next Topic:[CDO] Offline Clone keeps connecting and disconnecting to master
Goto Forum:

Current Time: Wed Feb 08 21:48:54 GMT 2023

Powered by FUDForum. Page generated in 0.01508 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top