Example usage for org.eclipse.jface.viewers TreeViewer setHasChildren

List of usage examples for org.eclipse.jface.viewers TreeViewer setHasChildren

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers TreeViewer setHasChildren.

Prototype

public void setHasChildren(final Object elementOrTreePath, final boolean hasChildren) 

Source Link

Document

For a TreeViewer with a tree with the VIRTUAL style bit set, inform the viewer about whether the given element or tree path has children.

Usage

From source file:com.puppetlabs.geppetto.puppetdb.ui.treenode.LeafNode.java

License:Open Source License

@Override
public void updateHasChildren(TreeViewer viewer) {
    viewer.setHasChildren(this, false);
}

From source file:com.puppetlabs.geppetto.puppetdb.ui.views.PuppetDBQuery.java

License:Open Source License

@Override
public void updateHasChildren(TreeViewer viewer) {
    viewer.setHasChildren(this, true);
}

From source file:org.eclipse.viatra.query.tooling.ui.queryexplorer.content.matcher.CompositeContent.java

License:Open Source License

/**
 * Call this method if the element is already present in the tree viewer, but it is not expanded yet and the
 * children list has changed. In this case, even if the children are updated properly, the tree viewer will not show
 * that the element has children. Calling this method only has effect if the element is not expanded yet (because in
 * these cases the observable list propagates the updates properly).
 *///  ww w  . ja v  a2s  . c o  m
public void updateHasChildren() {
    // only perform it for items which are not expanded, ClassCastException will be thrown otherwise
    // due to the lazy tree content provider
    if (QueryExplorer.getInstance() != null) {
        TreeViewer viewer = QueryExplorer.getInstance().getMatcherTreeViewer();
        if (!viewer.getExpandedState(this)) {
            viewer.setHasChildren(this, getChildren().size() > 0);
        }
        //Bug 491506: This explicit refresh avoid display issues on Linux
        viewer.refresh(this, true);
    }
}