Example usage for org.eclipse.jdt.internal.core OpenableElementInfo setIsStructureKnown

List of usage examples for org.eclipse.jdt.internal.core OpenableElementInfo setIsStructureKnown

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core OpenableElementInfo setIsStructureKnown.

Prototype

public void setIsStructureKnown(boolean newIsStructureKnown) 

Source Link

Document

Sets whether the structure of this element known

Usage

From source file:org.eclipse.che.jdt.internal.core.Openable.java

License:Open Source License

protected void generateInfos(Object info, HashMap newElements, IProgressMonitor monitor)
        throws JavaModelException {

    if (JavaModelCache.VERBOSE) {
        String element;//from   ww w. j  a va2s  .c  om
        switch (getElementType()) {
        case JAVA_PROJECT:
            element = "project"; //$NON-NLS-1$
            break;
        case PACKAGE_FRAGMENT_ROOT:
            element = "root"; //$NON-NLS-1$
            break;
        case PACKAGE_FRAGMENT:
            element = "package"; //$NON-NLS-1$
            break;
        case CLASS_FILE:
            element = "class file"; //$NON-NLS-1$
            break;
        case COMPILATION_UNIT:
            element = "compilation unit"; //$NON-NLS-1$
            break;
        default:
            element = "element"; //$NON-NLS-1$
        }
        System.out.println(Thread.currentThread() + " OPENING " + element + " " + this.toStringWithAncestors()); //$NON-NLS-1$//$NON-NLS-2$
    }

    // open its ancestors if needed
    openAncestors(newElements, monitor);

    // validate existence
    File underlResource = resource();
    IStatus status = validateExistence(underlResource);
    if (!status.isOK())
        throw newJavaModelException(status);

    if (monitor != null && monitor.isCanceled())
        throw new OperationCanceledException();

    // puts the info before building the structure so that questions to the handle behave as if the element existed
    // (case of compilation units becoming working copies)
    newElements.put(this, info);

    // build the structure of the openable (this will open the buffer if needed)
    try {
        OpenableElementInfo openableElementInfo = (OpenableElementInfo) info;
        boolean isStructureKnown = buildStructure(openableElementInfo, monitor, newElements, underlResource);
        openableElementInfo.setIsStructureKnown(isStructureKnown);
    } catch (JavaModelException e) {
        newElements.remove(this);
        throw e;
    }

    // remove out of sync buffer for this element
    //        JavaModelManager.getJavaModelManager().getElementsOutOfSynchWithBuffers().remove(this);

    if (JavaModelCache.VERBOSE) {
        System.out.println(manager.cacheToString("-> ")); //$NON-NLS-1$
    }
}