use of org.eclipse.core.resources.IResource in project che by eclipse.
the class ReorgUtils method isParentInWorkspaceOrOnDisk.
public static boolean isParentInWorkspaceOrOnDisk(IPackageFragmentRoot root, IJavaProject javaProject) {
if (root == null)
return false;
IJavaElement rootParent = root.getParent();
if (rootParent == null)
return false;
if (rootParent.equals(root))
return true;
IResource packageResource = ResourceUtil.getResource(root);
IResource packageRootResource = ResourceUtil.getResource(javaProject);
return isParentInWorkspaceOrOnDisk(packageResource, packageRootResource);
}
use of org.eclipse.core.resources.IResource in project che by eclipse.
the class ReorgUtils method containsElementOrParent.
public static boolean containsElementOrParent(Set<IAdaptable> elements, IResource element) {
IResource curr = element;
do {
if (elements.contains(curr))
return true;
IJavaElement jElement = JavaCore.create(curr);
if (jElement != null && jElement.exists()) {
return containsElementOrParent(elements, jElement);
}
curr = curr.getParent();
} while (curr != null);
return false;
}
use of org.eclipse.core.resources.IResource in project che by eclipse.
the class OverwriteHelper method willOverwrite.
/*
* Will resource override a member of destination?
*/
private boolean willOverwrite(IResource resource) {
if (resource == null)
return false;
IResource destinationResource = ResourceUtil.getResource(fDestination);
if (destinationResource.equals(resource.getParent()))
return false;
if (destinationResource instanceof IContainer) {
IContainer container = (IContainer) destinationResource;
IResource member = container.findMember(resource.getName());
if (member == null || !member.exists())
return false;
return true;
}
return false;
}
use of org.eclipse.core.resources.IResource in project che by eclipse.
the class ParentChecker method resourcesHaveCommonParent.
private boolean resourcesHaveCommonParent() {
if (fResources.length == 0)
return true;
IResource firstParent = fResources[0].getParent();
Assert.isNotNull(firstParent);
for (int i = 1; i < fResources.length; i++) {
if (!firstParent.equals(fResources[i].getParent()))
return false;
}
return true;
}
use of org.eclipse.core.resources.IResource in project che by eclipse.
the class ParentChecker method removeResourcesDescendantsOfJavaElements.
private void removeResourcesDescendantsOfJavaElements() {
List<IResource> subResources = new ArrayList<IResource>(3);
for (int i = 0; i < fResources.length; i++) {
IResource subResource = fResources[i];
for (int j = 0; j < fJavaElements.length; j++) {
IJavaElement superElements = fJavaElements[j];
if (isDescendantOf(subResource, superElements))
subResources.add(subResource);
}
}
removeFromSetToDelete(subResources.toArray(new IResource[subResources.size()]));
}
Aggregations