use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testGetFileURI.
@Test
public void testGetFileURI() {
final Path file = new Path("/foo/bar/Foo.text");
Assert.assertFalse(this.fs.exists(file));
Assert.assertNotNull(this.fs.toURI(file));
this.fs.setContents(file, "Hello Foo");
Assert.assertTrue(this.fs.exists(file));
this.assertToURI(file, "Hello Foo");
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testGetProjectURI.
@Test
public void testGetProjectURI() {
final Path path = new Path("/foo");
Assert.assertTrue(this.fs.exists(path));
Assert.assertNotNull(this.fs.toURI(path));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class AbstractFileSystemSupport method getPath.
protected Path getPath(final URI absoluteURI, final URI baseURI, final Path basePath) {
Path _xblockexpression = null;
{
URI _xifexpression = null;
if ((baseURI.isPlatformResource() && absoluteURI.isPlatformResource())) {
URI _xifexpression_1 = null;
String _segment = baseURI.segment(1);
String _segment_1 = absoluteURI.segment(1);
boolean _notEquals = (!Objects.equal(_segment, _segment_1));
if (_notEquals) {
URI _xblockexpression_1 = null;
{
String _platformString = absoluteURI.toPlatformString(true);
final org.eclipse.core.runtime.Path p = new org.eclipse.core.runtime.Path(_platformString);
String _string = p.toString();
String _plus = (".." + _string);
_xblockexpression_1 = URI.createURI(_plus);
}
_xifexpression_1 = _xblockexpression_1;
} else {
_xifexpression_1 = absoluteURI.deresolve(baseURI);
}
_xifexpression = _xifexpression_1;
} else {
_xifexpression = absoluteURI.deresolve(baseURI);
}
final URI relativeURI = _xifexpression;
if ((relativeURI.isEmpty() || Objects.equal(relativeURI, absoluteURI))) {
return null;
}
_xblockexpression = basePath.getAbsolutePath(relativeURI.toString());
}
return _xblockexpression;
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class AbstractFileSystemSupport method getChildren.
@Override
public Iterable<? extends Path> getChildren(final Path path) {
boolean _equals = Objects.equal(path, Path.ROOT);
if (_equals) {
Path _absolutePath = path.getAbsolutePath(this.projectConfigProvider.getProjectConfig(this.context).getName());
return Collections.<Path>unmodifiableList(CollectionLiterals.<Path>newArrayList(_absolutePath));
}
final URI uri = this.getURI(path);
if ((((uri == null) || (!this.exists(uri))) || (!(this.isFolder(uri)).booleanValue()))) {
return CollectionLiterals.<Path>emptyList();
}
return this.getChildren(uri, path);
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testModificationStamp_01.
@Test
public void testModificationStamp_01() {
try {
final Path path = new Path("/foo/src/my/pack/Foo.txt");
Assert.assertEquals(0L, this.fs.getLastModification(path));
this.fs.setContents(path, "Hello Foo");
final long mod = this.fs.getLastModification(path);
Assert.assertEquals("Hello Foo", this.fs.getContents(path));
Assert.assertEquals(mod, this.fs.getLastModification(path));
Thread.sleep(1000);
this.fs.setContents(path, "Hello Foo");
Assert.assertEquals(mod, this.fs.getLastModification(path));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations