Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » [DataBinding] Real in RCP
[DataBinding] Real in RCP [message #313135] Fri, 02 March 2007 21:59 Go to next message
Eclipse UserFriend
Hello everyone.

I have been using a slightly older version of DataBinding in my RCP app.
There, I was using the following to set up my realm:

Realm.setDefault(SWTObservables.getRealm(display));

I noticed that this is broken in the most recent source and now I need
to use something like

Realm.runWithDefault(Realm, Runnable);

Could someone please tell me what the Runnable should be in an RCP
application? I used to call my earlier version in my main Application
entry class:
----- Snippet ------------
public Object run(Object args) throws Exception {
Display display = PlatformUI.createDisplay();
Realm.setDefault(SWTObservables.getRealm(display));

try {
int returnCode = PlatformUI.createAndRunWorkbench(display, new
ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IPlatformRunnable.EXIT_RESTART;
}
return IPlatformRunnable.EXIT_OK;
} finally {
display.dispose();
}
}

------ End of Snippet ------

so how should it be set now?

Many thanks,
Ali.
Re: [DataBinding] Real in RCP [message #313137 is a reply to message #313135] Fri, 02 March 2007 23:27 Go to previous messageGo to next message
Eclipse UserFriend
It should now be something like...

Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
public void run() {
try {
int returnCode = PlatformUI.createAndRunWorkbench(display, new
ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IPlatformRunnable.EXIT_RESTART;
}
return IPlatformRunnable.EXIT_OK;
} finally {
display.dispose();
}
}
});

(I typed this in a text editor so if it doesn't compile hopefully you
still understand what is required.)

Also note that as of 3.3M5 the Eclipse Workbench handles this[1].

-brad

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=171746
Re: [DataBinding] Real in RCP [message #313138 is a reply to message #313137] Sat, 03 March 2007 00:08 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Brad. Two related questions:

(1) When you said Workbench handles this as of 3.3M5, does it mean that
no Realm setting (as per your snippet) is required in 3.3M5?

(2) I imagine that DataBinding APIs are stable now, as of 3.3M5. If so,
can we use the databinding packages that are bundled with 3.3M5 instead
of CVS? Obviously minor fixes can go into CVS but I presume the core is
already there in the bundled packages. Is that correct?

Thanks
Ali.


Brad Reynolds wrote:
> It should now be something like...
>
> Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
> public void run() {
> try {
> int returnCode = PlatformUI.createAndRunWorkbench(display,
> new ApplicationWorkbenchAdvisor());
> if (returnCode == PlatformUI.RETURN_RESTART) {
> return IPlatformRunnable.EXIT_RESTART;
> }
> return IPlatformRunnable.EXIT_OK;
> } finally {
> display.dispose();
> }
> }
> });
>
> (I typed this in a text editor so if it doesn't compile hopefully you
> still understand what is required.)
>
> Also note that as of 3.3M5 the Eclipse Workbench handles this[1].
>
> -brad
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=171746
>
Re: [DataBinding] Real in RCP [message #313142 is a reply to message #313138] Sat, 03 March 2007 02:06 Go to previous messageGo to next message
Eclipse UserFriend
>"(1) When you said Workbench handles this as of 3.3M5, does it mean that no
Realm setting (as per your snippet) is required in 3.3M5?"

If running in Eclipse yes. I'm not sure how that carries over to an RCP
app. But I assume that if you had to invoke createAndRunWorkbench
previously then you'll still need your code. But if just creating a View
to run in Eclipse you shouldn't have to set the default Realm any longer.

>"(2) I imagine that DataBinding APIs are stable now, as of 3.3M5. If so, can
we use the databinding packages that are bundled with 3.3M5 instead of CVS?
Obviously minor fixes can go into CVS but I presume the core is already there
in the bundled packages. Is that correct?"

We're still making some API changes. BindSpec, IBindingListener, and
BindingEvent are going[1] away[2]. We didn't want to rush this one into
M5 so it's happening now. I'd recommend sticking with M5 if you need
stability in the coming weeks. Hopefully very few API changes will be
happening after that.

-brad

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=175840
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=172193
Re: [DataBinding] Real in RCP [message #313150 is a reply to message #313137] Sat, 03 March 2007 21:23 Go to previous messageGo to next message
Eclipse UserFriend
Brad,

I am not yet clear as to what the new code should look like. Your
snippet doesn't work (the "void run()" cannot have a return clause in
its body). I understood that you were just trying to convey the idea but
I am not sure how to correct it.

Thanks,
Ali.


Brad Reynolds wrote:
> It should now be something like...
>
> Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
> public void run() {
> try {
> int returnCode = PlatformUI.createAndRunWorkbench(display,
> new ApplicationWorkbenchAdvisor());
> if (returnCode == PlatformUI.RETURN_RESTART) {
> return IPlatformRunnable.EXIT_RESTART;
> }
> return IPlatformRunnable.EXIT_OK;
> } finally {
> display.dispose();
> }
> }
> });
>
> (I typed this in a text editor so if it doesn't compile hopefully you
> still understand what is required.)
>
> Also note that as of 3.3M5 the Eclipse Workbench handles this[1].
>
> -brad
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=171746
>
Re: [DataBinding] Real in RCP [message #313171 is a reply to message #313150] Mon, 05 March 2007 16:07 Go to previous message
Eclipse UserFriend
This is what is in org.eclipse.ui.internal.Workbench...

public static final int createAndRunWorkbench(final Display display,
final WorkbenchAdvisor advisor) {
final int[] returnCode = new int[1];
Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
public void run() {
// create the workbench instance
Workbench workbench = new Workbench(display, advisor);
// run the workbench event loop
returnCode[0] = workbench.runUI();
}
});
return returnCode[0];
}

-brad
Previous Topic:Comment tag in .project file
Next Topic:Error in Eclipse 64 bit java on hpux IA architecture
Goto Forum:
  


Current Time: Thu May 08 22:53:59 EDT 2025

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

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

Back to the top