Bug 577511 - Multiple Inserts in Document are lost while build is running.
Summary: Multiple Inserts in Document are lost while build is running.
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.22   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.24 M1   Edit
Assignee: Jörg Kubitz CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-29 02:54 EST by Jörg Kubitz CLA
Modified: 2022-03-31 04:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Kubitz CLA 2021-11-29 02:54:33 EST
When typing a single character while build is runnning (or pasting a longer text from clipboard - but only a single time) then after ~ 250ms a progress Windows opens where cancel the user operation is possible.(https://bugs.eclipse.org/bugs/show_bug.cgi?id=546828#c8) After canceling the character (or longer text) is inserted into the document.
It is not nice that it's need to cancel a user Operation while the insert seems to still work - but ok.
But if typing more then a single character within 250ms then one needs to cancel every single of them (ugly) - but all of them are lost.

Reproduce:

1) Put a breakpoint after lock.acquire(); in org.eclipse.core.internal.resources.WorkManager.checkIn(ISchedulingRule, IProgressMonitor) to simulate a longer build.
2) Start Project -> Clean.. -> All projects
3) Open Java file
4) Type "12" fast
5) Cancel user Operation (2x)
6) Type "3", wait 
7) Cancel user Operation (1x)
=> the inserted text is "3". "1" and "2" are lost.
Comment 1 Jörg Kubitz CLA 2022-03-31 03:50:23 EDT
one problem here is that "cancel" button issues a OperationCanceledException which is converted to InterruptedException which is converted to CoreException with(serverity=CANCEL) which is just ignored in org.eclipse.ui.texteditor.AbstractTextEditor.validateState(IEditorInput) and then 
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave(IProgressMonitor) just continues as if validation was successful.
Comment 2 Karsten Thoms CLA 2022-03-31 04:21:17 EDT
Sounds legit.
Comment 3 Jörg Kubitz CLA 2022-03-31 04:23:09 EDT
thanks for review, Karsten