Example usage for org.eclipse.jdt.core ITypeRoot getChildren

List of usage examples for org.eclipse.jdt.core ITypeRoot getChildren

Introduction

In this page you can find the example usage for org.eclipse.jdt.core ITypeRoot getChildren.

Prototype

IJavaElement[] getChildren() throws JavaModelException;

Source Link

Document

Returns the immediate children of this element.

Usage

From source file:org.apache.felix.sigil.eclipse.model.util.JavaHelper.java

License:Apache License

private static IType findType(ITypeRoot root) throws JavaModelException {
    // TODO Auto-generated method stub
    for (IJavaElement child : root.getChildren()) {
        if (child.getElementType() == IJavaElement.TYPE) {
            return (IType) child;
        }//w  w w  .  ja v a  2s . c o m
    }

    throw new JavaModelException(new IllegalStateException("Missing type for " + root), IStatus.ERROR);
}

From source file:org.jboss.tools.vscode.java.internal.handlers.DocumentSymbolHandler.java

License:Open Source License

private SymbolInformation[] getOutline(ITypeRoot unit) {
    try {/*from ww  w . j a v a  2 s  .  c  om*/
        IJavaElement[] elements = unit.getChildren();
        ArrayList<SymbolInformation> symbols = new ArrayList<SymbolInformation>(elements.length);
        collectChildren(unit, elements, symbols);
        return symbols.toArray(new SymbolInformation[symbols.size()]);
    } catch (JavaModelException e) {
        JavaLanguageServerPlugin.logException("Problem getting outline for" + unit.getElementName(), e);
    }
    return new SymbolInformation[0];
}