Java Code Examples for org.eclipse.core.resources.ResourceAttributes#setExecutable()

The following examples show how to use org.eclipse.core.resources.ResourceAttributes#setExecutable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XtextProjectCreator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private void addExecutableFlag(IFile file) {
	ResourceAttributes attributes = file.getResourceAttributes();
	if (attributes != null) {
		attributes.setExecutable(true);
		try {
			file.setResourceAttributes(attributes);
		} catch (CoreException e) {
			LOG.warn("Failed to set executable flag for " + file.getFullPath().toOSString(), e);
		}
	}
}
 
Example 2
Source File: TarLeveledStructureProvider.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Returns the resource attributes for this file.
 *
 * @param element the element to get the attributes from
 * @return the attributes of the file
 */
public ResourceAttributes getResourceAttributes(Object element) {
    ResourceAttributes attributes = new ResourceAttributes();
    TarArchiveEntry entry = (TarArchiveEntry) element;
    attributes.setExecutable((entry.getMode() & 0100) != 0);
    attributes.setReadOnly((entry.getMode() & 0200) == 0);
    return attributes;
}