Summary: | Copying a compilation unit onto itself destroys compilation unit | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Kai-Uwe Maetzel <kai-uwe_maetzel> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | major | ||
Priority: | P1 | ||
Version: | 2.0 | ||
Target Milestone: | 2.0 M3 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 8873 |
Description
Kai-Uwe Maetzel
2002-02-09 10:50:36 EST
Problem identified. When resolving single names, we did set the depth incorrectly (during each iteration of the loop through enclosing scopes) instead of when returning the found file only. Fixed, regression test added (will go into next integration build). Oops, comment went to wrong bug report, ignore my previous post. You localized the error. But what do we want to do? Failed with a NAME_COLISION. What I don't like is that the UI is checking if the file already exists and the JavaModelOperation does the same thing. If the user said that he wants the file to be overriden, we should save the new contents. We can silently handle this case by saving the new contents. Then I don't understand what this code is doing in CompilationUnitEditor.performSaveAs: /* * 1GF5YOX: ITPJUI:ALL - Save of delete file claims it's still there * Changed false to true. */ getDocumentProvider().saveDocument(monitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); I think this is the responsability of the java model operation to update the contents of the file if necessary. Any comment? I changed the code to simply set the contents of the existing file to the new contents in case you do a saveas on the same file. There is no mode added deltas propagated after this operation. If you are not in a mode you want to override the existing file, I throw a NAME_COLISION error. Is this behavior acceptable for you? If yes, I will release it for the next build (tomorrow's build if you reply quickly). Fixed and released in HEAD. Hopefully this will be the behavior you expected. |