Java Code Examples for org.eclipse.core.resources.IFile#getResourceAttributes()
The following examples show how to use
org.eclipse.core.resources.IFile#getResourceAttributes() .
These examples are extracted from open source projects.
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 Project: xtext-eclipse File: IntegrationTest.java License: Eclipse Public License 2.0 | 6 votes |
@Test public void testBug342875() throws Exception { IJavaProject project = createJavaProject("foo"); addNature(project.getProject(), XtextProjectHelper.NATURE_ID); IFile file = createFile("foo/src/foo" + F_EXT, "objekt Foo "); ResourceAttributes resourceAttributes = file.getResourceAttributes(); resourceAttributes.setReadOnly(true); file.setResourceAttributes(resourceAttributes); try { build(); assertTrue(file.isReadOnly()); assertEquals(1, countMarkers(file)); } finally { resourceAttributes.setReadOnly(false); file.setResourceAttributes(resourceAttributes); } }
Example 2
Source Project: xtext-eclipse File: XtextProjectCreator.java License: Eclipse Public License 2.0 | 5 votes |
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 3
Source Project: xtext-eclipse File: SingleProjectTest.java License: Eclipse Public License 2.0 | 5 votes |
@Test public void testBug342875() throws Exception { IFile file = createFile("sample/first" + F_EXT, "Hello A"); ResourceAttributes resourceAttributes = file.getResourceAttributes(); resourceAttributes.setReadOnly(true); file.setResourceAttributes(resourceAttributes); try { build(); assertTrue(file.isReadOnly()); assertEquals(1, countMarkers(file)); } finally { resourceAttributes.setReadOnly(false); file.setResourceAttributes(resourceAttributes); } }