use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class AbstractN4JSProjectTest method testGetDependencies_01.
@SuppressWarnings("javadoc")
@Test
public void testGetDependencies_01() {
IN4JSProject project = getN4JSCore().create(myProjectURI);
ImmutableList<? extends IN4JSProject> dependencies = project.getDependencies();
assertEquals(1, dependencies.size());
assertEquals(libProjectURI.lastSegment(), dependencies.get(0).getLocation().lastSegment());
}
use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class AbstractN4JSProjectTest method testGetSourceContainers_01.
@SuppressWarnings("javadoc")
@Test
public void testGetSourceContainers_01() {
IN4JSProject project = getN4JSCore().create(myProjectURI);
ImmutableList<? extends IN4JSSourceContainer> sourceContainers = project.getSourceContainers();
assertEquals(1, sourceContainers.size());
assertEquals("src", sourceContainers.get(0).getRelativeLocation());
}
use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class AbstractN4JSProjectTest method testGetLibraries_01.
@SuppressWarnings("javadoc")
@Test
public void testGetLibraries_01() {
IN4JSProject project = getN4JSCore().create(myProjectURI);
ImmutableList<? extends IN4JSArchive> libraries = project.getLibraries();
assertEquals(1, libraries.size());
assertEquals(archiveFileURI, libraries.get(0).getLocation());
}
use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class TaskGenerateAdoc method getProjects.
private Set<IN4JSProject> getProjects() {
Set<IN4JSProject> projects = new HashSet<>();
for (Object element : selection.toList()) {
if (element instanceof IResource) {
URI uri = URI.createPlatformResourceURI((((IResource) element)).getFullPath().toString(), true);
Optional<? extends IN4JSProject> optProject = n4JSCore.findProject(uri);
IN4JSProject project = optProject.get();
projects.add(project);
}
}
return projects;
}
use of org.eclipse.n4js.projectModel.IN4JSProject in project n4js by eclipse.
the class RepoRelativePath method compute.
/**
* Creates the RepoRelativePath from a given resource. Returns null, if resource is not contained in a repository.
* If a repository is found, the simple name of the origin is used.
*/
public static RepoRelativePath compute(Resource resource, IN4JSCore n4jsCore) {
URI uri = resource.getURI();
Optional<? extends IN4JSProject> optProj = n4jsCore.findProject(uri);
if (!optProj.isPresent()) {
return null;
}
IN4JSProject project = optProj.get();
Path path = project.getLocationPath();
String uriFileString = uri.toString();
String uriProjString = project.getLocation().toString();
String fileRelString = uriFileString.substring(uriProjString.length());
String absFileName = path.toAbsolutePath() + fileRelString;
File file = new File(absFileName);
if (!file.exists()) {
return null;
}
File repoFolder = getRepoFolder(file);
String repoName = getRepoName(repoFolder);
String cloneFolder = repoFolder == null ? "NO_FOLDER" : repoFolder.getName();
String projName = project.getProjectId();
String repoPath = getRepoPath(absFileName, projName, cloneFolder);
String projPath = fileRelString;
if (File.separatorChar != '/') {
projPath = projPath.replace(File.separatorChar, '/');
repoPath = repoPath.replace(File.separatorChar, '/');
}
return new RepoRelativePath(repoName, repoPath, projName, projPath, -1);
}
Aggregations