use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class PathTest method testPathGetAbsolutePath.
@Test
public void testPathGetAbsolutePath() {
Path _path = new Path("/foo");
Assert.assertEquals(_path, new Path("/foo/bar/baz.txt").getAbsolutePath("../.."));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class PathTest method testAppend.
@Test
public void testAppend() {
Path _path = new Path("/foo/bar");
Assert.assertEquals(_path, new Path("/foo").append("bar"));
Path _path_1 = new Path("/foo/bar");
Assert.assertEquals(_path_1, new Path("/foo").append("/bar"));
Path _path_2 = new Path("foo/bar");
Assert.assertEquals(_path_2, new Path("foo").append("/bar"));
Path _path_3 = new Path("foo");
Assert.assertEquals(_path_3, new Path("foo/bar").append(".."));
Path _path_4 = new Path("foo/file.txt");
Assert.assertEquals(_path_4, new Path("foo/bar").append("../xfoo/../file.txt"));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class PathTest method testRelativizeBothDirections.
@Test
public void testRelativizeBothDirections() {
final Path base = new Path("/hubba/bubba");
final Path child = new Path("/hubba/bubba/bar");
Path _path = new Path("bar");
Assert.assertEquals(_path, base.relativize(child));
Path _path_1 = new Path("bar");
Assert.assertEquals(_path_1, child.relativize(base));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class _TESTDATA_InternalClassProcessor method doGenerateCode.
@Override
public void doGenerateCode(final ClassDeclaration annotatedClass, @Extension final CodeGenerationContext context) {
final Path tF = context.getTargetFolder(annotatedClass.getCompilationUnit().getFilePath());
Path _append = tF.append("/Test.txt");
StringConcatenation _builder = new StringConcatenation();
_builder.append("Hello");
_builder.newLine();
context.setContents(_append, _builder);
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class FileProcessor method doTransform.
@Override
public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) {
final Path path = annotatedClass.getCompilationUnit().getFilePath();
final String contents = context.getContents(context.getProjectFolder(path).append("res/template.txt")).toString();
final String[] segments = contents.trim().split(",");
for (final String segment : segments) {
final Procedure1<MutableFieldDeclaration> _function = (MutableFieldDeclaration it) -> {
it.setType(context.getString());
};
annotatedClass.addField(segment, _function);
}
}
Aggregations