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

Bug 21635

Summary: Missing functionality in IFile
Product: [Eclipse Project] Platform Reporter: Jed Anderson <jed.anderson>
Component: ResourcesAssignee: DJ Houghton <dj.houghton>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: ---   
Hardware: Other   
OS: other   
Whiteboard:

Description Jed Anderson CLA 2002-07-16 16:33:43 EDT
Build: R2.0

IFile has a setContents method with takes a flags describing special 
instructions for how to perform the delete.  These flags currently include FORCE and 
KEEP_HISTORY.

Bug 20036 describes the importance of using IFile.setContents vs. 
IFile.delete & IFile.create.  Unfortunately, IFile.delete will succeed for a read-only file, 
but IFile.setContents will fail.  This means that 


IFile.delete(...)
IFile.create(...)

has different behaviour for read-only files 
than

IFile.setContents(...)

This feels counter-intuitive.  I believe that in order to 
fix 20036 correctly, we need a flag that would allow programmers to force the setContents to work 
on a read-only file.
Comment 1 Jed Anderson CLA 2002-07-16 17:36:32 EDT
I've thought some more about this, and I am starting to think that we should be calling validate 
edit on read-only files that we are trying to overwrite.  I will talk to John about this, so why don't 
we put it on hold for now.
Comment 2 Jed Anderson CLA 2002-07-17 15:26:38 EDT
After talking about this with John, we've concluded that setContents alone should not work.  What 
needs to happen is that anybody who calls setContents on a read-only file needs to call 
validateEdit beforehand.