Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326906 - FileDocumentProvider is not EFS compatible
Summary: FileDocumentProvider is not EFS compatible
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.6   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-04 07:06 EDT by Knut Wannheden CLA
Modified: 2010-10-05 02:11 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Knut Wannheden CLA 2010-10-04 07:06:05 EDT
We have a problem with an editor implemented using FileDocumentProvider. The document's input is a file loaded from an EFS store and when trying to save the resource the document provider comes to the conclusion that the resource does not exist. This decision is based on the result of the method isDeleted():

    public boolean isDeleted(Object element) {

        if (element instanceof IFileEditorInput) {
            IFileEditorInput input= (IFileEditorInput) element;

            IPath path= input.getFile().getLocation();
            if (path == null)
                return true;  // <<<-----

            return !path.toFile().exists();
        }

        return super.isDeleted(element);
    }


Our EFS-stored resource returns null for getLocation(). The workaround is to
let the resource decide whether it exists:

            IPath path= input.getFile().getLocation();
            if (path == null)
                return !input.getFile().exists();

Shouldn't also always the getLocationURI() method be used in Eclipse projects? See http://wiki.eclipse.org/EFS_for_Platform_Committers.
Comment 1 Dani Megert CLA 2010-10-04 09:29:46 EDT
This class has never been updated for EFS and there are no plans to do so. The much more powerful TextFileDocumentProvider should be used which is able to handle EFS.
Comment 2 Knut Wannheden CLA 2010-10-05 02:11:45 EDT
Hi Dani,

Thanks for the clarification. I've added a corresponding ticket to Xtext (bug 326961) where we currently still use the FileDocumentProvider.