use of org.eclipse.core.resources.ResourceAttributes in project eclipse.platform.text by eclipse.
the class FileStoreFileBuffersForWorkspaceFiles method setReadOnly.
/*
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#markReadOnly()
*/
@Override
protected void setReadOnly(boolean state) throws Exception {
IFile file = FileBuffers.getWorkspaceFileAtLocation(getPath());
ResourceAttributes attributes = new ResourceAttributes();
attributes.setReadOnly(state);
file.setResourceAttributes(attributes);
}
use of org.eclipse.core.resources.ResourceAttributes in project polymap4-core by Polymap4.
the class FileUtil method fileInfoToAttributes.
/**
* 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));
return attributes;
}
use of org.eclipse.core.resources.ResourceAttributes in project mdw-designer by CenturyLinkCloud.
the class PluginUtil method setReadOnly.
public static void setReadOnly(IResource resource, boolean readonly) throws CoreException {
ResourceAttributes attributes = resource.getResourceAttributes();
if (attributes == null)
return;
attributes.setReadOnly(readonly);
resource.setResourceAttributes(attributes);
}
use of org.eclipse.core.resources.ResourceAttributes in project tdq-studio-se by Talend.
the class FolderObjFilter method select.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object,
* java.lang.Object)
*/
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof IResource) {
IResource res = (IResource) element;
if (IResource.FOLDER == res.getType()) {
IFolder folder = (IFolder) element;
// MOD mzhao 2010-08-12 14891: use same repository API with TOS to persistent metadata
if (folder.getProjectRelativePath().toString().startsWith(EResourceConstant.METADATA.getPath())) {
String folderName = folder.getName();
if (folderName.equals("bin")) {
// $NON-NLS-1$
return false;
}
if (folderName.equals(EResourceConstant.METADATA.getPath())) {
return true;
} else if (ResourceManager.getConnectionFolder().getFullPath().isPrefixOf(folder.getFullPath())) {
return true;
}
return false;
} else // MOD zshen 2011-1-16 18724: Java UDI enhancements to hide lib folder.
if (folder.getProjectRelativePath().toString().startsWith(EResourceConstant.USER_DEFINED_INDICATORS.getPath()) && (folder.getName().equals("lib"))) {
// $NON-NLS-1$
return false;
}
// ~18724
ResourceAttributes resourceAttributes = folder.getResourceAttributes();
if (resourceAttributes == null) {
return true;
}
if (resourceAttributes.isHidden()) {
return false;
}
} else {
return true;
}
} else if (element instanceof UserDefIndicatorSubFolderRepNode) {
if (EResourceConstant.USER_DEFINED_INDICATORS_LIB.getName().equalsIgnoreCase(((UserDefIndicatorSubFolderRepNode) element).getObject().getLabel())) {
return false;
}
}
return true;
}
use of org.eclipse.core.resources.ResourceAttributes in project eclipse-cs by checkstyle.
the class WriteProtectedFilter method accept.
/**
* {@inheritDoc}
*/
@Override
public boolean accept(Object element) {
boolean goesThrough = true;
if (element instanceof IResource) {
ResourceAttributes attrs = ((IResource) element).getResourceAttributes();
goesThrough = attrs != null && !attrs.isReadOnly();
}
return goesThrough;
}
Aggregations