Examples of IClassFile


Examples of org.eclipse.jdt.core.IClassFile

  }
  return result;
}

public static ClassFileReader classFileReader(IType type) {
  IClassFile classFile = type.getClassFile();
  JavaModelManager manager = JavaModelManager.getJavaModelManager();
  if (classFile.isOpen())
    return (ClassFileReader) manager.getInfo(type);

  PackageFragment pkg = (PackageFragment) type.getPackageFragment();
  IPackageFragmentRoot root = (IPackageFragmentRoot) pkg.getParent();
  try {
    if (!root.isArchive())
      return Util.newClassFileReader(((JavaElement) type).resource());

    ZipFile zipFile = null;
    try {
      IPath zipPath = root.getPath();
      if (JavaModelManager.ZIP_ACCESS_VERBOSE)
        System.out.println("(" + Thread.currentThread() + ") [MatchLocator.classFileReader()] Creating ZipFile on " + zipPath); //$NON-NLS-1$  //$NON-NLS-2$
      zipFile = manager.getZipFile(zipPath);
      String classFileName = classFile.getElementName();
      String path = Util.concatWith(pkg.names, classFileName, '/');
      return ClassFileReader.read(zipFile, path);
    } finally {
      manager.closeZipFile(zipFile);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

  if (simpleTypeName.equals(binaryTypeQualifiedName))
    return binaryType; // answer only top-level types, sometimes the classFile is for a member/local type

  // type name may be null for anonymous (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=164791)
  String classFileName = simpleTypeName.length() == 0 ? binaryTypeQualifiedName : simpleTypeName;
  IClassFile classFile = binaryType.getPackageFragment().getClassFile(classFileName + SuffixConstants.SUFFIX_STRING_class);
  return classFile.getType();
}
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

      char[][] parameterTypes = methodInfo.parameterTypes;
      if (methodInfo.isConstructor && currentType.getDeclaringType() != null && !Flags.isStatic(currenTypeModifiers)) {
        IType declaringType = currentType.getDeclaringType();
        String declaringTypeName = declaringType.getElementName();
        if (declaringTypeName.length() == 0) {
          IClassFile classFile = declaringType.getClassFile();
          int length = parameterTypes != null ? parameterTypes.length : 0;
          char[][] newParameterTypes = new char[length+1][];
          declaringTypeName = classFile.getElementName();
          declaringTypeName = declaringTypeName.substring(0, declaringTypeName.indexOf('.'));
          newParameterTypes[0] = declaringTypeName.toCharArray();
          if (length != 0) {
            System.arraycopy(parameterTypes, 0, newParameterTypes, 1, length);
          }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

    // if (element instanceof IFileEditorInput)
    // element= ((IFileEditorInput)element).getFile();
    if (element instanceof IResource)
      element = JavaCore.create((IResource) element);
    if (element instanceof IClassFile) {
      IClassFile cf = (IClassFile) element;
      element = cf.getType();
    }
    return element;
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

  private JavaClass javaClass;

  public ClassFileMetric(String handle, BundleAnalyzer analyzer) {
    super(handle, analyzer);
    try {
      IClassFile file = (IClassFile) getJavaElement();
      String className = file.getElementName();
      String packageName = file.getParent().getElementName();
      javaClass = Repository.lookupClass(packageName + "."
          + className.replace(".class", ""));
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

        final IType[] allTypes = icu.getAllTypes();
        for (final IType type : allTypes) {
          final ITypeHierarchy sth = type.newTypeHierarchy(null);
          final IType[] supertypes = sth.getAllSupertypes(type);
          for (final IType supertype : supertypes) {
            final IClassFile classFile = supertype.getClassFile();
            final IResource res = supertype.getResource();
            // only add if there's a source
            if (classFile != null && classFile.isStructureKnown()) {
              list.add(classFile);
            } else if (res != null && res instanceof IFile) {
              list.add(res);
            }
          }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

    final IPackageFragmentRoot root = javaProject.createJAR(
        "testdata/bin/signatureresolver.jar", "/signatureresolver.jar",
        new Path("/UnitTestProject/signatureresolver.jar"), null);
    JavaProjectKit.waitForBuild();
    javaProject.assertNoErrors();
    final IClassFile classFile = root.getPackageFragment("signatureresolver")
        .getClassFile("Samples.class");
    type = classFile.getType();
    createMethodIndex();
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

    final IPackageFragmentRoot root = javaProject.createJAR(
        "testdata/bin/signatureresolver.jar", "/signatureresolver.jar",
        new Path("/UnitTestProject/signatureresolver.jar"), null);
    JavaProjectKit.waitForBuild();
    javaProject.assertNoErrors();
    final IClassFile classFile = root.getPackageFragment("signatureresolver")
        .getClassFile("Samples.class");
    type = classFile.getType();
    createMethodIndex();
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

        try {
          IPackageFragment[] packs =
            prj.getPackageFragments();
          IPackageFragment pack = null;
          IClassFile[] classFiles = null;
          IClassFile classFile = null;
          IType type = null;
          String classFullName = null;
          if(packs!=null) {
            for(int i=0 ; i<packs.length ; i++) {
              pack = packs[i];
              if(
                  (pack!=null)
                  &&(
                      !(
                          pack.getKind()
                          ==IPackageFragmentRoot
                          .K_SOURCE
                      )
                  )
              ) {
                classFiles = pack.getClassFiles();
                if(classFiles!=null) {
                  for(int j=0 ; j<classFiles.length ; j++) {
                    classFile = classFiles[j];
                    if(classFile!=null) {
                      type = classFile.getType();
                      if(type!=null) {
                        classFullName =
                          ClassifierService
                          .buildFullyQualifiedName(
                              type
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

        IResource resource = (IResource) editor.getEditorInput().getAdapter(IFile.class);
        IMarker[] allMarkers;
        if (resource != null) {
            allMarkers = getMarkers(resource, IResource.DEPTH_ZERO);
        } else {
            IClassFile classFile = (IClassFile) editor.getEditorInput().getAdapter(IClassFile.class);
            if (classFile == null) {
                return null;
            }
            Set<IMarker> markers = getMarkers(classFile.getType());
            allMarkers = markers.toArray(new IMarker[markers.size()]);
        }
        // if editor contains only one FB marker, do some cheating and always
        // return it.
        if (allMarkers.length == 1) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.