[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: [DataBinding] AssertionFailedException: "null argument" when using DataBindingContext's default constructor

Wrap you app's main() instructions in a call to:

The default realm is set using a call to Realm.runWithDefault(Realm, Runnable). The default realm is set while the runnable is running, and is set to the previous realm after the runnable completes.

Most of my apps have a main method that looks like this:

Display display = new Display();
Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
  public void run() {
    // create and open main application window
  }
});

Matthew


Sebastian Paul wrote:
Databinding is triggered by a PropertyChangeListener. I can workaround my problem by databinding on the UI thread.

public void propertyChange(PropertyChangeEvent evt) {
    [...]
    getDisplay().asyncExec(new Runnable() {
        public void run() {
            bind(notifier);
        }
    });
}

protected void bind(PropertyChangeNotifier notifier) {
    dataBindingContext = new DataBindingContext(); // PROBLEM HERE
    dataBindingContext.bindValue(
        SWTObservables.observeText(myText, SWT.Modify),
        BeansObservables.observeValue(notifier, "MY_PROP"),
        null, null);
    [...]
}

But isn't it an implementation detail of DataBindingContext? If not, where do I find information about the Realm stuff?

Kind regards, Sebastian