use of org.eclipse.core.filesystem.IFileInfo in project che by eclipse.
the class FileStoreFileBuffer method create.
public void create(IFileStore fileStore, IProgressMonitor monitor) throws CoreException {
IFileInfo info = fileStore.fetchInfo();
fFileStore = fileStore;
if (fLocation == null)
fLocation = URIUtil.toPath(fileStore.toURI());
initializeFileBufferContent(monitor);
if (info.exists())
fSynchronizationStamp = info.getLastModified();
addFileBufferContentListeners();
}
use of org.eclipse.core.filesystem.IFileInfo in project che by eclipse.
the class FileStore method copy.
/**
* The default implementation of {@link IFileStore#copy(IFileStore, int, IProgressMonitor)}.
* This implementation performs a copy by using other primitive methods.
* Subclasses may override this method.
*/
public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
Policy.checkCanceled(monitor);
final IFileInfo sourceInfo = fetchInfo(EFS.NONE, null);
if (sourceInfo.isDirectory())
copyDirectory(sourceInfo, destination, options, monitor);
else
copyFile(sourceInfo, destination, options, monitor);
}
use of org.eclipse.core.filesystem.IFileInfo in project che by eclipse.
the class LocalFile method fetchInfo.
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) {
// if (LocalFileNativesManager.isUsingNatives()) {
// FileInfo info = LocalFileNativesManager.fetchFileInfo(filePath);
// //natives don't set the file name on all platforms
// if (info.getName().length() == 0) {
// String name = file.getName();
// //Bug 294429: make sure that substring baggage is removed
// info.setName(new String(name.toCharArray()));
// }
// return info;
// }
//in-lined non-native implementation
FileInfo info = new FileInfo(file.getName());
final long lastModified = file.lastModified();
if (lastModified <= 0) {
//if the file doesn't exist, all other attributes should be default values
info.setExists(false);
return info;
}
info.setLastModified(lastModified);
info.setExists(true);
info.setLength(file.length());
info.setDirectory(file.isDirectory());
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, file.exists() && !file.canWrite());
info.setAttribute(EFS.ATTRIBUTE_HIDDEN, file.isHidden());
return info;
}
use of org.eclipse.core.filesystem.IFileInfo in project bndtools by bndtools.
the class CreateFileChange method isValid.
@Override
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
RefactoringStatus result = new RefactoringStatus();
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
URI location = file.getLocationURI();
if (location == null) {
result.addFatalError(String.format("The location for file %s is unknown", path));
return result;
}
IFileInfo jFile = EFS.getStore(location).fetchInfo();
if (jFile.exists()) {
result.addFatalError(String.format("File %s already exists", path));
return result;
}
return result;
}
Aggregations