use of org.eclipse.core.resources.IProject in project che by eclipse.
the class WorkspaceTest method testProjectNameUsedFromPom.
@Test
public void testProjectNameUsedFromPom() throws Exception {
String pom = "<groupId>test</groupId>" + "<artifactId>testArtifact</artifactId>" + "<version>42</version>" + " <name>testName</name>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.12</version>" + " </dependency>" + "</dependencies>";
createTestProject("test", pom);
IProject test = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
mavenWorkspace.update(Collections.singletonList(test));
mavenWorkspace.waitForUpdate();
MavenProject mavenProject = mavenProjectManager.findMavenProject(test);
String name = mavenProject.getName();
assertThat(name).isNotNull().isNotEmpty().isEqualTo("testName");
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class ClasspathManagerTest method testDownloadSources.
@Test
public void testDownloadSources() throws Exception {
String pom = "<groupId>test</groupId>" + "<artifactId>testArtifact</artifactId>" + "<version>42</version>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.12</version>" + " </dependency>" + "</dependencies>";
createTestProject("test", pom);
IProject test = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
mavenWorkspace.update(Collections.singletonList(test));
mavenWorkspace.waitForUpdate();
boolean downloadSources = classpathManager.downloadSources(test.getFullPath().toOSString(), "org.junit.Test");
assertTrue(downloadSources);
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class Checks method isClasspathDelete.
public static boolean isClasspathDelete(IPackageFragmentRoot pkgRoot) {
IResource res = pkgRoot.getResource();
if (res == null)
return true;
IProject definingProject = res.getProject();
if (res.getParent() != null && pkgRoot.isArchive() && !res.getParent().equals(definingProject))
return true;
IProject occurringProject = pkgRoot.getJavaProject().getProject();
return !definingProject.equals(occurringProject);
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class TextMatchUpdater method updateTextMatches.
private void updateTextMatches(IProgressMonitor pm) throws JavaModelException {
try {
IProject[] projectsInScope = getProjectsInScope();
//$NON-NLS-1$
pm.beginTask("", projectsInScope.length);
for (int i = 0; i < projectsInScope.length; i++) {
if (pm.isCanceled())
throw new OperationCanceledException();
addTextMatches(projectsInScope[i], new SubProgressMonitor(pm, 1));
}
} finally {
pm.done();
}
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class RefactoringModifications method getClasspathFile.
protected IFile getClasspathFile(IResource resource) {
IProject project = resource.getProject();
if (project == null)
return null;
//$NON-NLS-1$
IResource result = project.findMember(".classpath");
if (result instanceof IFile)
return (IFile) result;
return null;
}
Aggregations