Search in sources :

Example 66 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 67 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 68 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 69 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)

Example 70 with IProject

use of org.eclipse.core.resources.IProject in project jop by jop-devel.

the class JOPUIUtils method setProjectSetting.

public static void setProjectSetting(ILaunchConfiguration configuration, String key, String value) {
    String projectName = getProjectName(configuration);
    if (projectName == null) {
        return;
    }
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    IScopeContext scopeContext = new ProjectScope(project);
    Preferences projectPrefs = scopeContext.getNode(IJOPUIConstants.PLUGIN_ID);
    projectPrefs.put(key, value);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Preferences(org.osgi.service.prefs.Preferences) IProject(org.eclipse.core.resources.IProject)

Aggregations

IProject (org.eclipse.core.resources.IProject)665 CoreException (org.eclipse.core.runtime.CoreException)157 IFile (org.eclipse.core.resources.IFile)142 Test (org.junit.Test)130 IResource (org.eclipse.core.resources.IResource)112 IPath (org.eclipse.core.runtime.IPath)98 IFolder (org.eclipse.core.resources.IFolder)77 File (java.io.File)73 IOException (java.io.IOException)70 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)70 Path (org.eclipse.core.runtime.Path)70 IJavaProject (org.eclipse.jdt.core.IJavaProject)68 ArrayList (java.util.ArrayList)67 IWorkspace (org.eclipse.core.resources.IWorkspace)55 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)48 ByteArrayInputStream (java.io.ByteArrayInputStream)45 ProjectAdapter (org.apache.sling.ide.test.impl.helpers.ProjectAdapter)45 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)41 IProjectDescription (org.eclipse.core.resources.IProjectDescription)38 IStatus (org.eclipse.core.runtime.IStatus)35