HashMap<SimpleNode, TreeItem> c = new HashMap<SimpleNode, TreeItem>();
boolean first = true;
while (outline.hasNext()) {
ASTEntry entry = outline.next();
if (first) {
//Don't add the class itself.
first = false;
continue;
}
TreeItem item = null;
if (entry.node instanceof FunctionDef) {
item = createTreeItem(c, entry);
item.setImage(PydevPlugin.getImageCache().get(UIConstants.METHOD_ICON));
if (model.module != null) {
item.setData(new ItemPointer(model.module.getFile(),
((FunctionDef) entry.node).name));
}
} else if (entry.node instanceof ClassDef) {
item = createTreeItem(c, entry);
item.setImage(PydevPlugin.getImageCache().get(UIConstants.CLASS_ICON));
if (model.module != null) {
item.setData(new ItemPointer(model.module.getFile(),
((ClassDef) entry.node).name));
}
} else {
item = createTreeItem(c, entry);
item.setImage(PydevPlugin.getImageCache().get(UIConstants.PUBLIC_ATTR_ICON));
if (model.module != null) {
item.setData(new ItemPointer(model.module.getFile(), entry.node));
}
}
item.setText(entry.getName());
item.setExpanded(true);
}
}
}
}
private TreeItem createTreeItem(HashMap<SimpleNode, TreeItem> c, ASTEntry entry) {
TreeItem parent = null;
ASTEntry par = entry.parent;
if (par != null) {
parent = c.get(par.node);
}
TreeItem item;