use of org.apache.sling.ide.serialization.SerializationKind in project sling by apache.
the class ResourceChangeCommandFactory method buildResourceProxyForPlainFileOrFolder.
private ResourceProxy buildResourceProxyForPlainFileOrFolder(IResource changedResource, IFolder syncDirectory, Repository repository) throws CoreException, IOException {
SerializationKind serializationKind;
String fallbackNodeType;
if (changedResource.getType() == IResource.FILE) {
serializationKind = SerializationKind.FILE;
fallbackNodeType = Repository.NT_FILE;
} else {
// i.e. IResource.FOLDER
serializationKind = SerializationKind.FOLDER;
fallbackNodeType = Repository.NT_FOLDER;
}
String resourceLocation = '/' + changedResource.getFullPath().makeRelativeTo(syncDirectory.getFullPath()).toPortableString();
IPath serializationFilePath = Path.fromOSString(serializationManager.getSerializationFilePath(resourceLocation, serializationKind));
IResource serializationResource = syncDirectory.findMember(serializationFilePath);
if (serializationResource == null && changedResource.getType() == IResource.FOLDER) {
ResourceProxy dataFromCoveringParent = findSerializationDataFromCoveringParent(changedResource, syncDirectory, resourceLocation, serializationFilePath);
if (dataFromCoveringParent != null) {
return dataFromCoveringParent;
}
}
return buildResourceProxy(resourceLocation, serializationResource, syncDirectory, fallbackNodeType, repository);
}
Aggregations