Bug 26379 - Editor should not use LineBackgroundListener to set widget background color
Summary: Editor should not use LineBackgroundListener to set widget background color
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2002-11-14 12:50 EST by Knut Radloff CLA
Modified: 2005-04-25 08:51 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Knut Radloff CLA 2002-11-14 12:50:16 EST
build 20021114

The Java editor is using a LineBackgroundListener to set the regular widget 
background color. Each reveal of the editor results in one call to the listener 
for each visible line. This is wasting cycles.
The editor should use setBackground to set the widget background color. The 
line background listener should be used exclusively for things like the line 
highlight.

The plain text editor does not actually provide a line color but it still hooks 
a LineBackgroundListener and therefore uneccessary callbacks are made.
Comment 1 Kai-Uwe Maetzel CLA 2002-12-10 14:03:57 EST
How do you see this behavior? The line background listener is only registered 
when a find/replace action is active.
Comment 2 Knut Radloff CLA 2002-12-10 14:51:05 EST
I thinnk I put a System.out.println in StyledText.sendLineEvent and checked for 
LineGetBackground. I must have debugged this, too, since I noted different 
behavior in the Java editor vs. plain text editor.
Comment 3 Tod Creasey CLA 2005-03-07 11:57:18 EST
Adding my name to the cc list as we are now tracking performance issues more
closely. Please remove the performance keyword if this is not a performance bug.
Comment 4 Mike Wilson CLA 2005-04-21 11:52:28 EDT
What is the status of this?
Comment 5 Dani Megert CLA 2005-04-22 10:26:50 EDT
We use the LineBackgroundListener for two reasons:
- Find/Replace as mentioned in comment 1
- highlight the current line

We don't use it to set the widget's background color.

StyledText sends this event out for every visible line when the widget gets
activated. There's not much we can do about this didn't show up in any of our
performance traces so far.
Comment 6 Mike Wilson CLA 2005-04-22 14:41:44 EDT
Is the StyledText behavior (i.e. send it for every visible line on activate) actually required? If not, and the 
changes are reasonable, it should be removed even if the performance hit isn't enough to be seen. (As 
you make everything else faster, you'll notice it eventually)
Comment 7 Dani Megert CLA 2005-04-24 10:42:01 EDT
Steve, can you or someone from the SWT team answer Mike's last question?
Comment 8 Steve Northover CLA 2005-04-25 08:16:14 EDT
Adding Felipe because he owns StyledText.
Comment 9 Steve Northover CLA 2005-04-25 08:19:08 EDT
>>StyledText sends this event out for every visible line when the widget
>>gets activated. There's not much we can do about this didn't show up
>>in any of our performance traces so far.

This sounds right.  The listener allows you to color a line at a time and 
can't know that you won't color a line.  Felipe?
Comment 10 Mike Wilson CLA 2005-04-25 08:51:40 EDT
Ah... I get it. The *event* is sent out, but no background painting is done in the current code. Sorry for 
being dense.