當前位置: 首頁>>代碼示例>>Java>>正文


Java EFS.ATTRIBUTE_READ_ONLY屬性代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:22,代碼來源:FileInfo.java

示例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);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:8,代碼來源:FileInfo.java

示例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;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:10,代碼來源:VirtualFileSystem.java

示例4: attributes

private static int attributes(File aFile) {
  if (!aFile.exists() || aFile.canWrite()) return EFS.NONE;
  return EFS.ATTRIBUTE_READ_ONLY;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:4,代碼來源:LocalFile.java

示例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);
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:15,代碼來源:LocalFile.java

示例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;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:13,代碼來源:ResourceAttributes.java


注:本文中的org.eclipse.core.filesystem.EFS.ATTRIBUTE_READ_ONLY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。