use of org.eclipse.n4js.external.N4JSExternalProject in project n4js by eclipse.
the class ExternalProjectProvider method getProjectsDescriptions.
Collection<ProjectDescription> getProjectsDescriptions(java.net.URI rootLocation) {
ensureInitialized();
File rootFolder = new File(rootLocation);
Set<ProjectDescription> projectsMapping = newHashSet();
URI rootUri = URI.createFileURI(rootFolder.getAbsolutePath());
for (Entry<URI, Optional<Pair<N4JSExternalProject, ProjectDescription>>> entry : projectCache.asMap().entrySet()) {
URI projectLocation = entry.getKey();
if (rootUri.equals(projectLocation.trimSegments(1))) {
Pair<N4JSExternalProject, ProjectDescription> pair = entry.getValue().orNull();
if (null != pair && null != pair.getFirst()) {
ProjectDescription description = pair.getSecond();
if (description != null) {
projectsMapping.add(description);
}
}
}
}
return unmodifiableCollection(projectsMapping);
}
use of org.eclipse.n4js.external.N4JSExternalProject in project n4js by eclipse.
the class ExternalProjectProvider method getProjectsIn.
Collection<N4JSExternalProject> getProjectsIn(java.net.URI rootLocation) {
ensureInitialized();
File rootFolder = new File(rootLocation);
Map<String, N4JSExternalProject> projectsMapping = newTreeMap();
URI rootUri = URI.createFileURI(rootFolder.getAbsolutePath());
for (Entry<URI, Optional<Pair<N4JSExternalProject, ProjectDescription>>> entry : projectCache.asMap().entrySet()) {
URI projectLocation = entry.getKey();
if (rootUri.equals(projectLocation.trimSegments(1))) {
Pair<N4JSExternalProject, ProjectDescription> pair = entry.getValue().orNull();
if (null != pair && null != pair.getFirst()) {
N4JSExternalProject project = pair.getFirst();
projectsMapping.put(project.getName(), project);
}
}
}
return unmodifiableCollection(projectsMapping.values());
}
use of org.eclipse.n4js.external.N4JSExternalProject in project n4js by eclipse.
the class ExternalIndexUpdater method cleanRemovedLocations.
/**
* Removes projects from Index that were in a removed location
*/
private void cleanRemovedLocations(Set<URI> removedLocations, IProgressMonitor monitor) {
Collection<N4JSExternalProject> removedProjects = externalWorkspace.getProjectsIn(removedLocations);
SubMonitor subMonitor = convert(monitor, 3);
// Clean removed projects from Index
builder.clean(removedProjects, subMonitor.newChild(1));
subMonitor.worked(1);
// Remember affected workspace and external projects
extProjectsDependingOnRemovedProjects = collector.getExtProjectsDependendingOn(removedProjects);
extProjectsDependingOnRemovedProjects.removeAll(removedProjects);
subMonitor.worked(1);
wsProjectsDependingOnRemovedProjects = collector.getWSProjectsDependendingOn(removedProjects);
wsProjectsDependingOnRemovedProjects.removeAll(removedProjects);
subMonitor.worked(1);
}
use of org.eclipse.n4js.external.N4JSExternalProject in project n4js by eclipse.
the class ExternalProjectCacheLoader method load.
@Override
public Optional<Pair<N4JSExternalProject, ProjectDescription>> load(final URI rootLocation) throws Exception {
ProjectDescription projectDescription = packageManager.loadManifestFromProjectRoot(rootLocation);
if (null != projectDescription) {
File projectRoot = new File(rootLocation.toFileString());
ExternalProject p = new ExternalProject(projectRoot, NATURE_ID, BUILDER_ID);
IN4JSProject pp = new N4JSEclipseProject(p, rootLocation, model);
N4JSExternalProject ppp = new N4JSExternalProject(projectRoot, pp);
return Optional.of(Tuples.create(ppp, projectDescription));
}
return Optional.absent();
}
use of org.eclipse.n4js.external.N4JSExternalProject in project n4js by eclipse.
the class EclipseExternalLibraryWorkspace method getLocation.
@Override
public URI getLocation(URI projectURI, ProjectReference reference, N4JSSourceContainerType expectedN4JSSourceContainerType) {
if (PROJECT.equals(expectedN4JSSourceContainerType)) {
String name = reference.getProject().getProjectId();
ExternalProject project = projectProvider.getProject(name);
if (null == project) {
return null;
}
File referencedProject = new File(project.getLocationURI());
URI refLocation = URI.createFileURI(referencedProject.getAbsolutePath());
Pair<N4JSExternalProject, ProjectDescription> pair = projectProvider.getProjectWithDescription(refLocation);
if (null != pair) {
return refLocation;
}
}
return null;
}
Aggregations