Concurrently modifying position in an IDocument [message #494016] |
Wed, 28 October 2009 15:21  |
Eclipse User |
|
|
|
Hi,
I have a custom TextEditor and I need to modify the positions of the
underlying org.eclipse.jface.text.IDocument concurrently. I use:
....
document.addPositionCategory(category);
org.eclipse.jface.text.Position position = new
org.eclipse.jface.text.Position(offset, length);
document.addPosition(category, position);
This works fine most of the time, but sometimes, when the document is
accessed by other thread I get ConcurrentModificationExceptions. This is
for example the case when the
org.eclipse.jface.text.source.AnnotationRulerColumn redraws itself.
My question is: How can I make sure, that the position are only added at
correct points in time? Can I lock the IDocument somehow? Do I have to
do the changes in a particular thread, so SWT makes sure there is no
other accesses to the list of positions?
I'm working on Galileo.
Thanks in advance.
Mirko
|
|
|
Re: Concurrently modifying position in an IDocument [message #495043 is a reply to message #494016] |
Tue, 03 November 2009 10:50  |
Eclipse User |
|
|
|
You may get more response if you ask this on the eclipse.platform.jface
newsgroup.
Grant
"Mirko Seifert" <mirko.seifert@tu-dresden.de> wrote in message
news:hca5k3$9lm$1@build.eclipse.org...
> Hi,
>
> I have a custom TextEditor and I need to modify the positions of the
> underlying org.eclipse.jface.text.IDocument concurrently. I use:
>
> ...
> document.addPositionCategory(category);
> org.eclipse.jface.text.Position position = new
> org.eclipse.jface.text.Position(offset, length);
> document.addPosition(category, position);
>
> This works fine most of the time, but sometimes, when the document is
> accessed by other thread I get ConcurrentModificationExceptions. This is
> for example the case when the
> org.eclipse.jface.text.source.AnnotationRulerColumn redraws itself.
>
> My question is: How can I make sure, that the position are only added at
> correct points in time? Can I lock the IDocument somehow? Do I have to
> do the changes in a particular thread, so SWT makes sure there is no
> other accesses to the list of positions?
>
> I'm working on Galileo.
>
> Thanks in advance.
>
> Mirko
|
|
|
Powered by
FUDForum. Page generated in 0.04403 seconds