Java 类org.eclipse.jdt.core.ITypeHierarchyChangedListener 实例源码

项目:mybatipse    文件:SupertypeHierarchyCache.java   
private ITypeHierarchy getSupertypes(final IType type) throws JavaModelException
{
    ITypeHierarchy hierarchy = cache.get(type);
    if (hierarchy == null || !hierarchy.exists())
    {
        hierarchy = type.newSupertypeHierarchy(new NullProgressMonitor());
        hierarchy.addTypeHierarchyChangedListener(new ITypeHierarchyChangedListener()
        {
            @Override
            public void typeHierarchyChanged(ITypeHierarchy typeHierarchy)
            {
                cache.remove(type);
            }
        });
        cache.put(type, hierarchy);
    }
    return hierarchy;
}