/** * Creates a new resource attributes instance with attributes * taken from the specified file in the file system. If the specified * file does not exist or is not accessible, this method has the * same effect as calling the default constructor. * * @param file The file to get attributes from * @return A resource attributes object */ public static ResourceAttributes fromFile(java.io.File file) { try { return FileUtil.fileInfoToAttributes(EFS.getStore(file.toURI()).fetchInfo()); } catch (CoreException e) { //file could not be accessed return new ResourceAttributes(); } }
/** * Creates a new resource attributes instance with attributes * taken from the specified file in the file system. If the specified * file does not exist or is not accessible, this method has the * same effect as calling the default constructor. * * @param file The file to get attributes from * @return A resource attributes object */ public static ResourceAttributes fromFile(java.io.File file) { try { return FileUtil.fileInfoToAttributes(EFS.getStore(file.toURI()).fetchInfo()); } catch (CoreException e) { //file could not be accessed return new ResourceAttributes(); } }
/** * Creates a new resource attributes instance with attributes * taken from the specified file in the file system. If the specified * file does not exist or is not accessible, this method has the * same effect as calling the default constructor. * * @param file The file to get attributes from * @return A resource attributes object */ public static ResourceAttributes fromFile(java.io.File file) { try { return FileUtil.fileInfoToAttributes(EFS.getStore(file.toURI()).fetchInfo()); } catch (CoreException e) { //file could not be accessed return new ResourceAttributes(); } }
/** * Returns the resource attributes for this file. * * @param element * @return the attributes of the file */ public ResourceAttributes getResourceAttributes(Object element) { ResourceAttributes attributes = new ResourceAttributes(); TarEntry entry = (TarEntry) element; attributes.setExecutable((entry.getMode() & 0100) != 0); attributes.setReadOnly((entry.getMode() & 0200) == 0); return attributes; }
/** * Converts an IFileInfo object into a ResourceAttributes object. * @param fileInfo The file info * @return The resource attributes */ public static ResourceAttributes fileInfoToAttributes(IFileInfo fileInfo) { ResourceAttributes attributes = new ResourceAttributes(); attributes.setReadOnly(fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY)); attributes.setArchive(fileInfo.getAttribute(EFS.ATTRIBUTE_ARCHIVE)); attributes.setExecutable(fileInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE)); attributes.setHidden(fileInfo.getAttribute(EFS.ATTRIBUTE_HIDDEN)); attributes.setSymbolicLink(fileInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK)); attributes.set(EFS.ATTRIBUTE_GROUP_READ, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_READ)); attributes.set(EFS.ATTRIBUTE_GROUP_WRITE, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_WRITE)); attributes.set(EFS.ATTRIBUTE_GROUP_EXECUTE, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE)); attributes.set(EFS.ATTRIBUTE_OTHER_READ, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_READ)); attributes.set(EFS.ATTRIBUTE_OTHER_WRITE, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_WRITE)); attributes.set(EFS.ATTRIBUTE_OTHER_EXECUTE, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE)); return attributes; }
/** * Converts an IFileInfo object into a ResourceAttributes object. * @param fileInfo The file info * @return The resource attributes */ public static ResourceAttributes fileInfoToAttributes(IFileInfo fileInfo) { ResourceAttributes attributes = new ResourceAttributes(); attributes.setReadOnly(fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY)); attributes.setArchive(fileInfo.getAttribute(EFS.ATTRIBUTE_ARCHIVE)); attributes.setExecutable(fileInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE)); attributes.setHidden(fileInfo.getAttribute(EFS.ATTRIBUTE_HIDDEN)); attributes.setSymbolicLink(fileInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK)); attributes.set(EFS.ATTRIBUTE_GROUP_READ, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_READ)); attributes.set(EFS.ATTRIBUTE_GROUP_WRITE, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_WRITE)); attributes.set(EFS.ATTRIBUTE_GROUP_EXECUTE, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE)); attributes.set(EFS.ATTRIBUTE_OTHER_READ, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_READ)); attributes.set(EFS.ATTRIBUTE_OTHER_WRITE, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_WRITE)); attributes.set(EFS.ATTRIBUTE_OTHER_EXECUTE, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE)); return attributes; }
/** * Converts an IFileInfo object into a ResourceAttributes object. * @param fileInfo The file info * @return The resource attributes */ public static ResourceAttributes fileInfoToAttributes(IFileInfo fileInfo) { ResourceAttributes attributes = new ResourceAttributes(); attributes.setReadOnly(fileInfo.getAttribute(EFS.ATTRIBUTE_READ_ONLY)); attributes.setArchive(fileInfo.getAttribute(EFS.ATTRIBUTE_ARCHIVE)); attributes.setExecutable(fileInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE)); attributes.setHidden(fileInfo.getAttribute(EFS.ATTRIBUTE_HIDDEN)); attributes.setSymbolicLink(fileInfo.getAttribute(EFS.ATTRIBUTE_SYMLINK)); attributes.set(EFS.ATTRIBUTE_GROUP_READ, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_READ)); attributes.set(EFS.ATTRIBUTE_GROUP_WRITE, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_WRITE)); attributes.set(EFS.ATTRIBUTE_GROUP_EXECUTE, fileInfo.getAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE)); attributes.set(EFS.ATTRIBUTE_OTHER_READ, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_READ)); attributes.set(EFS.ATTRIBUTE_OTHER_WRITE, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_WRITE)); attributes.set(EFS.ATTRIBUTE_OTHER_EXECUTE, fileInfo.getAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE)); return attributes; }