You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2013/09/19 16:12:44 UTC
svn commit: r1524746 - in
/sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model:
DirNode.java GenericJcrRootFile.java
Author: stefanegli
Date: Thu Sep 19 14:12:44 2013
New Revision: 1524746
URL: http://svn.apache.org/r1524746
Log:
SLING-3085 : buglet fix in the content-browser : supporting case nodename.dir/.content.xml with no further children
Modified:
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java
sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java
Modified: sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java
URL: http://svn.apache.org/viewvc/sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java?rev=1524746&r1=1524745&r2=1524746&view=diff
==============================================================================
--- sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java (original)
+++ sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/DirNode.java Thu Sep 19 14:12:44 2013
@@ -84,6 +84,19 @@ public class DirNode extends JcrNode {
@Override
protected void addChild(JcrNode jcrNode) {
+ JcrNode effectiveSibling = getEffectiveSibling();
+ if (effectiveSibling!=null) {
+ // excellent, the parent contains a child which
+ // matches the .dir/_jcr_content pattern, so add this child there
+ effectiveSibling.addChild(jcrNode);
+ // but also hide this node from my parent
+ effectiveSibling.getParent().hide(this);
+ return;
+ }
+ super.addChild(jcrNode);
+ }
+
+ JcrNode getEffectiveSibling() {
final String decodedName = getDecodedName();
JcrNode nonDirNodeParent = parent;
outerloop:while(nonDirNodeParent!=null && (nonDirNodeParent instanceof DirNode)) {
@@ -104,17 +117,12 @@ public class DirNode extends JcrNode {
for (Iterator<JcrNode> it = c.iterator(); it.hasNext();) {
JcrNode node = it.next();
if (node.getName().equals(decodedName)) {
- // excellent, the parent contains a child which
- // matches the .dir/_jcr_content pattern, so add this child there
- node.addChild(jcrNode);
- // but also hide this node from my parent
- nonDirNodeParent.hide(this);
- return;
+ return node;
}
}
- super.addChild(jcrNode);
+ return null;
}
-
+
@Override
public IFile getFileForEditor() {
return null;
Modified: sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java
URL: http://svn.apache.org/viewvc/sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java?rev=1524746&r1=1524745&r2=1524746&view=diff
==============================================================================
--- sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java (original)
+++ sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/GenericJcrRootFile.java Thu Sep 19 14:12:44 2013
@@ -83,8 +83,17 @@ public class GenericJcrRootFile extends
NodeList children = domNode.getChildNodes();
final JcrNode effectiveParent;
if (isRootContentXml()) {
- handleProperties(domNode, parent.properties);
- effectiveParent = parent;
+ if (parent instanceof DirNode) {
+ DirNode dirNodeParent = (DirNode)parent;
+ JcrNode dirNodeParentParent = dirNodeParent.getParent();
+ JcrNode effectiveSibling = dirNodeParent.getEffectiveSibling();
+ handleProperties(domNode, effectiveSibling.properties);
+ effectiveParent = parent;
+ dirNodeParentParent.hide(parent);
+ } else {
+ handleProperties(domNode, parent.properties);
+ effectiveParent = parent;
+ }
} else {
handleProperties(domNode, properties);
effectiveParent = this;