use of org.eclipse.wst.json.core.internal.document.JSONObjectImpl in project webtools.sourceediting by eclipse.
the class JSONModelContext method setLast.
/**
* setLast method
*/
void setLast() {
if (this.parentNode == null)
return;
if (this.nextNode != null) {
IJSONNode prev = this.nextNode.getPreviousSibling();
if (prev == null || prev.getNodeType() != IJSONNode.OBJECT_NODE)
return;
JSONObjectImpl element = (JSONObjectImpl) prev;
if (element.hasEndTag() || !element.isContainer() || element.isEmptyTag())
return;
setParentNode(prev);
}
// find last open parent
IJSONNode parent = this.parentNode;
IJSONNode last = parent.getLastChild();
while (last != null) {
if (last.getNodeType() != IJSONNode.OBJECT_NODE)
break;
JSONObjectImpl element = (JSONObjectImpl) last;
if (element.hasEndTag() || !element.isContainer() || element.isEmptyTag())
break;
parent = element;
last = parent.getLastChild();
}
if (parent != this.parentNode)
setParentNode(parent);
}
Aggregations