AbstractTextEditor: how to refresh the whole document partition [message #539988] |
Mon, 14 June 2010 10:12  |
Eclipse User |
|
|
|
Hello,
I'm developing a custom AbstractTextEditor using syntax highlighting.
My text is splitted in several partitions. Some partitions directly depends on the line position.
For any user modification, only one partition is recalculated (according modification location). I would like recalculate all the document partitions after any modification.
I thought about two ways to do that:
- implement a custom PresentationReconciler... but I don't know what to override.
- find a way to refresh the document after any user modification.
Thank you for your help.
Best regards,
Philippe
[Updated on: Mon, 14 June 2010 10:21] by Moderator
|
|
|
|
|
|
Re: AbstractTextEditor: how to refresh the whole document partition [message #540308 is a reply to message #540199] |
Tue, 15 June 2010 11:13  |
Eclipse User |
|
|
|
Hello,
I found a solution.
Actually, the main stuff is done before the calls of the methods DefaultDamagerRepairer.getDamagedRegion and PresentationReconciler.createPresentation.
After user modification, the method AbstractDocument.updateDocumentStructure is called. This methods aims to recalculate the Positions (in other words, partitions) of the document according the user modification location.
So, I have created my own Document with the following code:
public static class MyDocument extends Document{
@Override
protected void updateDocumentStructures(DocumentEvent event) {
event.fOffset = 0;
event.fLength = event.fDocument.getLength();
super.updateDocumentStructures(event);
}
}
However, I think that this modification limits the advantages of the damager/repairer use...
Regards,
Philippe
|
|
|
Powered by
FUDForum. Page generated in 0.25540 seconds