Community
Participate
Working Groups
I20120419-1434 - enable enclosing brackets highlighting - have: package xy; public class Try { public static void main(String[] args) { Try t= new Try(); t.foo(); } } - press Ctrl+. to select foo - Ctrl+1, Enter => IAE in log: !ENTRY org.eclipse.text 4 2 2012-04-20 19:33:05.199 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.text". !STACK 0 java.lang.IllegalArgumentException: Index out of bounds at org.eclipse.swt.SWT.error(SWT.java:4342) at org.eclipse.swt.SWT.error(SWT.java:4276) at org.eclipse.swt.SWT.error(SWT.java:4247) at org.eclipse.swt.custom.StyledText.redrawRange(StyledText.java:7465) at org.eclipse.jface.text.source.MatchingCharacterPainter.draw(MatchingCharacterPainter.java:292) at org.eclipse.jface.text.source.MatchingCharacterPainter.handleDrawRequest(MatchingCharacterPainter.java:251) at org.eclipse.jface.text.source.MatchingCharacterPainter.paint(MatchingCharacterPainter.java:397) at org.eclipse.jface.text.source.MatchingCharacterPainter$TextListener.textChanged(MatchingCharacterPainter.java:499) at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2830) at org.eclipse.jface.text.TextViewer$VisibleDocumentListener.documentChanged(TextViewer.java:403) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:769) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:736) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:721) at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:796) at org.eclipse.jface.text.projection.ProjectionDocument.fireDocumentChanged(ProjectionDocument.java:777) at org.eclipse.jface.text.projection.ProjectionDocument.masterDocumentChanged(ProjectionDocument.java:746) at org.eclipse.jface.text.projection.ProjectionDocumentManager.fireDocumentEvent(ProjectionDocumentManager.java:123) at org.eclipse.jface.text.projection.ProjectionDocumentManager.documentChanged(ProjectionDocumentManager.java:131) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:769) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:736) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:721) at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:796) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1191) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace(SynchronizableDocument.java:194) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1210) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace(SynchronizableDocument.java:180) at org.eclipse.text.edits.InsertEdit.performDocumentUpdating(InsertEdit.java:81) at org.eclipse.text.edits.TextEdit.traverseDocumentUpdating(TextEdit.java:917) at org.eclipse.text.edits.TextEdit.traverseDocumentUpdating(TextEdit.java:910) at org.eclipse.text.edits.TextEdit.traverseDocumentUpdating(TextEdit.java:910) at org.eclipse.text.edits.TextEditProcessor.executeDo(TextEditProcessor.java:194) at org.eclipse.text.edits.TextEdit.dispatchPerformEdits(TextEdit.java:739) at org.eclipse.text.edits.TextEditProcessor.performEdits(TextEditProcessor.java:156) at org.eclipse.ltk.core.refactoring.TextChange.performEdits(TextChange.java:277) at org.eclipse.ltk.core.refactoring.TextFileChange.access$0(TextFileChange.java:1) at org.eclipse.ltk.core.refactoring.TextFileChange$1.run(TextFileChange.java:275) at org.eclipse.ui.internal.editors.text.UISynchronizationContext.run(UISynchronizationContext.java:34) at org.eclipse.core.internal.filebuffers.TextFileBufferManager.execute(TextFileBufferManager.java:629) at org.eclipse.ltk.core.refactoring.TextFileChange.performEdits(TextFileChange.java:287) at org.eclipse.ltk.core.refactoring.TextChange.perform(TextChange.java:238) at org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal.performChange(ChangeCorrectionProposal.java:185) at org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposal.performChange(LinkedCorrectionProposal.java:150) at org.eclipse.jdt.ui.text.java.correction.CUCorrectionProposal.apply(CUCorrectionProposal.java:184) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:945) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:891) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:1323) at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:808) at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:491) at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:65) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5932) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5629) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1514) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640) at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2439) at org.eclipse.swt.internal.BidiUtil.windowProc(BidiUtil.java:639) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2545) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
Created attachment 214315 [details] proposed fix I think the solution is not call paint(..) from MatchingCharacterPainter.TextListener.textChanged(TextEvent) when viewerRedrawState is false. This fixes the IAE, and looks reasonable but I am not yet 100% sure of the meaning of org.eclipse.jface.text.TextEvent.getViewerRedrawState().
Created attachment 214349 [details] fix This one should be good. (In reply to comment #1) > I think the solution is not call paint(..) from > MatchingCharacterPainter.TextListener.textChanged(TextEvent) when > viewerRedrawState is false. The idea behind the new patch is the same. > This fixes the IAE, and looks reasonable but I am not yet 100% sure of the > meaning of org.eclipse.jface.text.TextEvent.getViewerRedrawState(). Based on the usage of this method in other places and testing, I think this patch is good. (The last patch did not update enclosing brackets when you folded/unfolded some code.)
Fixed in master: http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=b0dfba155489bb89ceb735d37809b3fa858c2220
Verified in 4.2-I20120429-1800.