|
|
|
|
Re: Close shell from within browser widget [message #813497 is a reply to message #813001] |
Mon, 05 March 2012 10:38 |
Tim Buschtoens Messages: 396 Registered: July 2009 |
Senior Member |
|
|
Seems the BrowserFunction is disposed while its still running. (Because
the shell is disposed.) It might work if you use Display#asyncExec to
close the shell, but I'm not sure. If it doesnt work, try if it works in
SWT (with and without asyncExec). If it does work in SWT, you can open a
bug in the RAP bugzilla.
Am 04.03.2012 18:45, schrieb Bertin Kiekebosch:
> I tried using the browser function but I always get an error when
> closing the shell that created the browser and browserfunction.
>
>
> public class OddOneOut extends Shell {
> private Browser b;
> private OddOneOutOefening oefening;
>
> public OddOneOut(final Shell parent, final int style, OddOneOutOefening
> o) {
> super(parent, style);
> setLayout(new FillLayout());
> setMaximized(true);
> this.oefening = o;
>
> b = new Browser(this, SWT.None);
> String url = "./resource/oddoneout.html";
>
> new CloseWindow(b, "closeWindow");
>
> b.setUrl(url);
> }
>
> class CloseWindow extends BrowserFunction {
> CloseWindow(Browser browser, String name) {
> super(browser, name);
> }
>
> public Object function(Object[] arguments) {
> try{
> System.out.println("Close Window just called from the browser");
> OddOneOut.this.close();
> }
> catch(Exception ex){
> System.out.println("CloseWindow");
> }
> return arguments;
> }
> }
>
>
> So when I remove the line "OddOneOut.this.close();" everything works
> fine, but with this line enabled I get the error:
>
>
> org.eclipse.swt.SWTError: Unknown error
> at org.eclipse.swt.SWT.error(SWT.java:3567)
> at org.eclipse.swt.SWT.error(SWT.java:3458)
> at org.eclipse.swt.SWT.error(SWT.java:3429)
> at
> org.eclipse.swt.browser.BrowserFunction.getName(BrowserFunction.java:185)
> at
> org.eclipse.swt.internal.browser.browserkit.BrowserLCA$2.run(BrowserLCA.java:282)
>
> at
> org.eclipse.rwt.lifecycle.ProcessActionRunner.executeNext(ProcessActionRunner.java:57)
>
> at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1132)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1124)
> at nl.rid.gramma.Application.createUI(Application.java:23)
> at
> org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:73)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:211)
>
> at
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:88)
>
> at java.lang.Thread.run(Thread.java:662)
> at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)
>
>
> I don't think it is strange getting an error because the window is
> closed by the browser function. Maybe there is some other trick to make
> it work?
>
> Regards Bertin
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03440 seconds