Search in sources :

Example 1 with OtherFile

use of org.eclipse.n4js.tests.codegen.OtherFile in project n4js by eclipse.

the class XtSetupParser method applyInlinedFileContents.

private static void applyInlinedFileContents(XtWorkspace workspace, Map<String, String> files) {
    if (workspace == null) {
        // nothing to do in this case
        return;
    }
    for (Project prj : workspace.getAllProjects()) {
        for (Folder srcFolder : prj.getSourceFolders()) {
            Iterable<OtherFile> allFiles = Iterables.concat(srcFolder.getModules(), srcFolder.getOtherFiles());
            for (OtherFile file : allFiles) {
                String mName = file.getNameWithExtension();
                if (file.getContents() == null) {
                    if (files.containsKey(mName)) {
                        String contents = files.get(mName);
                        file.setContents(contents);
                    } else {
                        throw new IllegalStateException(ERROR + "File not found: " + mName);
                    }
                }
            }
        }
    }
}
Also used : Project(org.eclipse.n4js.tests.codegen.Project) YarnWorkspaceProject(org.eclipse.n4js.tests.codegen.YarnWorkspaceProject) Folder(org.eclipse.n4js.tests.codegen.Folder) OtherFile(org.eclipse.n4js.tests.codegen.OtherFile)

Aggregations

Folder (org.eclipse.n4js.tests.codegen.Folder)1 OtherFile (org.eclipse.n4js.tests.codegen.OtherFile)1 Project (org.eclipse.n4js.tests.codegen.Project)1 YarnWorkspaceProject (org.eclipse.n4js.tests.codegen.YarnWorkspaceProject)1