Community
Participate
Working Groups
Build ID: M20070212-1330 In our custom text editor (subclass of org.eclipse.ui.editors.text.TextEditor) when I delete characters at the very end of the document (also a custom document, but a subclass of org.eclipse.jface.text.Document) a BadLocationException exception is thrown at org.eclipse.jface.text.AbstractDocument line 1295 (computePartitioning method). The BadLocationException is thrown because the offset + length is greater than the document's length. The thing is, that the values for the offset and length came from a DirtyRegion created by the org.eclipse.jface.text.reconciler.AbstractReconciler#createDirtyRegion() method (line 515). It seems that the two are not compatible. The exception is caught gracefully enough (in org.eclipse.jface.text.reconciler.Reconciler#computePartitioning, line 215) to return an empty array of TypedRegions, but unfortunately it breaks some functionality in our editor. We need the reconciler to reconcile the change. Now the other thing that is weird to me, is that we have a custom partitioner for our editor, and it returns a region from the documentChanged2() method, but that region does not seem to be used by anyone (it gets returned to the AbstractDocument#updateDocumentStructures() method where it is assigned to an instance variable, from there it is accessed in the AbstractDocument#doFireDocumentChanged(DocumentEvent) method, passed to the AbstractDocument#doFireDocumentChanged(DocumentEvent, boolean, IRegion) method only to be discarded/ignored). So, to make a long story a little longer, no reconciliation seems to happen when deletions are made at the end of a document.
We use all those classes together in the Java editor with no problems. Please either submit a test case or an example plug-in that shows the problem and then let's us verify the fix. No work planned until we have that. Also, please check whether it works using 3.3 RC4.
Get rid of deprecated state.
.