Search in sources :

Example 1 with IN4JSEclipseArchive

use of org.eclipse.n4js.ui.projectModel.IN4JSEclipseArchive in project n4js by eclipse.

the class NfarStorageMapper method collectNfarURIs.

public void collectNfarURIs(IFile nfarArchive, Set<URI> target) {
    URI archiveURI = URI.createPlatformResourceURI(nfarArchive.getFullPath().toString(), true);
    Set<URI> entries = knownEntries.get(archiveURI);
    if (entries != null) {
        target.addAll(entries);
    } else if (nfarArchive.exists()) {
        Optional<? extends IN4JSEclipseProject> projectOpt = eclipseCore.create(nfarArchive.getProject());
        if (projectOpt.isPresent()) {
            IN4JSEclipseProject n4jsProject = projectOpt.get();
            if (n4jsProject.exists()) {
                updateCache(n4jsProject);
            }
            entries = knownEntries.get(archiveURI);
            if (entries != null) {
                target.addAll(entries);
            } else {
                // project exists but archive is not on the project path - we have to scan it nevertheless
                Optional<? extends IN4JSEclipseArchive> archive = eclipseCore.findArchive(archiveURI);
                if (archive.isPresent()) {
                    traverseArchive(archive.get(), target);
                }
            }
        }
    }
}
Also used : IN4JSEclipseProject(org.eclipse.n4js.ui.projectModel.IN4JSEclipseProject) IN4JSEclipseArchive(org.eclipse.n4js.ui.projectModel.IN4JSEclipseArchive) Optional(com.google.common.base.Optional) URI(org.eclipse.emf.common.util.URI)

Example 2 with IN4JSEclipseArchive

use of org.eclipse.n4js.ui.projectModel.IN4JSEclipseArchive in project n4js by eclipse.

the class N4JSEclipseModel method doGetLibraries.

protected ImmutableList<? extends IN4JSEclipseArchive> doGetLibraries(N4JSEclipseProject project, URI location) {
    ImmutableList.Builder<IN4JSEclipseArchive> result = ImmutableList.builder();
    ProjectDescription description = getProjectDescription(location);
    if (description != null) {
        List<ProjectDependency> dependencies = description.getAllProjectDependencies();
        for (ProjectDependency dependency : dependencies) {
            URI dependencyLocation = getInternalWorkspace().getLocation(location, dependency, N4JSSourceContainerType.ARCHIVE);
            if (dependencyLocation != null) {
                IFile archive = workspace.getFile(new Path(dependencyLocation.toPlatformString(true)));
                result.add(getN4JSArchive(project, archive));
            }
        }
    }
    return result.build();
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IN4JSEclipseArchive(org.eclipse.n4js.ui.projectModel.IN4JSEclipseArchive) IFile(org.eclipse.core.resources.IFile) ImmutableList(com.google.common.collect.ImmutableList) ProjectDependency(org.eclipse.n4js.n4mf.ProjectDependency) ProjectDescription(org.eclipse.n4js.n4mf.ProjectDescription) URI(org.eclipse.emf.common.util.URI)

Aggregations

URI (org.eclipse.emf.common.util.URI)2 IN4JSEclipseArchive (org.eclipse.n4js.ui.projectModel.IN4JSEclipseArchive)2 Optional (com.google.common.base.Optional)1 ImmutableList (com.google.common.collect.ImmutableList)1 IFile (org.eclipse.core.resources.IFile)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 ProjectDependency (org.eclipse.n4js.n4mf.ProjectDependency)1 ProjectDescription (org.eclipse.n4js.n4mf.ProjectDescription)1 IN4JSEclipseProject (org.eclipse.n4js.ui.projectModel.IN4JSEclipseProject)1