private void remove(Object element, boolean refreshViewer) { // precondition here: fResult.getMatchCount(child) <= 0 if (hasChildren(element)) { if (refreshViewer) fTreeViewer.refresh(element); } else { if (!hasMatches(element)) { fChildrenMap.remove(element); Object parent = getParent(element); if (parent != null) { removeFromSiblings(element, parent); remove(parent, refreshViewer); } else { removeFromSiblings(element, fResult); if (refreshViewer) fTreeViewer.refresh(); } } else { if (refreshViewer) { fTreeViewer.refresh(element); } } } }
private void insert(Object child, boolean refreshViewer) { int searchFor = ((Q7SearchQuery) fResult.getQuery()).getSearchFor(); boolean isDependencySearch = searchFor == Q7SearchQuery.CONTEXTS_BY_ID || searchFor == Q7SearchQuery.TESTCASE_BY_ID || searchFor == Q7SearchQuery.VERIFICATION_BY_ID; if (isDependencySearch) { child = getParent(child); } Object parent = getParent(child); while (parent != null) { if (insertChild(parent, child)) { if (refreshViewer) fTreeViewer.add(parent, child); } else { if (refreshViewer) fTreeViewer.refresh(parent); return; } child = parent; parent = getParent(child); } if (insertChild(fResult, child)) { if (refreshViewer) fTreeViewer.add(fResult, child); } }
public void clear() { initialize(fResult); fTreeViewer.refresh(); }