use of org.eclipse.core.resources.mapping.ResourceTraversal in project che by eclipse.
the class JavaElementResourceMapping method getPackageFragmentTraversals.
private static ResourceTraversal[] getPackageFragmentTraversals(IPackageFragment pack) throws CoreException {
ArrayList<ResourceTraversal> res = new ArrayList<ResourceTraversal>();
IContainer container = (IContainer) pack.getResource();
if (container != null) {
res.add(new ResourceTraversal(new IResource[] { container }, IResource.DEPTH_ONE, 0));
if (pack.exists()) {
// folder may not exist any more, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=269167
Object[] nonJavaResources = pack.getNonJavaResources();
for (int i = 0; i < nonJavaResources.length; i++) {
Object resource = nonJavaResources[i];
if (resource instanceof IFolder) {
res.add(new ResourceTraversal(new IResource[] { (IResource) resource }, IResource.DEPTH_INFINITE, 0));
}
}
}
}
return res.toArray(new ResourceTraversal[res.size()]);
}
use of org.eclipse.core.resources.mapping.ResourceTraversal in project che by eclipse.
the class JavaElementResourceMapping method getRemotePackageFragmentTraversals.
private static ResourceTraversal[] getRemotePackageFragmentTraversals(IPackageFragment pack, RemoteResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
ArrayList<ResourceTraversal> res = new ArrayList<ResourceTraversal>();
IContainer container = (IContainer) pack.getResource();
if (container != null) {
res.add(new ResourceTraversal(new IResource[] { container }, IResource.DEPTH_ONE, 0));
IResource[] remoteMembers = context.fetchRemoteMembers(container, monitor);
if (remoteMembers == null) {
remoteMembers = context.fetchMembers(container, monitor);
}
if (remoteMembers != null) {
for (int i = 0; i < remoteMembers.length; i++) {
IResource member = remoteMembers[i];
if (member instanceof IFolder && JavaConventionsUtil.validatePackageName(member.getName(), pack).getSeverity() == IStatus.ERROR) {
res.add(new ResourceTraversal(new IResource[] { member }, IResource.DEPTH_INFINITE, 0));
}
}
}
}
return res.toArray(new ResourceTraversal[res.size()]);
}
use of org.eclipse.core.resources.mapping.ResourceTraversal in project che by eclipse.
the class AbstractRefactoringDescriptorResourceMapping method getTraversals.
/**
* {@inheritDoc}
*/
public final ResourceTraversal[] getTraversals(final ResourceMappingContext context, final IProgressMonitor monitor) throws CoreException {
if (fResourceTraversals == null) {
fResourceTraversals = new ResourceTraversal[] {};
final long stamp = fDescriptor.getTimeStamp();
if (stamp >= 0) {
final IPath path = RefactoringHistoryManager.stampToPath(stamp);
if (path != null) {
final IProject[] projects = getProjects();
if (projects != null && projects.length == 1 && projects[0] != null) {
final IFolder folder = projects[0].getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER).getFolder(path);
fResourceTraversals = new ResourceTraversal[] { new ResourceTraversal(new IResource[] { folder.getFile(RefactoringHistoryService.NAME_HISTORY_FILE) }, IResource.DEPTH_ZERO, IResource.NONE), new ResourceTraversal(new IResource[] { folder.getFile(RefactoringHistoryService.NAME_INDEX_FILE) }, IResource.DEPTH_ZERO, IResource.NONE) };
}
}
}
}
final ResourceTraversal[] traversals = new ResourceTraversal[fResourceTraversals.length];
System.arraycopy(fResourceTraversals, 0, traversals, 0, fResourceTraversals.length);
return traversals;
}
Aggregations