use of org.eclipse.n4js.projectModel.IN4JSArchive in project n4js by eclipse.
the class N4JSModel method doGetLibraries.
protected ImmutableList<? extends IN4JSArchive> doGetLibraries(N4JSProject project, URI location) {
ImmutableList.Builder<IN4JSArchive> result = ImmutableList.builder();
ProjectDescription description = getProjectDescription(location);
if (description != null) {
description.getAllRequiredRuntimeLibraries().forEach(lib -> addArchiveFromDependency(project, location, lib, result));
description.getAllProjectDependencies().forEach(lib -> addArchiveFromDependency(project, location, lib, result));
}
return result.build();
}
use of org.eclipse.n4js.projectModel.IN4JSArchive in project n4js by eclipse.
the class N4JSProjectsStateHelper method initVisibleHandles.
public List<String> initVisibleHandles(String handle) {
if (handle.startsWith(PROJECT_CONTAINER_PREFIX)) {
// similar to source-container-prefix but we are only interested in the project/archive and
// don't have an actual file of the source-locations.
URI uri = URI.createURI(handle.substring(PROJECT_CONTAINER_PREFIX.length()));
List<String> result = Lists.newArrayList();
// Project.
Optional<? extends IN4JSEclipseProject> containerProjectOpt = core.findProject(uri);
if (containerProjectOpt.isPresent()) {
fullCollectLocationHandles(result, containerProjectOpt.get());
} else {
// archive
Optional<? extends IN4JSArchive> containerArchiveOpt = core.findArchive(uri);
if (containerArchiveOpt.isPresent()) {
// out of archive
IN4JSArchive archive = containerArchiveOpt.get();
fullCollectLocationHandles(result, archive);
} else {
// Nothing found.
return Collections.emptyList();
}
}
return result;
}
URI uri = URI.createURI(handle.substring(SOURCE_CONTAINER_PREFIX.length()));
Optional<? extends IN4JSSourceContainer> containerOpt = core.findN4JSSourceContainer(uri);
List<String> result = Lists.newArrayList();
if (containerOpt.isPresent()) {
IN4JSSourceContainer container = containerOpt.get();
if (container.isLibrary()) {
IN4JSArchive archive = container.getLibrary();
fullCollectLocationHandles(result, archive);
} else {
IN4JSProject project = container.getProject();
fullCollectLocationHandles(result, project);
}
return result;
}
return Collections.emptyList();
}
use of org.eclipse.n4js.projectModel.IN4JSArchive in project n4js by eclipse.
the class AbstractN4JSArchiveTest method testGetArchiveName.
@SuppressWarnings("javadoc")
@Test
public void testGetArchiveName() {
IN4JSArchive archive = getArchive();
assertEquals(archiveProjectId + ".nfar", archive.getFileName());
}
use of org.eclipse.n4js.projectModel.IN4JSArchive in project n4js by eclipse.
the class AbstractN4JSArchiveTest method testGetLibraries.
@SuppressWarnings("javadoc")
@Test
public void testGetLibraries() {
IN4JSArchive archive = getArchive();
archive.getReferencedLibraries();
ImmutableList<? extends IN4JSArchive> dependencies = archive.getReferencedLibraries();
assertEquals(0, dependencies.size());
}
use of org.eclipse.n4js.projectModel.IN4JSArchive in project n4js by eclipse.
the class AbstractN4JSArchiveTest method testGetSourceContainers_01.
@SuppressWarnings("javadoc")
@Test
public void testGetSourceContainers_01() {
IN4JSArchive archive = getArchive();
ImmutableList<? extends IN4JSSourceContainer> sourceContainers = archive.getSourceContainers();
assertEquals(1, sourceContainers.size());
assertTrue(sourceContainers.get(0).isSource());
assertEquals("src", sourceContainers.get(0).getRelativeLocation());
}
Aggregations