Bug 186679 - [StyledText] Change StyledTextContent offsets to long
Summary: [StyledText] Change StyledTextContent offsets to long
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2007-05-12 09:32 EDT by Andrew Brampton CLA
Modified: 2017-07-28 11:29 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Brampton CLA 2007-05-12 09:32:13 EDT
My request is to change the offset positions used by StyleTextContent from ints to longs. More details follow:

I started to create a log file viewer using the StyledText component. Since I didn't want to load the full file into memory I'm implementing the StyledTextContent interface.

The StyledTextContent has the following methods:
public int getLineAtOffset(int offset);
public int getOffsetAtLine(int lineIndex);
public String getTextRange(int start, int length);
public void replaceTextRange(int start, int replaceLength, String text);

All of which require an integer offset. Now if I am opening a log file which is greater than 2GB (which most of mine will be) then the integer won't be large enough. Most of the java File IO classes use longs to specify offsets, allowing files up to a 2^63 bytes in size.

So my request is for the StyledTextContent offsets to be changed to longs. This of course is an API change, thus I expect that to be the only resistance to this suggestion. If there are others please make them.

If this enhancement is ok, then I'll be happy to change SWT to support this feature.

thanks
Andrew
Comment 1 Steve Northover CLA 2007-05-12 13:13:11 EDT
Not sure we can make this change without breaking binary compatibility and/or API.
Comment 2 Andrew Brampton CLA 2007-05-15 04:46:00 EDT
(In reply to comment #1)
> Not sure we can make this change without breaking binary compatibility and/or
> API.
> 

I don't know eclipses policies, but other open source projects would make this kind of API change between major revisions. I see 3.3 is coming up, so maybe this change could be made in 3.4?

Thanks
Comment 3 Felipe Heidrich CLA 2007-05-15 11:49:23 EDT
This is not going in for Eclipse 3.3 (we are too close to the release date to try any major change).

Also, before changing this we really need to know what is the impact in performance, will StyledText scale well to handle such huge files ?
Comment 4 Andrew Brampton CLA 2008-07-05 20:43:53 EDT
Its been over a year, and I had honestly forgot about this feature request.

I just thought I'd leave a new comment to see what the current state of things are, and if this can be reconsidered for the next major version of Eclipse.

Felipe mentioned he would like to know if "StyledText scale well to handle such huge files". When I have some free time I will make the required changes so that StyleText uses long offsets, and return some benchmark results.

thanks
Andrew
Comment 5 RealName Mising name CLA 2008-07-25 03:00:32 EDT
I think this would be very useful. Even if we cannot break the API for the moment, additional equivalent methods with long offsets could be added.
The impact on performance will not be affected by the change from int to longs. It is surely related to file length, but if you can deal with a file of 1.9Gbytes, why not with a file of 2.1Gbytes?

Comment 6 Felipe Heidrich CLA 2009-08-21 16:29:38 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 7 Eric Williams CLA 2017-07-28 09:42:21 EDT
No response in awhile, not sure if this bug is still valid. I'll leave it open since it's an enhancement.