Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » AbstractDocument.replace() throws AssertionFailedException
AbstractDocument.replace() throws AssertionFailedException [message #1749066] Thu, 01 December 2016 14:30 Go to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hello all,

I want to change text in a editor after a user typed something in. For this purpose I added a ITextListener to my TextEditor.

When calling the replace method of from the ITextListener's textChanged method I get the exception attached below. Is a there a workaround existing so that I can change the text in an editor based on what a user is typing without using the replace method of the IDocument interface?

Best Regards,

Ralph

==========================

org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
at org.eclipse.ui.internal.texteditor.quickdiff.DocumentLineDiffer.handleAboutToBeChanged(DocumentLineDiffer.java:798)
at org.eclipse.ui.internal.texteditor.quickdiff.DocumentLineDiffer.documentAboutToBeChanged(DocumentLineDiffer.java:767)
at org.eclipse.jface.text.AbstractDocument.fireDocumentAboutToBeChanged(AbstractDocument.java:640)
at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1092)
at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1119)
Re: AbstractDocument.replace() throws AssertionFailedException [message #1749106 is a reply to message #1749066] Thu, 01 December 2016 22:02 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

You can't change the contents of a document while it's in the middle of firing a change notification. This sounds like the job of an org.eclipse.jface.text.IAutoEditStrategy .

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: AbstractDocument.replace() throws AssertionFailedException [message #1749126 is a reply to message #1749106] Fri, 02 December 2016 07:46 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

this looks exactly like what I want. For everyone interested, I found this tutorial http://ydtech.blogspot.de/2011/09/eclipse-pde-everything-about-editor_10.html

Thank you!

Ralph
Re: AbstractDocument.replace() throws AssertionFailedException [message #1749672 is a reply to message #1749126] Fri, 09 December 2016 11:21 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

would this work as well?

http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjface%2Ftext%2Flink%2FLinkedModeModel.html

Ralph
Previous Topic:Would it be interesting an Eclipse plugin that allows programmaticaly (not java) to extend Eclipse
Next Topic:Unhandled event loop exception error
Goto Forum:
  


Current Time: Wed Apr 24 14:14:25 GMT 2024

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

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

Back to the top