org.eclipse.jface.viewers.ITreeContentProvider Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2000, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.viewers;
/**
* An interface to content providers for tree-structure-oriented
* viewers.
*
* @see AbstractTreeViewer
*/
public interface ITreeContentProvider extends IStructuredContentProvider {
/**
* {@inheritDoc}
*
* NOTE: The returned array must not contain the given
* inputElement
, since this leads to recursion issues in
* {@link AbstractTreeViewer} (see
* bug 9262).
*
*/
@Override
public Object[] getElements(Object inputElement);
/**
* Returns the child elements of the given parent element.
*
* The difference between this method and IStructuredContentProvider.getElements
* is that getElements
is called to obtain the
* tree viewer's root elements, whereas getChildren
is used
* to obtain the children of a given parent element in the tree (including a root).
*
* The result is not modified by the viewer.
*
* @param parentElement the parent element
* @return an array of child elements
*/
public Object[] getChildren(Object parentElement);
/**
* Returns the parent for the given element, or null
* indicating that the parent can't be computed.
* In this case the tree-structured viewer can't expand
* a given node correctly if requested.
*
* @param element the element
* @return the parent element, or null
if it
* has none or if the parent cannot be computed
*/
public Object getParent(Object element);
/**
* Returns whether the given element has children.
*
* Intended as an optimization for when the viewer does not
* need the actual children. Clients may be able to implement
* this more efficiently than getChildren
.
*
*
* @param element the element
* @return true
if the given element has children,
* and false
if it has no children
*/
public boolean hasChildren(Object element);
}