Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Concurrently modifying position in an IDocument
Concurrently modifying position in an IDocument [message #494016] Wed, 28 October 2009 19:21 Go to next message
Mirko Seifert is currently offline Mirko SeifertFriend
Messages: 31
Registered: July 2009
Member
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 15:50 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
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
Previous Topic:differences between browser.setText and browser.setUrl behavior
Next Topic:SWT EVENTS CAPTURING IN LINUX
Goto Forum:
  


Current Time: Tue Apr 16 15:02:48 GMT 2024

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

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

Back to the top