use of org.eclipse.core.resources.IProject in project che by eclipse.
the class IndexManager method removeSourceFolderFromIndex.
/**
* Remove the content of the given source folder from the index.
*/
public void removeSourceFolderFromIndex(JavaProject javaProject, IPath sourceFolder, char[][] inclusionPatterns, char[][] exclusionPatterns) {
IProject project = javaProject.getProject();
if (this.jobEnd > this.jobStart) {
// skip it if a job to index the project is already in the queue
IndexRequest request = new IndexAllProject(project, this);
if (isJobWaiting(request))
return;
}
request(new RemoveFolderFromIndex(sourceFolder, inclusionPatterns, exclusionPatterns, project, this));
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class HandleFactory method getPkgFragmentRoot.
/**
* Returns the package fragment root that contains the given resource path.
*/
private PackageFragmentRoot getPkgFragmentRoot(String pathString) {
IPath path = new Path(pathString);
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0, max = projects.length; i < max; i++) {
try {
IProject project = projects[i];
if (!project.isAccessible() || !project.hasNature(JavaCore.NATURE_ID))
continue;
IJavaProject javaProject = this.javaModel.getJavaProject(project);
IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots();
for (int j = 0, rootCount = roots.length; j < rootCount; j++) {
PackageFragmentRoot root = (PackageFragmentRoot) roots[j];
if (root.internalPath().isPrefixOf(path) && !Util.isExcluded(path, root.fullInclusionPatternChars(), root.fullExclusionPatternChars(), false)) {
return root;
}
}
} catch (CoreException e) {
// CoreException from hasNature - should not happen since we check that the project is accessible
// JavaModelException from getPackageFragmentRoots - a problem occured while accessing project: nothing we can do, ignore
}
}
return null;
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class RenameModifications method rename.
public void rename(IJavaProject project, RenameArguments args) {
add(project, args, null);
IProject rProject = project.getProject();
if (rProject != null) {
getResourceModifications().addRename(rProject, args);
IProject[] referencingProjects = rProject.getReferencingProjects();
for (int i = 0; i < referencingProjects.length; i++) {
IFile classpath = getClasspathFile(referencingProjects[i]);
if (classpath != null) {
getResourceModifications().addChanged(classpath);
}
}
}
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class RenameResourceProcessor method createDescriptor.
protected RenameResourceDescriptor createDescriptor() {
IResource resource = getResource();
RenameResourceDescriptor descriptor = new RenameResourceDescriptor();
descriptor.setProject(resource instanceof IProject ? null : resource.getProject().getName());
descriptor.setDescription(Messages.format(RefactoringCoreMessages.RenameResourceProcessor_description, BasicElementLabels.getResourceName(resource)));
descriptor.setComment(Messages.format(RefactoringCoreMessages.RenameResourceProcessor_comment, new String[] { BasicElementLabels.getPathLabel(resource.getFullPath(), false), BasicElementLabels.getResourceName(getNewResourceName()) }));
descriptor.setFlags(RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE | RefactoringDescriptor.BREAKING_CHANGE);
descriptor.setResourcePath(resource.getFullPath());
descriptor.setNewName(getNewResourceName());
descriptor.setUpdateReferences(isUpdateReferences());
return descriptor;
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class ProjectUndoState method createExistentResourceFromHandle.
public void createExistentResourceFromHandle(IResource resource, IProgressMonitor monitor) throws CoreException {
Assert.isLegal(resource instanceof IProject);
if (resource.exists()) {
return;
}
IProject projectHandle = (IProject) resource;
//$NON-NLS-1$
monitor.beginTask("", 200);
monitor.setTaskName(RefactoringCoreMessages.FolderDescription_NewFolderProgress);
if (projectDescription == null) {
projectHandle.create(new SubProgressMonitor(monitor, 100));
} else {
projectHandle.create(projectDescription, new SubProgressMonitor(monitor, 100));
}
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
if (openOnCreate) {
projectHandle.open(IResource.NONE, new SubProgressMonitor(monitor, 100));
}
monitor.done();
}
Aggregations