Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345561

Summary: Refactoring with preview fails
Product: [Modeling] TMF Reporter: Carl Wannheden <carl.wannheden>
Component: XtextAssignee: Jan Koehnlein <jan>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jan, tmf.xtext-inbox
Version: 2.0.0Flags: jan: indigo+
Target Milestone: RC1   
Hardware: All   
OS: All   
Whiteboard:

Description Carl Wannheden CLA 2011-05-12 05:45:36 EDT
Refactoring fails with an "Overlapping text edits" error if preview, back was invoked.

Steps to reproduce:
- Start rename refactoring on an element
- Open RenameRefactoringPopup by deselecting element selection (e.g. by placing cursor with mouse or with arrow keys)
- Open Rename Dialog with menu
- Enter New name
- Click Preview
- Click Back
- Click OK or Preview again - boing!
Comment 1 Carl Wannheden CLA 2011-05-12 06:29:47 EDT
Stack trace:
org.eclipse.text.edits.MalformedTreeException: Overlapping text edits
	at org.eclipse.text.edits.TextEdit$InsertionComparator.compare(TextEdit.java:121)
	at java.util.Collections.indexedBinarySearch(Unknown Source)
	at java.util.Collections.binarySearch(Unknown Source)
	at org.eclipse.text.edits.TextEdit.computeInsertionIndex(TextEdit.java:796)
	at org.eclipse.text.edits.TextEdit.internalAdd(TextEdit.java:781)
	at org.eclipse.text.edits.TextEdit.addChild(TextEdit.java:335)
	at org.eclipse.xtext.ui.refactoring.impl.RefactoringUpdateAcceptor.createCompositeChange(RefactoringUpdateAcceptor.java:81)
	at org.eclipse.xtext.ui.refactoring.impl.RenameElementProcessor.createChange(RenameElementProcessor.java:210)
	at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.createChange(ProcessorBasedRefactoring.java:292)
	at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:124)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2310)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 2 Jan Koehnlein CLA 2011-05-12 07:29:44 EDT
The IRefactoringDocumentAcceptor had to be reset on final condition check.

Pushed to master.
Comment 3 Karsten Thoms CLA 2017-09-19 17:58:37 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 18:09:23 EDT
Closing all bugs that were set to RESOLVED before Neon.0