Search in sources :

Example 6 with ISourceFolder

use of org.eclipse.xtext.workspace.ISourceFolder in project xtext-core by eclipse.

the class SourceFolderCustomImplTest method testCustomSourceFolderImplementation.

/**
 * Asserts that the custom implementation returns not all files of the
 * configured source folder
 */
@Test
public void testCustomSourceFolderImplementation() {
    writeFile("sample.testlang", "MyContent");
    initialize();
    ProjectManager projectManager = workspaceManager.getProjectManager("");
    Set<? extends ISourceFolder> sourceFolders = projectManager.getProjectConfig().getSourceFolders();
    Assert.assertTrue(sourceFolders.size() == 1);
    ISourceFolder sourceFolder = sourceFolders.iterator().next();
    List<URI> allResources = sourceFolder.getAllResources(scanner);
    Assert.assertTrue(allResources.stream().anyMatch((URI uri) -> uri.toString().endsWith("test-data/test-project/")));
    Assert.assertFalse(allResources.stream().anyMatch((URI uri) -> uri.toString().endsWith("test-data/test-project/sample.testlang")));
    Assert.assertEquals(allResources.size(), 1);
}
Also used : ISourceFolder(org.eclipse.xtext.workspace.ISourceFolder) URI(org.eclipse.emf.common.util.URI) ProjectManager(org.eclipse.xtext.ide.server.ProjectManager) Test(org.junit.Test)

Aggregations

ISourceFolder (org.eclipse.xtext.workspace.ISourceFolder)6 URI (org.eclipse.emf.common.util.URI)3 SourceRelativeURI (org.eclipse.xtext.generator.trace.SourceRelativeURI)2 ProjectManager (org.eclipse.xtext.ide.server.ProjectManager)2 Test (org.junit.Test)2 IProject (org.eclipse.core.resources.IProject)1 IClasspathEntry (org.eclipse.jdt.core.IClasspathEntry)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1 AbsoluteURI (org.eclipse.xtext.generator.trace.AbsoluteURI)1 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)1 EclipseSourceFolder (org.eclipse.xtext.ui.workspace.EclipseSourceFolder)1 IProjectConfig (org.eclipse.xtext.workspace.IProjectConfig)1