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

Bug 342522

Summary: Toggle Refactoring: Undo doesn't delete created file
Product: [Tools] CDT Reporter: Emanuel Graf <emanuel>
Component: cdt-refactoringAssignee: Project Inbox <cdt-refactoring-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: normal    
Priority: P3 CC: cdtdoug, Jesse.Weinstein, yevshif
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Minimal project to verify the problem none

Description Emanuel Graf CLA 2011-04-12 05:02:37 EDT
Undoing after creating the implementation file doesn't delete the implementation file. I don't know much about undoing but it looks like you have to call  ModificationCollector.addFileChange at some point.
Comment 1 Jesse Weinstein CLA 2013-04-02 19:37:56 EDT
Created attachment 229260 [details]
Minimal project to verify the problem

Verified the problem using eclipse.buildId=I20130204-1400 ; org.eclipse.cdt (8.2.0.201302052218) . This is a minimal project that shows the error.
Comment 2 Jesse Weinstein CLA 2013-04-04 13:58:24 EDT
I'm not sure this should be fixed. We don't generally support Undo-ing the creation of files (i.e. if you select New -> Source file, it doesn't generate an Undo entry), so why should we support it here?

Currently, the file is created *before* the refactoring is actually done, which prevents it from using the undo facilities used by the actual refactoring. I looked into moving the file creation into the refactoring itself, but that runs into problems defining the later changes, which rely on the existence of the file. 

So, as long as the file creation is actually a separate step, before the real refactoring, I don't see why it should be treated as different than any other file creation, and therefore, it shouldn't get an Undo entry.

I'd close this as WONTFIX.
Comment 3 Jesse Weinstein CLA 2013-04-04 14:33:59 EDT
Apparently the Java refactorings *do* include file creation within the refactoring itself, so we really ought to do the same. So, no, this shouldn't be closed as WONTFIX. (Per discussion on cdt-dev).