use of org.eclipse.core.resources.ResourceAttributes in project che by eclipse.
the class Resources method setReadOnly.
static void setReadOnly(IResource resource, boolean readOnly) {
ResourceAttributes resourceAttributes = resource.getResourceAttributes();
if (// not supported on this platform for this resource
resourceAttributes == null)
return;
resourceAttributes.setReadOnly(readOnly);
try {
resource.setResourceAttributes(resourceAttributes);
} catch (CoreException e) {
RefactoringCorePlugin.log(e);
}
}
use of org.eclipse.core.resources.ResourceAttributes in project che by eclipse.
the class DocumentAdapter method isReadOnly.
/*
* @see IBuffer#isReadOnly()
*/
public boolean isReadOnly() {
// if (fTextFileBuffer != null)
// return !fTextFileBuffer.isCommitable();
IResource resource = getUnderlyingResource();
if (resource == null)
return true;
final ResourceAttributes attributes = resource.getResourceAttributes();
return attributes == null ? false : attributes.isReadOnly();
}
use of org.eclipse.core.resources.ResourceAttributes in project che by eclipse.
the class Checks method isReadOnly.
public static boolean isReadOnly(IResource res) throws JavaModelException {
ResourceAttributes attributes = res.getResourceAttributes();
if (attributes != null && attributes.isReadOnly())
return true;
if (!(res instanceof IContainer))
return false;
IContainer container = (IContainer) res;
try {
IResource[] children = container.members();
for (int i = 0; i < children.length; i++) {
if (isReadOnly(children[i]))
return true;
}
return false;
} catch (JavaModelException e) {
throw e;
} catch (CoreException e) {
throw new JavaModelException(e);
}
}
use of org.eclipse.core.resources.ResourceAttributes in project che by eclipse.
the class Resources method setReadOnly.
static void setReadOnly(IResource resource, boolean readOnly) {
ResourceAttributes resourceAttributes = resource.getResourceAttributes();
if (// not supported on this platform for this resource
resourceAttributes == null)
return;
resourceAttributes.setReadOnly(readOnly);
try {
resource.setResourceAttributes(resourceAttributes);
} catch (CoreException e) {
JavaPlugin.log(e);
}
}
use of org.eclipse.core.resources.ResourceAttributes in project eclipse.platform.text by eclipse.
the class FileBuffersForWorkspaceFiles 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);
}
Aggregations