Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » [swt.widgets.Text] No live update and very slow on Mac OS X(Problem with swt.widgets.Text on Mac OS X)
icon5.gif  [swt.widgets.Text] No live update and very slow on Mac OS X [message #1600493] Wed, 04 February 2015 09:22 Go to next message
Wolfgang Moser is currently offline Wolfgang MoserFriend
Messages: 2
Registered: February 2015
Location: Austria
Junior Member
I created a SWT application which uses a swt.widgets.Text widget as logging window, similar to the console window of eclipse.

The following code is used to append text to the widget:
    public void logAppend(String s)
    {
        if (!logTextField.isDisposed())
        {
                int index = logTextField.getTopIndex();
                logTextField.append(s);

                if (logAutoScrollToEnd)
                    logTextField.setTopIndex(logTextField.getLineCount() - 1);
                else
                    logTextField.setTopIndex(index);
        }
    }


The application is running fine on Windows but I see two problems on Mac OSX:

1. No live update
If a task is adding several hundreds of new lines to the widget, on Mac OS X the widget does not update its content during the task.
The content is only updated when the task has finished.
On Windows I see the messages scrolling upwards as expected.

2. The setTopIndex method is slow as hell
A task which adds approximately 600 new lines to the log window takes some seconds on Windows but minutes on Mac OS X.
Obviously the setTopIndex method is causing the problem. When I don't call this method the speed is comparable to Windows.

Any help would be very much appreciated.

Thanks and best regards,
Wolfgang

(SWT Version 4427)
Re: [swt.widgets.Text] No live update and very slow on Mac OS X [message #1612881 is a reply to message #1600493] Thu, 12 February 2015 09:05 Go to previous messageGo to next message
Wolfgang Moser is currently offline Wolfgang MoserFriend
Messages: 2
Registered: February 2015
Location: Austria
Junior Member
I switched now to the StyledText widget and which does not have these problems.
Re: [swt.widgets.Text] No live update and very slow on Mac OS X [message #1648656 is a reply to message #1600493] Wed, 04 March 2015 01:36 Go to previous messageGo to next message
sam detweiler is currently offline sam detweilerFriend
Messages: 22
Registered: August 2012
Junior Member
I am debugging a similar performance problem, on windows.

the Text window has hundreds of thousands of 'lines'
(think a hour long build output log)..

as the number of lines increases the eclispe ui gets slower and slower and slower,
til it appears hung.

the buffers from the job log are queued up in a background thread, and the UI thread gets run every 10 seconds to push the buffers into the text control..

every update cycle does
(control is enabled, it has auto refresh on I expect)
append() (1 or more times)
append()
append() (one buffer is 37meg)
then
setVisible(true);
setTopIndex(getLineCount()-1);
getParent().layout();

if I comment out the setTopIndex/getTopIndex, no change..
so my theory is that the append is doing a lot of extra stuff under the covers.

is there something I can do to turn off updates while the data gets loaded in?
the control says it holds 2gig. (getTextLimit), and I am nowhere near close (<100meg).

Maybe setRedraw(false)?

the control is created thru FormToolkit.createText().

[Updated on: Wed, 04 March 2015 12:21]

Report message to a moderator

Re: [swt.widgets.Text] No live update and very slow on Mac OS X [message #1651814 is a reply to message #1648656] Thu, 05 March 2015 14:28 Go to previous message
sam detweiler is currently offline sam detweilerFriend
Messages: 22
Registered: August 2012
Junior Member
looks like this is really a design fault on my part..

replaced
fText.getParent().layout();

with
Rectangle f = fText.getClientArea();
fText.redraw(f.x, f.y, f.width, f.height, true);
fText.update();


to just redraw the visible client area

so far performance seems consistent and good.
Previous Topic:Embed SWT Composite into Windows C# application
Next Topic:SWT.Cocoa is performed very slowly after VNC client is disconnected [Mac OS X]
Goto Forum:
  


Current Time: Sat Jan 23 04:31:21 GMT 2021

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

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

Back to the top