[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Browser widget on Linux (BUG?)
|
A simpler approach that may work is to asyncExec() it in the main thread
rather than using another thread. This would look like:
browser.addStatusTextListener(new StatusTextListener(){
public void changed(StatusTextEvent event) {
browser.getDisplay().asyncExec(new Runnable() {
public void run() {
if (browser.isDisposed()) return;
browser.execute(script);
}
});
}
});
Grant
"Mohsen Saboorian" <mohsen@xxxxxxxxx> wrote in message
news:gct8pu$ndr$1@xxxxxxxxxxxxxxxxxxxx
> Ricardo,
>
> It's probably a SWT bug
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=87286). There is however a
> workaround, that you seem to know about it...
>
> Here is the tricky (deferred) execute:
>
> public static void trickyExecute(final Display display, final Browser
> browser, final String script) {
> Thread deferThread = new Thread(new Runnable() {
> public void run() {
> display.syncExec(new Runnable() {
> public void run() {
> if (!browser.isDisposed())
> browser.execute(script);
> }
> });
> }
> });
> deferThread.setDaemon(true);
> deferThread.start();
> }
> }
>
> Mohsen.
>
> "Ricardo " <kawase@xxxxxx> wrote in message
> news:cd89e8e98ab9140a2881a79ed8dd17bd$1@xxxxxxxxxxxxxxxxxx
> > May this be a bug?
> >
> > I have an HTML page that shows on the browser widget.
> > on the browser I added a Listener to the get the changes in the
> > StatusText.
> > And everytime there's a change i execute something on the browser again.
> >
> > It works perfect on windows.
> > On linux i noticed that the browser.execute returns true but nothing
> > really happens.
> >
> > OBS: Instead of executing in the listner, if i add the script to some
> > array...
> > and execute it later it works. so it seems that the problem is really in
> > this specific situation.
> >
> > Did anyone have the same problems? Any suggestions?
> > Is it a know bug?
> >
> >
> > thanks
> >
> > browser.addStatusTextListener(new StatusTextListener(){
> > public void changed(StatusTextEvent event) {
> > browser.execute(script);
> >
> >
>
>