use of org.python.pydev.shared_ui.outline.IParsedItem in project Pydev by fabioz.
the class ParsedItem method getChildren.
@Override
public IParsedItem[] getChildren() {
if (children != null) {
return children;
}
if (astChildrenEntries == null) {
astChildrenEntries = new ASTEntryWithChildren[0];
}
ArrayList<ParsedItem> items = new ArrayList<ParsedItem>();
// only the root can have an error as a child (from there on, the errors don't contain inner errors)
if (this.parent == null && errorDesc != null && errorDesc.message != null) {
items.add(new ParsedItem(this, errorDesc));
}
for (ASTEntryWithChildren c : astChildrenEntries) {
items.add(new ParsedItem(this, c, c.getChildren()));
}
children = items.toArray(new ParsedItem[items.size()]);
return children;
}
use of org.python.pydev.shared_ui.outline.IParsedItem in project Pydev by fabioz.
the class ParsedModel method duplicateRootAddingError.
@Override
protected IParsedItem duplicateRootAddingError(ErrorDescription errorDesc) {
IParsedItem currRoot = getRoot();
IParsedItem newRoot;
if (currRoot != null) {
newRoot = new ParsedItem(((ParsedItem) currRoot).getAstChildrenEntries(), errorDesc);
newRoot.updateTo(currRoot);
} else {
newRoot = new ParsedItem(new ASTEntryWithChildren[0], errorDesc);
}
return newRoot;
}
use of org.python.pydev.shared_ui.outline.IParsedItem in project Pydev by fabioz.
the class ParsedItem method updateTo.
@Override
public void updateTo(IParsedItem item) {
ParsedItem updateToItem = (ParsedItem) item;
this.astThis = updateToItem.astThis;
this.astChildrenEntries = updateToItem.astChildrenEntries;
super.updateTo(item);
}
use of org.python.pydev.shared_ui.outline.IParsedItem in project Pydev by fabioz.
the class ParsedItem method sameNodeType.
@Override
public boolean sameNodeType(IParsedItem newItem) {
ASTEntryWithChildren astThisOld = this.getAstThis();
ASTEntryWithChildren astThisNew = ((ParsedItem) newItem).getAstThis();
if (astThisOld != null && astThisNew != null && astThisOld.node != null && astThisNew.node != null && astThisOld.node.getClass() != astThisNew.node.getClass()) {
return false;
}
// still the same
return true;
}
use of org.python.pydev.shared_ui.outline.IParsedItem in project Pydev by fabioz.
the class PythonBaseModelProvider method getChildrenFromParsedItem.
/**
* @param parentElement this is the elements returned
* @param root this is the parsed item that has children that we want to return
* @return the children elements (PythonNode) for the passed parsed item
*/
private Object[] getChildrenFromParsedItem(Object parentElement, ParsedItem root, PythonFile pythonFile) {
IParsedItem[] children = root.getChildren();
PythonNode[] p = new PythonNode[children.length];
int i = 0;
// in this case, we just want to return the roots
for (IParsedItem e : children) {
p[i] = new PythonNode(pythonFile, parentElement, (ParsedItem) e);
i++;
}
return p;
}
Aggregations