Search in sources :

Example 76 with IProject

use of org.eclipse.core.resources.IProject in project che by eclipse.

the class RenameJavaProjectChange method doRename.

@Override
protected void doRename(IProgressMonitor pm) throws CoreException {
    try {
        pm.beginTask(getName(), 2);
        if (fUpdateReferences)
            modifyClassPaths(new SubProgressMonitor(pm, 1));
        IProject project = getProject();
        if (project != null) {
            IProjectDescription description = project.getDescription();
            description.setName(getNewName());
            project.move(description, IResource.FORCE | IResource.SHALLOW, new SubProgressMonitor(pm, 1));
        }
    } finally {
        pm.done();
    }
}
Also used : IProjectDescription(org.eclipse.core.resources.IProjectDescription) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) IProject(org.eclipse.core.resources.IProject)

Example 77 with IProject

use of org.eclipse.core.resources.IProject in project che by eclipse.

the class RefactoringScopeFactory method addReferencingProjects.

/*
	 * Adds to <code> projects </code> IJavaProject objects for all projects directly or indirectly referencing focus. @param projects IJavaProjects will be added to this set
	 */
private static void addReferencingProjects(IJavaProject focus, Set<IJavaProject> projects) throws JavaModelException {
    IProject[] referencingProjects = focus.getProject().getReferencingProjects();
    for (int i = 0; i < referencingProjects.length; i++) {
        IJavaProject candidate = JavaCore.create(referencingProjects[i]);
        if (candidate == null || projects.contains(candidate) || !candidate.exists())
            // break cycle
            continue;
        IClasspathEntry entry = getReferencingClassPathEntry(candidate, focus);
        if (entry != null) {
            projects.add(candidate);
            if (entry.isExported())
                addReferencingProjects(candidate, projects);
        }
    }
}
Also used : IJavaProject(org.eclipse.jdt.core.IJavaProject) IClasspathEntry(org.eclipse.jdt.core.IClasspathEntry) IProject(org.eclipse.core.resources.IProject)

Example 78 with IProject

use of org.eclipse.core.resources.IProject in project che by eclipse.

the class QualifiedNameFinder method createScope.

private static TextSearchScope createScope(String filePatterns, IProject root) {
    HashSet<IProject> res = new HashSet<IProject>();
    res.add(root);
    addReferencingProjects(root, res);
    IResource[] resArr = res.toArray(new IResource[res.size()]);
    Pattern filePattern = getFilePattern(filePatterns);
    return TextSearchScope.newSearchScope(resArr, filePattern, false);
}
Also used : Pattern(java.util.regex.Pattern) IProject(org.eclipse.core.resources.IProject) IResource(org.eclipse.core.resources.IResource) HashSet(java.util.HashSet)

Example 79 with IProject

use of org.eclipse.core.resources.IProject in project generator by mybatis.

the class WorkspaceUtilities method createProject.

private static IProject createProject(String projectName) throws CoreException {
    final IProject project = getWorkspaceRoot().getProject(projectName);
    IWorkspaceRunnable create = new IWorkspaceRunnable() {

        public void run(IProgressMonitor monitor) throws CoreException {
            project.create(null);
            project.open(null);
        }
    };
    getWorkspace().run(create, null);
    return project;
}
Also used : IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IProject(org.eclipse.core.resources.IProject)

Example 80 with IProject

use of org.eclipse.core.resources.IProject in project generator by mybatis.

the class WorkspaceUtilities method addJavaNature.

private static void addJavaNature(String projectName) throws CoreException {
    IProject project = getWorkspaceRoot().getProject(projectName);
    IProjectDescription description = project.getDescription();
    description.setNatureIds(new String[] { JavaCore.NATURE_ID });
    project.setDescription(description, null);
}
Also used : IProjectDescription(org.eclipse.core.resources.IProjectDescription) 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