Problem with DataBindingContext into UIDialog

413 views
Skip to first unread message

Angelo zerr

unread,
Dec 16, 2008, 6:16:15 PM12/16/08
to uface
Hi,

I would like open the AbstractXPathExpressionDemo into dialog into AbstractDemo.
So to do that you can do :

UIDialog dialog = fact.newDialog(window, new UIDialog.DialogUIInfo(fact.newFillLayout(),buttons,UIDialog.DialogUIInfo.CLOSE_WINDOW_BUTTON));
dialog.setText("XPath Editor");
               
AbstractXPathExpressionDemo xpathUIContent = new AbstractXPathExpressionDemo() {};
xpathUIContent.createUI(dialog);

The problem is that I'm using Databinding and I have
Exception in thread "main" org.eclipse.core.runtime.AssertionFailedException: null argument:Validation realm cannot be null

when I try to open the dialog (it works perfectly with JFaceXPathExpressionDemo, not with dialog) .

It's normal, because when I check Realm.getDefault() and is null.

have you an idea to manage DataBindingContext into UIDialog?

Thank for your help.

Regards Angelo

Tom Schindl

unread,
Dec 16, 2008, 6:26:33 PM12/16/08
to uf...@googlegroups.com
Hi,

Need to take a look why this Realm returns null is the code in SVN?

Tom

Angelo zerr schrieb:

Tom Schindl

unread,
Dec 16, 2008, 7:34:07 PM12/16/08
to uf...@googlegroups.com
Fixed.

Tom
Angelo zerr schrieb:

Angelo zerr

unread,
Dec 17, 2008, 2:19:32 AM12/17/08
to uf...@googlegroups.com
Thank a lot Tom.

When you have time could you explain me how you have fixed that?

Thanks

Angelo


2008/12/17 Tom Schindl <toms...@gmail.com>

Tom Schindl

unread,
Dec 17, 2008, 3:59:52 AM12/17/08
to uf...@googlegroups.com
Take a look at the commit. The problem was that the application code in
JFaceDemo looked like this:

-----8<-----
Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
public void run() {
try {
UIApplicationWindow window = createUI(uiMethod);

} catch (Throwable t) {
t.printStackTrace();
}
}
});

while( ! window.isDisposed() ) {
if( ! display.readAndDispatch() ) {
display.sleep();
}
}
-----8<-----

and this means that all is fine while we are setting up the UI but at
the moment we create UI-Elements after the intial createUI-call
(which you did in opening the dialog) the runnable is over and no
default-realm is set anymore hence the exception.

We are going to run into the same problems with Swing and QT - I need to
take a look tonight how we can solve this issue in a better way.
I think for QT the same can be done than for SWT but Swing has no event
loop I can spin itself so it might be a problem too.

Tom

Angelo zerr schrieb:
> Thank a lot Tom.
>
> When you have time could you explain me how you have fixed that?
>
> Thanks
>
> Angelo
>
>
> 2008/12/17 Tom Schindl <toms...@gmail.com <mailto:toms...@gmail.com>>

Angelo zerr

unread,
Dec 17, 2008, 12:20:49 PM12/17/08
to uf...@googlegroups.com
Tom,

I start to manage Swing dialog, but I have problem with the Realm (like JFace).
If you fing solution could you tell me please.

Thank a lot.

Angelo

2008/12/17, Tom Schindl <toms...@gmail.com>:

Tom Schindl

unread,
Dec 17, 2008, 2:23:34 PM12/17/08
to uf...@googlegroups.com
Hi Angelo,

You could fix this until we have a better solution by setting a simply
setting a default realm:

public void run(final String uiMethod) {
SwingRealm.createDefault();
Realm.runWithDefault(SwingObservables.getRealm(), new Runnable() {
public void run() {
try {
createUI(uiMethod);
} catch (Throwable t) {
t.printStackTrace();
}
}
});
}

Do you have time for an IRC-Session - I want to shutdown work and move
code to Eclipse.org. We are a bit short of time.

Tom

Angelo zerr schrieb:
Reply all
Reply to author
Forward
0 new messages