Example usage for org.eclipse.jdt.internal.core Openable getElementName

List of usage examples for org.eclipse.jdt.internal.core Openable getElementName

Introduction

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

Prototype

@Override
public String getElementName() 

Source Link

Usage

From source file:org.eclipse.jdt.internal.core.hierarchy.HierarchyBuilder.java

License:Open Source License

/**
 * Create an ICompilationUnit info from the given compilation unit on disk.
 *///from  w w  w  .  ja  va2  s . c o m
protected ICompilationUnit createCompilationUnitFromPath(Openable handle, IFile file) {
    final char[] elementName = handle.getElementName().toCharArray();
    return new ResourceCompilationUnit(file, file.getLocationURI()) {
        public char[] getFileName() {
            return elementName;
        }
    };
}

From source file:org.eclipse.jdt.internal.core.hierarchy.HierarchyBuilder.java

License:Open Source License

/**
* Create a type info from the given class file in a jar and adds it to the given list of infos.
*///from   w ww  . j a v a2  s. c o m
protected IBinaryType createInfoFromClassFileInJar(Openable classFile) {
    PackageFragment pkg = (PackageFragment) classFile.getParent();
    String classFilePath = Util.concatWith(pkg.names, classFile.getElementName(), '/');
    IBinaryType info = null;
    java.util.zip.ZipFile zipFile = null;
    try {
        zipFile = ((JarPackageFragmentRoot) pkg.getParent()).getJar();
        info = org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.read(zipFile, classFilePath);
    } catch (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException e) {
        if (TypeHierarchy.DEBUG) {
            e.printStackTrace();
        }
        return null;
    } catch (java.io.IOException e) {
        if (TypeHierarchy.DEBUG) {
            e.printStackTrace();
        }
        return null;
    } catch (CoreException e) {
        if (TypeHierarchy.DEBUG) {
            e.printStackTrace();
        }
        return null;
    } finally {
        JavaModelManager.getJavaModelManager().closeZipFile(zipFile);
    }
    this.infoToHandle.put(info, classFile);
    return info;
}