Example usage for org.eclipse.jface.viewers TreeExpansionEvent TreeExpansionEvent

List of usage examples for org.eclipse.jface.viewers TreeExpansionEvent TreeExpansionEvent

Introduction

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

Prototype

public TreeExpansionEvent(AbstractTreeViewer source, Object element) 

Source Link

Document

Creates a new event for the given source and element.

Usage

From source file:gov.nasa.ensemble.common.ui.treetable.TreeTableViewer.java

License:Open Source License

@Override
protected void setExpanded(Item node, boolean expand) {
    TreeItem item = (TreeItem) node;//www .ja v a 2 s.co  m
    boolean pre = item.getExpanded();

    item.setExpanded(expand);

    /*
     * See Eclipse Bugzilla Bug 177378 and JIRA MER-176. In summary, the
     * collapseAll() and expandAll() methods filter through this
     * setExpanded() method. However, this path through the system does not
     * notify listeners of the expansion event. Therefore, we added code to
     * notify the listeners if the expansion state changes as a result of a
     * programmatic call (user clicks in the tree do notify the listeners
     * since those expansions take a different path).
     */

    // do not fire the event if the expansion state did not change
    if (pre == expand)
        return;
    TreeExpansionEvent e = new TreeExpansionEvent(this, node.getData());
    if (expand)
        fireTreeExpanded(e);
    else
        fireTreeCollapsed(e);
}

From source file:org.eclipse.mdht.uml.common.ui.dialogs.SubclassEditorTreeViewer.java

License:Open Source License

/**
 * Handles a tree expand event from the SWT widget.
 *
 * @param event//  w w w.  j  a  va 2 s  .  c  om
 *            the SWT tree event
 */
@Override
protected void handleTreeExpand(TreeEvent event) {
    createChildren(event.item);
    if (event.item.getData() != null) {
        fireTreeExpanded(new TreeExpansionEvent(this, event.item.getData()));
    }
}

From source file:org.mingy.jsfs.ui.viewer.CTreeComboViewer.java

License:Open Source License

protected void handleTreeExpand(TreeEvent event) {
    if (contentProviderIsLazy) {
        if (event.item.getData() != null) {
            Item[] children = getChildren(event.item);
            if (children.length == 1 && children[0].getData() == null) {
                // we have a dummy child node, ask for an updated child
                // count
                virtualLazyUpdateChildCount(event.item, children.length);
            }//from  ww  w  .j  a va 2 s.co  m
            fireTreeExpanded(new TreeExpansionEvent(this, event.item.getData()));
        }
        return;
    }
    super.handleTreeExpand(event);
}