Search in sources :

Example 26 with IProject

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");
}
Also used : MavenProject(org.eclipse.che.plugin.maven.server.core.project.MavenProject) IProject(org.eclipse.core.resources.IProject) Test(org.testng.annotations.Test) MavenServerManagerTest(org.eclipse.che.plugin.maven.server.rmi.MavenServerManagerTest)

Example 27 with IProject

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);
}
Also used : IProject(org.eclipse.core.resources.IProject) Test(org.testng.annotations.Test) MavenServerManagerTest(org.eclipse.che.plugin.maven.server.rmi.MavenServerManagerTest) BaseTest(org.eclipse.che.plugin.maven.server.BaseTest)

Example 28 with IProject

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);
}
Also used : IResource(org.eclipse.core.resources.IResource) IProject(org.eclipse.core.resources.IProject)

Example 29 with IProject

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();
    }
}
Also used : OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) IProject(org.eclipse.core.resources.IProject) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor)

Example 30 with IProject

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;
}
Also used : IFile(org.eclipse.core.resources.IFile) IProject(org.eclipse.core.resources.IProject) IResource(org.eclipse.core.resources.IResource)

Aggregations

IProject (org.eclipse.core.resources.IProject)2658 IFile (org.eclipse.core.resources.IFile)642 CoreException (org.eclipse.core.runtime.CoreException)598 Test (org.junit.Test)483 IPath (org.eclipse.core.runtime.IPath)408 IFolder (org.eclipse.core.resources.IFolder)339 IResource (org.eclipse.core.resources.IResource)305 File (java.io.File)279 ArrayList (java.util.ArrayList)270 Path (org.eclipse.core.runtime.Path)268 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)259 IOException (java.io.IOException)201 IJavaProject (org.eclipse.jdt.core.IJavaProject)193 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)186 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)175 IProjectDescription (org.eclipse.core.resources.IProjectDescription)161 IWorkspace (org.eclipse.core.resources.IWorkspace)138 IStatus (org.eclipse.core.runtime.IStatus)124 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)116 List (java.util.List)109