return null;
IAdaptable adaptable= (IAdaptable) element;
IFile file= null;
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
ITextFileBuffer fileBuffer= null;
LocationKind locationKind= null;
file= (IFile)adaptable.getAdapter(IFile.class);
if (file != null) {
IPath location= file.getFullPath();
locationKind= LocationKind.IFILE;
manager.connect(location, locationKind,getProgressMonitor());
fileBuffer= manager.getTextFileBuffer(location, locationKind);
} else {
ILocationProvider provider= (ILocationProvider) adaptable.getAdapter(ILocationProvider.class);
if (provider instanceof ILocationProviderExtension) {
URI uri= ((ILocationProviderExtension)provider).getURI(element);
if (ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(uri).length == 0) {
IFileStore fileStore= EFS.getStore(uri);
manager.connectFileStore(fileStore, getProgressMonitor());
fileBuffer= manager.getFileStoreTextFileBuffer(fileStore);
}
}
if (fileBuffer == null && provider != null) {
IPath location= provider.getPath(element);
if (location == null)
return null;
locationKind= LocationKind.NORMALIZE;
manager.connect(location, locationKind, getProgressMonitor());
fileBuffer= manager.getTextFileBuffer(location, locationKind);
file= FileBuffers.getWorkspaceFileAtLocation(location);
}
}
if (fileBuffer != null) {
fileBuffer.requestSynchronizationContext();
FileInfo info= createEmptyFileInfo();
info.fTextFileBuffer= fileBuffer;
info.fTextFileBufferLocationKind= locationKind;
info.fCachedReadOnlyState= isSystemFileReadOnly(info);