This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254521

Summary: Undoing / Redoing refactoring does not save currently opened java source
Product: java Reporter: stwr
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description stwr 2015-08-19 19:06:46 UTC
Product Version: NetBeans IDE Dev (Build 201508190002)
Java: 1.8.0_60-ea; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-ea-b25

This issue is related not only to the version above but all previous versions.

Is there any special reason why the currently opened java source (opened in the editor and focused) is not saved automatically after un- and re-doing refactoring?

--Use Case --
1. Open extract.ClassB in the editor
2. Extract some interface out of it
3. Once the new interface source is automatically opened switch back to the ClassB tab
4. Hit 'Undo' and confirm the dialog (ClassB stays unsaved)
5. Save the ClassB
6. Hit 'Redo' and confirm the dialog (ClassB stays unsaved)
7. Save the ClassB
8. Close the ClassB
10. Focus on Projects view context to make the 'Undo' action available
11. Hit 'Undo' and confirm the dialog ((ClassB is saved)

Note that 'Undo' at 4th step leaves the ClassB with erroneous status badge (this behavior has been already reported in bug 253931 and bug 241466).

IMHO the undoing and redoing should behave in the same way when it is executed from different contexts. At least I do not see any logical reason why it should not. What is more it causes different issue, in project-wide java parser I guess.
On the other hand the refactoring keeps all touched java sources saved and this is another reason why the un- and redoing refactoring should do the same.

I used sources from http://services.netbeans.org/synergy/server/api/attachment.php?id=233 in the use case above.