*/
private void ensureParentIsPublished(IModuleResource moduleResource, Repository repository,
IModuleResource[] allResources, Set<IPath> handledPaths)
throws CoreException, SerializationException, IOException {
Logger logger = Activator.getDefault().getPluginLogger();
IPath currentPath = moduleResource.getModuleRelativePath();
logger.trace("Ensuring that parent of path {0} is published", currentPath);
// we assume the root is always published
if (currentPath.segmentCount() == 0) {
logger.trace("Path {0} can not have a parent, skipping", currentPath);
return;
}
IPath parentPath = currentPath.removeLastSegments(1);
// already published by us, a parent of another resource that was published in this execution
if (handledPaths.contains(parentPath)) {
logger.trace("Parent path {0} was already handled, skipping", parentPath);
return;
}
for (IModuleResource maybeParent : allResources) {
if (maybeParent.getModuleRelativePath().equals(parentPath)) {
// handle the parent's parent first, if needed
ensureParentIsPublished(maybeParent, repository, allResources, handledPaths);
// create this resource
execute(addFileCommand(repository, maybeParent));
handledPaths.add(maybeParent.getModuleRelativePath());
logger.trace("Ensured that resource at path {0} is published", parentPath);
return;
}
}
throw new IllegalArgumentException("Resource at " + moduleResource.getModuleRelativePath()