use of org.eclipse.jface.viewers.AbstractTreeViewer in project webtools.sourceediting by eclipse.
the class DTDTreeContentProvider method refreshTree.
/**
* <p>Refreshes the tree from the parents of the given node.</p>
* @param node refresh the tree from the parents of this node
*/
private void refreshTree(Object node) {
List parents = getParents(node);
if (parents.size() > 0) {
for (int p = 0; p < parents.size(); ++p) {
final Object parent = parents.get(p);
// insert the node directly to improve performance
if (parent instanceof DTDFile) {
Object[] objs = getChildren(parent);
for (int i = 0; i < objs.length; i++) {
if (objs[i] == node) {
((AbstractTreeViewer) fViewer).insert(parent, node, i);
break;
}
}
}
this.refreshTreeNode(parent, true);
}
}
}
use of org.eclipse.jface.viewers.AbstractTreeViewer in project egit by eclipse.
the class ReflogViewContentProvider method inputChanged.
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (oldInput != null && loader != null) {
loader.cancel(oldInput);
}
currentInput = newInput;
if (viewer instanceof AbstractTreeViewer && newInput != null) {
loader = new DeferredBatchLoader((AbstractTreeViewer) viewer);
loader.addUpdateCompleteListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (event.getResult().isOK()) {
// Force a selection event
viewer.setSelection(viewer.getSelection());
}
}
});
}
}
Aggregations