Java 类org.eclipse.xtext.workspace.FileProjectConfig 实例源码

项目:xtext-extras    文件:CompilationTestHelper.java   
/**
 * creates a fresh resource set with the given resources
 * 
 * @param resources - pairs of file names and their contents 
 * @return a ResourceSet, containing the given resources.
 * @throws IOException if the resource loading fails 
 */
public ResourceSet resourceSet(Pair<String,? extends CharSequence> ...resources ) throws IOException {
    XtextResourceSet result = resourceSetProvider.get();
    result.setClasspathURIContext(classpathUriContext);
    FileProjectConfig projectConfig = new FileProjectConfig(new File(workspaceRoot,PROJECT_NAME), PROJECT_NAME);
    projectConfig.addSourceFolder("src");
    ProjectConfigAdapter.install(result, projectConfig);
    for (Pair<String, ? extends CharSequence> entry : resources) {
        URI uri = copyToWorkspace(getSourceFolderPath()+"/"+entry.getKey(), entry.getValue());
        Resource resource = result.createResource(uri);
        if (resource == null)
            throw new IllegalStateException("Couldn't create resource for URI "+uri+". Resource.Factory not registered?");
        resource.load(newHashMap());
    }
    return result;
}
项目:xtext-core    文件:MultiProjectWorkspaceConfigFactory.java   
@Override
public void findProjects(final WorkspaceConfig workspaceConfig, final URI uri) {
  if ((uri == null)) {
    return;
  }
  String _fileString = uri.toFileString();
  final File baseFile = new File(_fileString);
  boolean _isDirectory = baseFile.isDirectory();
  boolean _not = (!_isDirectory);
  if (_not) {
    return;
  }
  final Function1<File, Boolean> _function = (File it) -> {
    return Boolean.valueOf(it.isDirectory());
  };
  Iterable<File> _filter = IterableExtensions.<File>filter(((Iterable<File>)Conversions.doWrapArray(baseFile.listFiles())), _function);
  for (final File file : _filter) {
    {
      final FileProjectConfig project = new FileProjectConfig(file, workspaceConfig);
      project.addSourceFolder(".");
      workspaceConfig.addProject(project);
    }
  }
}
项目:CARMA    文件:MyCompilationTestHelper.java   
/**
 * creates a fresh resource set with the given resources
 * 
 * @param resources - pairs of file names and their contents 
 * @return a ResourceSet, containing the given resources.
 * @throws IOException if the resource loading fails 
 */
public ResourceSet resourceSet(Pair<String,? extends CharSequence> ...resources ) throws IOException {
    XtextResourceSet result = resourceSetProvider.get();
    result.setClasspathURIContext(classpathUriContext);
    FileProjectConfig projectConfig = new FileProjectConfig(new File(workspaceRoot,PROJECT_NAME), PROJECT_NAME);
    projectConfig.addSourceFolder("src");
    ProjectConfigAdapter.install(result, projectConfig);
    for (Pair<String, ? extends CharSequence> entry : resources) {
        URI uri = copyToWorkspace(getSourceFolderPath()+"/"+entry.getKey(), entry.getValue());
        Resource resource = result.createResource(uri);
        if (resource == null)
            throw new IllegalStateException("Couldn't create resource for URI "+uri+". Resource.Factory not registered?");
        resource.load(newHashMap());
    }
    return result;
}
项目:xtext-core    文件:ProjectWorkspaceConfigFactory.java   
public void findProjects(final WorkspaceConfig workspaceConfig, final URI uri) {
  if ((uri != null)) {
    final FileProjectConfig project = new FileProjectConfig(uri, workspaceConfig);
    project.addSourceFolder(".");
    workspaceConfig.addProject(project);
  }
}
项目:xtext-core    文件:FileSourceFolder.java   
public FileSourceFolder(final FileProjectConfig parent, final String name) {
  super();
  this.parent = parent;
  this.name = name;
}