/** * Collapses all nodes of the viewer's tree, starting with the root. This * method is equivalent to <code>collapseToLevel(ALL_LEVELS)</code>. */ public void collapseAll() { Object root = getRoot(); if (root != null) { collapseToLevel(root, ALL_LEVELS); } }
/** * Expands the root of the viewer's tree to the given level. * * @param level * non-negative level, or <code>ALL_LEVELS</code> to expand all * levels of the tree */ public void expandToLevel(int level) { expandToLevel(getRoot(), level); }
/** * Expands the root of the viewer's tree to the given level. * * @param level * non-negative level, or <code>ALL_LEVELS</code> to expand all * levels of the tree */ public void expandToLevel(int level) { expandToLevel(getRoot(), level); }
/** * Collapses all nodes of the viewer's tree, starting with the root. This * method is equivalent to <code>collapseToLevel(ALL_LEVELS)</code>. */ public void collapseAll() { Object root = getRoot(); if (root != null) { collapseToLevel(root, ALL_LEVELS); } }
/** * Collapses all nodes of the viewer's tree, starting with the root. This * method is equivalent to <code>collapseToLevel(ALL_LEVELS)</code>. */ public void collapseAll() { Object root = getRoot(); if (root != null) { collapseToLevel(root, ALL_LEVELS); } }
/** * Returns true if the given object is either the input or an empty tree path. * * @param elementOrTreePath an element which could either be the viewer's input, or a tree path * * @return <code>true</code> if the given object is either the input or an empty tree path, * <code>false</code> otherwise. * @since 1.0 */ final protected boolean internalIsInputOrEmptyPath(final Object elementOrTreePath) { if (elementOrTreePath.equals(getRoot())) return true; if (!(elementOrTreePath instanceof TreePath)) return false; return ((TreePath) elementOrTreePath).getSegmentCount() == 0; }
/** * Returns true if the given object is either the input or an empty tree path. * * @param elementOrTreePath an element which could either be the viewer's input, or a tree path * * @return <code>true</code> if the given object is either the input or an empty tree path, * <code>false</code> otherwise. * @since 3.3 */ final protected boolean internalIsInputOrEmptyPath(final Object elementOrTreePath) { if (elementOrTreePath.equals(getRoot())) return true; if (!(elementOrTreePath instanceof TreePath)) return false; return ((TreePath) elementOrTreePath).getSegmentCount() == 0; }
@Override protected Widget doFindInputItem(Object element) { // compare with root Object root = getRoot(); if (root == null) { return null; } if (equals(root, element)) { return getControl(); } return null; }
@Override protected Widget doFindInputItem(Object element) { // compare with root Object root = getRoot(); if (root == null) { return null; } if (equals(root, element)) { return getControl(); } return null; }
protected Widget doFindInputItem(Object element) { // compare with root Object root = getRoot(); if (root == null) { return null; } if (equals(root, element)) { return getControl(); } return null; }
@Override protected void labelProviderChanged() { // we have to walk the (visible) tree and update every item Control tree = getControl(); tree.setRedraw(false); // don't pick up structure changes, but do force label updates internalRefresh(tree, getRoot(), false, true); tree.setRedraw(true); }
protected void internalRefresh(Object element, boolean updateLabels) { // If element is null, do a full refresh. if (element == null) { internalRefresh(getControl(), getRoot(), true, updateLabels); return; } Widget[] items = findItems(element); if (items.length != 0) { for (int i = 0; i < items.length; i++) { // pick up structure changes too internalRefresh(items[i], element, true, updateLabels); } } }
@Override protected void labelProviderChanged() { // we have to walk the (visible) tree and update every item Control tree = getControl(); tree.setRedraw(false); // don't pick up structure changes, but do force label updates internalRefresh(tree, getRoot(), false, true); tree.setRedraw(true); }
protected void labelProviderChanged() { // we have to walk the (visible) tree and update every item Control tree = getControl(); tree.setRedraw(false); // don't pick up structure changes, but do force label updates internalRefresh(tree, getRoot(), false, true); tree.setRedraw(true); }
@Override protected void internalRefresh(Object element, boolean updateLabels) { // If element is null, do a full refresh. if (element == null) { internalRefresh(getControl(), getRoot(), true, updateLabels); return; } Widget[] items = findItems(element); if (items.length != 0) { for (Widget item : items) { // pick up structure changes too internalRefresh(item, element, true, updateLabels); } } }
@Override protected void internalRefresh(Object element, boolean updateLabels) { // If element is null, do a full refresh. if (element == null) { internalRefresh(getControl(), getRoot(), true, updateLabels); return; } Widget[] items = findItems(element); if (items.length != 0) { for (int i = 0; i < items.length; i++) { // pick up structure changes too internalRefresh(items[i], element, true, updateLabels); } } }
/** * Expands the root of the viewer's tree to the given level. * * @param level * non-negative level, or <code>ALL_LEVELS</code> to expand all * levels of the tree * @param disableRedraw * <code>true</code> when drawing operations should be disabled * during expansion. * @since 3.14 */ public void expandToLevel(int level, boolean disableRedraw) { BusyIndicator.showWhile(getControl().getDisplay(), () -> { expandToLevel(getRoot(), level, disableRedraw); }); }
public void run() { Control tree = getControl(); tree.setRedraw(false); try { removeAll(tree); tree.setData(getRoot()); internalInitializeTree(tree); } finally { tree.setRedraw(true); } } });
@Override protected void inputChanged(Object input, Object oldInput) { preservingSelection(() -> { Control tree = getControl(); tree.setRedraw(false); try { removeAll(tree); tree.setData(getRoot()); internalInitializeTree(tree); } finally { tree.setRedraw(true); } }); }
@Override protected void inputChanged(Object input, Object oldInput) { preservingSelection(() -> { Control tree = getControl(); tree.setRedraw(false); try { removeAll(tree); tree.setData(getRoot()); internalInitializeTree(tree); } finally { tree.setRedraw(true); } }); }