本文整理匯總了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;
}