use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class AbstractN4JSProjectTest method testGetDependencies_03.
@SuppressWarnings("javadoc")
@Test
public void testGetDependencies_03() {
IN4JSProject project = getN4JSCore().create(myProjectURI);
ImmutableList<? extends IN4JSProject> first = project.getDependencies();
ImmutableList<? extends IN4JSProject> second = project.getDependencies();
assertEquals(first, second);
}
use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class AbstractN4JSProjectTest method testGetLocation_02.
@SuppressWarnings("javadoc")
@Test
public void testGetLocation_02() {
URI doesNotExist = myProjectURI.trimSegments(1).appendSegment("doesNotExist");
IN4JSProject project = getN4JSCore().create(doesNotExist);
assertEquals(doesNotExist, project.getLocation());
}
use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class N4JSDReader method readN4JSDs.
/**
* Reads all N4JSD files in project, scans for types and links the tests.
*
* @return all types in a mapped with fully qualified type name (inclusive module spec) as key, the type info only
* contains the types, no other information yet.
* @throws InterruptedException
* thrown when user cancels the operation
*/
public Collection<SpecInfo> readN4JSDs(Collection<IN4JSProject> projects, Function<IN4JSProject, ResourceSet> resSetProvider, SubMonitorMsg monitor) throws InterruptedException {
Multimap<String, SpecInfo> specInfoByName = HashMultimap.create();
ResourceSet resSet = null;
SubMonitorMsg sub = monitor.convert(2 * 100 * projects.size());
for (IN4JSProject project : projects) {
if (resSet == null) {
resSet = resSetProvider.apply(project);
}
readScripts(specInfoByName, project, resSet, sub.newChild(100));
}
for (IN4JSProject project : projects) {
if (resSet == null) {
resSet = resSetProvider.apply(project);
}
linkTests(specInfoByName, project, resSet, sub.newChild(100));
}
return specInfoByName.values();
}
use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class ImportsFactory method createNamedImport.
/**
* Creates a new named import of 'name' from 'module'
*/
private ImportDeclaration createNamedImport(String name, IN4JSProject contextProject, TExportableElement te, Adapter nodelessMarker) {
TModule tmodule = te.getContainingModule();
IN4JSProject targetProject = core.findProject(te.eResource().getURI()).orNull();
String moduleQN;
if (targetProject != null && tmodule.getQualifiedName().toString().equals(targetProject.getMainModule())) {
// If the project has a main module, use project import instead.
moduleQN = targetProject.getProjectId();
} else {
// Standard case
moduleQN = te.getContainingModule().getQualifiedName();
}
QualifiedName qn = qualifiedNameConverter.toQualifiedName(moduleQN);
String firstSegment = qn.getFirstSegment();
IN4JSProject project = ImportSpecifierUtil.getDependencyWithID(firstSegment, contextProject);
return createImportDeclaration(qn, name, project, nodelessMarker, this::addNamedImport);
}
use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class ImportsFactory method createNamespaceImport.
/**
* Creates a new default import with name 'name' from object description.
*/
private ImportDeclaration createNamespaceImport(String name, IN4JSProject contextProject, TExportableElement te, Adapter nodelessMarker) {
String moduleQN = te.getContainingModule().getQualifiedName();
QualifiedName qn = qualifiedNameConverter.toQualifiedName(moduleQN);
String firstSegment = qn.getFirstSegment();
IN4JSProject project = ImportSpecifierUtil.getDependencyWithID(firstSegment, contextProject);
if (project == null) {
IN4JSProject projectByNamespace = ImportSpecifierUtil.getDependencyWithID(name, contextProject);
IN4JSProject projectByEObject = core.findProject(te.eResource().getURI()).orNull();
if (projectByNamespace != null && projectByEObject != null && projectByNamespace.getLocation() == projectByEObject.getLocation())
project = projectByNamespace;
}
return createImportDeclaration(qn, name, project, nodelessMarker, this::addNamespaceImport);
}
Aggregations