"Validation realm cannot be null" error

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

"Validation realm cannot be null" error

Postby IanHarac » Mon Aug 24, 2009 7:33 am

I've set up some basic bindings and launched my form. As soon as InitDataBindings() is called, the program exits with the above assertion error. I am not sure if it matters, but the application is Terracotta-enabled. (That's the only thing I can think of that might influence the above, however, launching it as a standard app w/out Terracotta results in the same error.)
IanHarac
 
Posts: 27
Joined: Wed Jan 10, 2007 7:04 am

Re: "Validation realm cannot be null" error

Postby Eric Clayberg » Mon Aug 24, 2009 7:39 am

Does you app set up a Data Binding realm anywhere? If not, you can certainly get that error.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: "Validation realm cannot be null" error

Postby IanHarac » Mon Aug 24, 2009 10:45 am

Eric Clayberg wrote:Does you app set up a Data Binding realm anywhere? If not, you can certainly get that error.


Nope.

I've used Binding with Swing, and everything was set up automagically by Designer. I guess I need to delve into documentation....
IanHarac
 
Posts: 27
Joined: Wed Jan 10, 2007 7:04 am

Re: "Validation realm cannot be null" error

Postby Eric Clayberg » Mon Aug 24, 2009 10:57 am

Depending on what you are actually doing (which I don't know as you did not post a test case), Designer does set up everything.

In RCP apps, the Realm is set up automatically. In SWT apps, it needs to be set up whereever you start your app.

If you use DB in an SWT App Window, Designer will set up the Realm in the main() method.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: "Validation realm cannot be null" error

Postby IanHarac » Mon Aug 24, 2009 11:42 am

This is a case of me trying to inhale two new APIs (SWT/Jface and Terracotta) at the same time...

My actual UI is launched from small starter EXE:
Code: Select all
public class FrontEndLauncher implements Runnable
{
   private static UserInterfaceForm f=new UserInterfaceForm();
   /**
    * @param args
    */
   public static void main(String[] args)
   {
      try
      {
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         new FrontEndLauncher().run();
      }
      catch (Exception e)
      {
         System.out.println(e);
      }

   }

   @Override
   public void run()
   {
      f.setUser(new User("IHARAC", "PASSWORD"));
      f.open();
   }

}


Following the examples in Eclipsepedia, I modified the main app window's code to:
Code: Select all
public void open()
   {
      Display display=Display.getDefault();
      Realm.runWithDefault(SWTObservables.getRealm(display),new Runnable()
      {
         public void run()
         {
            Display display=Display.getDefault();
            createContents();
            shlVariskDistributed.open();
            shlVariskDistributed.layout();
            while (!shlVariskDistributed.isDisposed())
            {
               if (!display.readAndDispatch())
               {
                  display.sleep();
               }
            }
         }
      });
   }


And this seems to be working... at the least, it's not crashing or filling my console with Exception stack traces, and the form is being properly displayed. However, I'm aware I'm basically doing cut&paste without a complete grasp of the details, so if you want to laugh hilariously and then tell me a much smarter way, I'll be happy.

BTW, your point on not supply source code is well taken; I will try to be more informative in the future.
IanHarac
 
Posts: 27
Joined: Wed Jan 10, 2007 7:04 am

Re: "Validation realm cannot be null" error

Postby Eric Clayberg » Mon Aug 24, 2009 7:12 pm

IanHarac wrote:Following the examples in Eclipsepedia, I modified the main app window's code

And you did it exactly right! :-)

That is basically the same code that Designer woud generate in an SWT App Windows that was using DB.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: Google [Bot] and 2 guests