Bug 342522 - Toggle Refactoring: Undo doesn't delete created file
Summary: Toggle Refactoring: Undo doesn't delete created file
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-12 05:02 EDT by Emanuel Graf CLA
Modified: 2020-09-04 15:27 EDT (History)
3 users (show)

See Also:


Attachments
Minimal project to verify the problem (2.14 KB, application/x-zip-compressed)
2013-04-02 19:37 EDT, Jesse Weinstein CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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).