use of de.pdark.decentxml.Element in project sling by apache.
the class LinkHelper method createSelectionNode.
private JcrNode createSelectionNode(IResource resource) {
if (resource == null) {
return null;
}
final IContainer resourceParent = resource.getParent();
if (resource instanceof IFolder) {
IFolder container = (IFolder) resource;
IPath syncDirFullPath = ProjectUtil.getSyncDirectoryFullPath(resource.getProject());
if (syncDirFullPath.equals(container.getFullPath())) {
// then we've reached the syncdir
return new SyncDir(container);
}
} else if (!(resource instanceof IFile)) {
return null;
}
JcrNode parent = createSelectionNode(resourceParent);
if (parent == null) {
return null;
}
Element domNode = null;
JcrNode selectedNode = new JcrNode(parent, domNode, resource);
return selectedNode;
}
use of de.pdark.decentxml.Element in project sling by apache.
the class GenericJcrRootFile method handleChild.
private void handleChild(JcrNode parent, Element domNode) {
if (domNode.getType() == Type.TEXT) {
// ignore
return;
}
JcrNode childJcrNode = new JcrNode(parent, domNode, this, null);
handleProperties(domNode, childJcrNode.properties);
for (Element element : domNode.getChildren()) {
handleChild(childJcrNode, element);
}
}
use of de.pdark.decentxml.Element in project sling by apache.
the class GenericJcrRootFile method handleJcrRoot.
private void handleJcrRoot(Element element) {
List<Element> children = element.getChildren();
final JcrNode effectiveParent;
if (isRootContentXml()) {
if (parent instanceof DirNode) {
DirNode dirNodeParent = (DirNode) parent;
JcrNode effectiveSibling = dirNodeParent.getEffectiveSibling();
if (effectiveSibling != null) {
effectiveSibling.dirSibling = dirNodeParent;
handleProperties(element, effectiveSibling.properties);
} else {
handleProperties(element, parent.properties);
}
effectiveParent = parent;
} else {
handleProperties(element, parent.properties);
effectiveParent = parent;
}
} else {
handleProperties(element, properties);
effectiveParent = this;
parent.addChild(this);
}
for (Iterator<Element> it = children.iterator(); it.hasNext(); ) {
Element aChild = it.next();
handleChild(effectiveParent, aChild);
}
}
Aggregations