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

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

Introduction

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

Prototype

public void removeChild(IJavaElement child) 

Source Link

Usage

From source file:org.eclipse.ajdt.core.javaelements.AJCompilationUnitManager.java

License:Open Source License

public void removeFileFromModel(IFile file) {
    AJCompilationUnit unit = (AJCompilationUnit) compilationUnitStore.get(file);
    if (unit != null) {
        try {/*from   www  .  j  a  v  a 2  s.c o  m*/
            // Fix for bug 106813 - check if the project is open first
            if (file.getProject().isOpen()) {
                OpenableElementInfo info = (OpenableElementInfo) ((JavaElement) unit.getParent())
                        .getElementInfo();
                info.removeChild(unit);
            }
            JavaModelManager.getJavaModelManager().removeInfoAndChildren(unit);

        } catch (JavaModelException e) {
        }
        compilationUnitStore.remove(file);
    }
}

From source file:org.eclipse.ajdt.core.javaelements.AJCompilationUnitManager.java

License:Open Source License

private AJCompilationUnit createCU(IFile file) {
    AJCompilationUnit unit = new AJCompilationUnit(file);

    try {/*from  w w w.j  a  v a 2 s.c  o  m*/
        OpenableElementInfo info = (OpenableElementInfo) ((JavaElement) unit.getParent()).getElementInfo();
        info.removeChild(unit); // Remove identical CompilationUnit if it exists
        info.addChild(unit);

        compilationUnitStore.put(file, unit);
    } catch (JavaModelException e) {
    }
    return unit;
}