Bug 99200 - [implementation][projection] Exception during UNDO
Summary: [implementation][projection] Exception during UNDO
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 236213 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-09 12:57 EDT by Konstantin Scheglov CLA
Modified: 2019-09-06 16:04 EDT (History)
1 user (show)

See Also:


Attachments
Test case (7.07 KB, application/octet-stream)
2005-06-10 00:43 EDT, Konstantin Scheglov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Scheglov CLA 2005-06-09 12:57:57 EDT
Eclipse 3.1 RC1

  I can not provide test case, but this happens when I do several changes using
our SWT/Swing Designer and than undo. Same exception (but with "redo" text)
happens when I undo change and then redo it.
  We listen for buffer change and reparse after undo, so we access buffer and
may be even change it. Can this be source of problem?

org.eclipse.core.commands.ExecutionException: While undoing the operation, an
exception occurred
	at
org.eclipse.core.commands.operations.DefaultOperationHistory.doUndo(DefaultOperationHistory.java:437)
	at
org.eclipse.core.commands.operations.DefaultOperationHistory.undo(DefaultOperationHistory.java:1253)
	at
org.eclipse.ui.operations.UndoActionHandler.runCommand(UndoActionHandler.java:64)
	at
org.eclipse.ui.operations.OperationHistoryActionHandler$4.run(OperationHistoryActionHandler.java:224)
	at
org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:346)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:291)
	at
org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:447)
	at
org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog.access$6(TimeTriggeredProgressMonitorDialog.java:1)
	at
org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog$2.run(TimeTriggeredProgressMonitorDialog.java:201)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog.run(TimeTriggeredProgressMonitorDialog.java:213)
	at
org.eclipse.ui.operations.OperationHistoryActionHandler.run(OperationHistoryActionHandler.java:233)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:182)
	at
org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:108)
	at org.eclipse.core.commands.Command.execute(Command.java:311)
	at
org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:396)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:459)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:781)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:828)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:550)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:493)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:117)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:788)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:868)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:853)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:881)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:877)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1184)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3135)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3038)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3553)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1650)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2560)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1694)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1658)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:366)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:375)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162)
	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:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:2924)
	at org.eclipse.swt.SWT.error(SWT.java:2863)
	at org.eclipse.swt.SWT.error(SWT.java:2834)
	at
org.eclipse.jface.text.DefaultDocumentAdapter.getLineAtOffset(DefaultDocumentAdapter.java:191)
	at org.eclipse.swt.custom.StyledText.internalRedrawRange(StyledText.java:4947)
	at org.eclipse.swt.custom.StyledText.internalSetSelection(StyledText.java:7435)
	at org.eclipse.swt.custom.StyledText.updateSelection(StyledText.java:7939)
	at org.eclipse.swt.custom.StyledText.handleTextChanged(StyledText.java:5338)
	at org.eclipse.swt.custom.StyledText$6.textChanged(StyledText.java:4830)
	at
org.eclipse.jface.text.DefaultDocumentAdapter.fireTextChanged(DefaultDocumentAdapter.java:337)
	at
org.eclipse.jface.text.DefaultDocumentAdapter.documentChanged(DefaultDocumentAdapter.java:281)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:714)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:687)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:672)
	at
org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:749)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1104)
	at
org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument.replace(PartiallySynchronizedDocument.java:111)
	at
org.eclipse.jface.text.DefaultUndoManager$TextCommand.undoTextChange(DefaultUndoManager.java:149)
	at
org.eclipse.jface.text.DefaultUndoManager$TextCommand.undo(DefaultUndoManager.java:209)
	at
org.eclipse.core.commands.operations.DefaultOperationHistory.doUndo(DefaultOperationHistory.java:417)
	... 52 more
Comment 1 Dani Megert CLA 2005-06-09 13:15:09 EDT
There was some IAE in the document adapter of the Java editor. We need more
details steps in order to reproduce / do anything here, e.g. in which way was
the Java editor involved?

Comment 2 Konstantin Scheglov CLA 2005-06-09 15:28:17 EDT
I found reason.
I can reproduce problem when I add component in designer, then undo and redo.
When  I redo, exception happens. 

Designer listens for IBufferChangedListener.bufferChanged event. After undo/redo
or any other external buffer change it reparses source and restores selection.
Problem is in selection. When I don't change selection, all works. But if I
change selection, redo fails.

Is it valid - change selection in bufferChanged listener? Source is already big
enough, so selection points in correct place, but then someone changes it to
incorrect.

  Aha, I found, where this change happens. There is code in
StyledText.updateSelection:

		// move selection to keep same text selected
		internalSetSelection(selection.x + newLength - replacedLength, selection.y -
selection.x, true);

  In my case selection.x is correct selection position that I just set. And
because I do redo (that adds some text), selection now points outside of text!

  Can you fix this? Any workaround?

  Here is full log:


!ENTRY org.eclipse.ui 4 4 2005-06-09 23:11:56.156
!MESSAGE Abnormal Workbench Condition

!ENTRY org.eclipse.ui 4 0 2005-06-09 23:11:56.171
!MESSAGE While redoing the operation, an exception occurred
!STACK 0
org.eclipse.core.commands.ExecutionException: While redoing the operation, an
exception occurred
	at
org.eclipse.core.commands.operations.DefaultOperationHistory.doRedo(DefaultOperationHistory.java:368)
	at
org.eclipse.core.commands.operations.DefaultOperationHistory.redo(DefaultOperationHistory.java:1079)
	at
org.eclipse.ui.operations.RedoActionHandler.runCommand(RedoActionHandler.java:63)
	at
org.eclipse.ui.operations.OperationHistoryActionHandler$4.run(OperationHistoryActionHandler.java:224)
	at
org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:346)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:291)
	at
org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:447)
	at
org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog.access$6(TimeTriggeredProgressMonitorDialog.java:1)
	at
org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog$2.run(TimeTriggeredProgressMonitorDialog.java:201)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog.run(TimeTriggeredProgressMonitorDialog.java:213)
	at
org.eclipse.ui.operations.OperationHistoryActionHandler.run(OperationHistoryActionHandler.java:233)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:182)
	at
org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:108)
	at org.eclipse.core.commands.Command.execute(Command.java:311)
	at
org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:396)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:459)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:781)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:828)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:550)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:493)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:117)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:788)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:868)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:853)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:881)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:877)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1184)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3135)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3038)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3553)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1650)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2560)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1694)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1658)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:366)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:375)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162)
	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:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:2924)
	at org.eclipse.swt.SWT.error(SWT.java:2863)
	at org.eclipse.swt.SWT.error(SWT.java:2834)
	at
org.eclipse.jface.text.DefaultDocumentAdapter.getLineAtOffset(DefaultDocumentAdapter.java:191)
	at org.eclipse.swt.custom.StyledText.internalRedrawRange(StyledText.java:4947)
	at org.eclipse.swt.custom.StyledText.internalSetSelection(StyledText.java:7435)
	at org.eclipse.swt.custom.StyledText.updateSelection(StyledText.java:7939)
	at org.eclipse.swt.custom.StyledText.handleTextChanged(StyledText.java:5338)
	at org.eclipse.swt.custom.StyledText$6.textChanged(StyledText.java:4830)
	at
org.eclipse.jface.text.DefaultDocumentAdapter.fireTextChanged(DefaultDocumentAdapter.java:337)
	at
org.eclipse.jface.text.DefaultDocumentAdapter.documentChanged(DefaultDocumentAdapter.java:281)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:714)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:687)
	at
org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:672)
	at
org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:749)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1104)
	at
org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument.replace(PartiallySynchronizedDocument.java:111)
	at
org.eclipse.jface.text.DefaultUndoManager$TextCommand.redoTextChange(DefaultUndoManager.java:225)
	at
org.eclipse.jface.text.DefaultUndoManager$TextCommand.redo(DefaultUndoManager.java:242)
	at
org.eclipse.core.commands.operations.DefaultOperationHistory.doRedo(DefaultOperationHistory.java:348)
	... 52 more

!ENTRY org.eclipse.ui 4 4 2005-06-09 23:11:56.437
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 2005-06-09 23:11:56.437
!MESSAGE Failed to execute runnable (java.lang.IllegalArgumentException:
Argument not valid)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.IllegalArgumentException: Argument not valid)
	at org.eclipse.swt.SWT.error(SWT.java:2940)
	at org.eclipse.swt.SWT.error(SWT.java:2863)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:121)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2906)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2565)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:809)
	at org.eclipse.jface.window.Window.open(Window.java:787)
	at org.eclipse.jface.dialogs.ErrorDialog.open(ErrorDialog.java:274)
	at org.eclipse.jface.dialogs.ErrorDialog.openError(ErrorDialog.java:338)
	at org.eclipse.jface.dialogs.ErrorDialog.openError(ErrorDialog.java:303)
	at
org.eclipse.ui.operations.OperationHistoryActionHandler.reportException(OperationHistoryActionHandler.java:367)
	at
org.eclipse.ui.operations.OperationHistoryActionHandler.run(OperationHistoryActionHandler.java:235)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:182)
	at
org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:108)
	at org.eclipse.core.commands.Command.execute(Command.java:311)
	at
org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:396)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:459)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:781)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:828)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:550)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:493)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:117)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:788)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:868)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:853)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:881)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:877)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1184)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3135)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3038)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3553)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1650)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2560)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1694)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1658)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:366)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:375)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162)
	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:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:2924)
	at org.eclipse.swt.SWT.error(SWT.java:2863)
	at org.eclipse.swt.SWT.error(SWT.java:2834)
	at
org.eclipse.jface.text.DefaultDocumentAdapter.getLineAtOffset(DefaultDocumentAdapter.java:191)
	at org.eclipse.swt.custom.StyledText.getCaretLine(StyledText.java:4632)
	at org.eclipse.swt.custom.StyledText.setCaretLocation(StyledText.java:6784)
	at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:6444)
	at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4208)
	at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4287)
	at
org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlightingPresenter.updatePresentation(SemanticHighlightingPresenter.java:434)
	at
org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlightingPresenter$1.run(SemanticHighlightingPresenter.java:347)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:118)
	... 50 more
Comment 3 Dani Megert CLA 2005-06-09 16:03:15 EDT
>Can you fix this?
Can we fix what? Please first answer the questions from comment 1 i.e. steps
that we can follow to reproduce? How's the Java editor involved here?...
Comment 4 Konstantin Scheglov CLA 2005-06-10 00:43:59 EDT
Created attachment 22781 [details]
Test case

Open Java file using "Selection Test Java Editor" from this plugin. Insert any
character, for example new line. Plugin will try to set selection at last
character of editor. It will also print buffer length and new selection
position to show, that they are valid. However you will see exception in log.
Comment 5 Dani Megert CLA 2007-06-22 09:59:24 EDT
Get rid of deprecated state.
Comment 6 Dani Megert CLA 2007-06-22 10:04:37 EDT
.
Comment 7 Dani Megert CLA 2008-06-17 09:59:24 EDT
Reopening as test case still fails.
Comment 8 Dani Megert CLA 2008-06-17 09:59:49 EDT
*** Bug 236213 has been marked as a duplicate of this bug. ***
Comment 9 Dani Megert CLA 2008-06-17 10:07:04 EDT
I'm sorry this somehow got forgotten. It looks like two different problems here, one which appears immediately when not using folding and one which lies in the interaction between projection and master document.

Since you want to update the UI, a possible workaround would be to use a different listener. In your case you could use ITextViewer.addTextListener(ITextListener).
Comment 10 Konstantin Scheglov CLA 2008-06-17 19:24:08 EDT
Thank you for answer, now I have workaround.

ITextViewer.addTextListener(ITextListener) has one drawback - it is executed before UndoManager (something like this), that resets selection to highlight region where undo was done. To solve this I delay my selection using Display.asyncExec() - here also one trick - to avoid flashing I have to disable redraw in listener and enable in async runnable.

Display.asyncExec() helps even with IBufferChangedListener.

In Designer I still will listen IBuffer, because at that place I don't know about text editor, I just work with ICompilationUnit. 
Comment 11 Dani Megert CLA 2008-06-18 03:35:44 EDT
The asyncExec reduces the problem but it can still happen, e.g. if the user edits the file in the editor before the async code is executed. I don't know how important it is that the (UI) code of that listener is always executed. If it is OK to ignore it sometimes then one solution might be to simply protect your existing code against the IAE and do nothing (or fallback). We do the same in our hovers: we compute in another thread and hence ignore IAEs there.
Comment 12 Konstantin Scheglov CLA 2008-06-18 03:44:20 EDT
In my case I don't think that user will have much chances to do something, because async will be executed directly after finishing UNDO command processing. Separate thread in this respect is more dangerous, because may finish pre-processing in any time in futre, when really something may be already changed. But you are right - some guard code will not hurt. 

Thanks!
Comment 13 Dani Megert CLA 2008-06-20 10:57:52 EDT
The fix for this is rather sophisticated as it drastically changes some of the notification scenarios. Since it's really early in the release we have enough time to see how it turns out.

Available in builds > N20080619-2000.
Comment 14 Konstantin Scheglov CLA 2008-06-20 11:41:51 EDT
Thank you!
Comment 15 Dani Megert CLA 2008-11-20 10:39:25 EST
Sorry Constantin, I have to revert the fix. First, it still causes exceptions with your example:

1. paste:
/*
* Fox
*/
public class Try {
}
2. open with your editor from comment 4
3. select all
4. press the 'Delete' key

Second, it causes the partitioning to leak behind and hence causing bugs like bug 255625.
Comment 16 Eclipse Webmaster CLA 2019-09-06 16:04:57 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.