本文整理汇总了Java中org.eclipse.core.filesystem.EFS.ATTRIBUTE_READ_ONLY属性的典型用法代码示例。如果您正苦于以下问题:Java EFS.ATTRIBUTE_READ_ONLY属性的具体用法?Java EFS.ATTRIBUTE_READ_ONLY怎么用?Java EFS.ATTRIBUTE_READ_ONLY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.core.filesystem.EFS
的用法示例。
在下文中一共展示了EFS.ATTRIBUTE_READ_ONLY属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttribute
public void setAttribute(int attribute, boolean value) {
if (attribute == EFS.ATTRIBUTE_READ_ONLY && isAttributeSuported(EFS.ATTRIBUTE_OWNER_WRITE)) {
if (value) {
clear(EFS.ATTRIBUTE_OWNER_WRITE | EFS.ATTRIBUTE_OTHER_WRITE | EFS.ATTRIBUTE_GROUP_WRITE);
set(EFS.ATTRIBUTE_IMMUTABLE);
} else {
set(EFS.ATTRIBUTE_OWNER_WRITE | EFS.ATTRIBUTE_OWNER_READ);
clear(EFS.ATTRIBUTE_IMMUTABLE);
}
} else if (attribute == EFS.ATTRIBUTE_EXECUTABLE
&& isAttributeSuported(EFS.ATTRIBUTE_OWNER_EXECUTE)) {
if (value) set(EFS.ATTRIBUTE_OWNER_EXECUTE);
else
clear(
EFS.ATTRIBUTE_OWNER_EXECUTE
| EFS.ATTRIBUTE_GROUP_EXECUTE
| EFS.ATTRIBUTE_OTHER_EXECUTE);
} else {
if (value) set(attribute);
else clear(attribute);
}
}
示例2: getAttribute
public boolean getAttribute(int attribute) {
if (attribute == EFS.ATTRIBUTE_READ_ONLY && isAttributeSuported(EFS.ATTRIBUTE_OWNER_WRITE))
return (!isSet(EFS.ATTRIBUTE_OWNER_WRITE)) || isSet(EFS.ATTRIBUTE_IMMUTABLE);
else if (attribute == EFS.ATTRIBUTE_EXECUTABLE
&& isAttributeSuported(EFS.ATTRIBUTE_OWNER_EXECUTE))
return isSet(EFS.ATTRIBUTE_OWNER_EXECUTE);
else return isSet(attribute);
}
示例3: attributes
@Override
public int attributes() {
if (attributes != -1)
return attributes;
attributes = 0;
attributes |= EFS.ATTRIBUTE_READ_ONLY;
attributes |= EFS.ATTRIBUTE_EXECUTABLE;
attributes |= EFS.ATTRIBUTE_SYMLINK | EFS.ATTRIBUTE_LINK_TARGET;
return attributes;
}
示例4: attributes
private static int attributes(File aFile) {
if (!aFile.exists() || aFile.canWrite()) return EFS.NONE;
return EFS.ATTRIBUTE_READ_ONLY;
}
示例5: checkReadOnlyParent
/**
* This method is called after a failure to modify a file or directory. Check to see if the parent
* is read-only and if so then throw an exception with a more specific message and error code.
*
* @param target The file that we failed to modify
* @param exception The low level exception that occurred, or <code>null</code>
* @throws CoreException A more specific exception if the parent is read-only
*/
private void checkReadOnlyParent(File target, Throwable exception) throws CoreException {
File parent = target.getParentFile();
if (parent != null && (attributes(parent) & EFS.ATTRIBUTE_READ_ONLY) != 0) {
String message = NLS.bind(Messages.readOnlyParent, target.getAbsolutePath());
Policy.error(EFS.ERROR_PARENT_READ_ONLY, message, exception);
}
}
示例6: isReadOnly
/**
* Returns whether this ResourceAttributes object is marked read only.
*
* <p>This attribute is used only on file systems supporting {@link EFS#ATTRIBUTE_READ_ONLY}.
*
* @return <code>true</code> if this resource is marked as read only, <code>false</code> otherwise
* @see #setReadOnly(boolean)
* @see IFileSystem#attributes()
* @see EFS#ATTRIBUTE_READ_ONLY
*/
public boolean isReadOnly() {
return (attributes & EFS.ATTRIBUTE_READ_ONLY) != 0;
}