Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IClassFile


        IEditorInput input = null;
        // check if it is a inner class from the class in editor
        if (!hasInnerClass(debugType, parent)) {
            // not only inner classes could be defined in the same source file, but also
            // local types (non public non inner classes in the same source file)
            IClassFile classFile = getLocalTypeClass(debugType, parent);
            if(classFile != null){
                input = editor.doOpenBuffer(classFile, externalClass);
            }
        } else {
            // if both exists, replace the input to the inner class
View Full Code Here


            createTypedElement(element2, modes)));
    }

    protected TypedElement createTypedElement(IJavaElement javaElement, BitSet modes) {
        String name;
        IClassFile classFile = (IClassFile) javaElement
            .getAncestor(IJavaElement.CLASS_FILE);
        // existing read-only class files
        if (classFile != null) {
            name = classFile.getPath().toOSString();
            if (!name.endsWith(".class")) { //$NON-NLS-1$
                name += '/' + JdtUtils.getFullBytecodeName(classFile);
            }
        } else {
            // usual eclipse - generated bytecode
View Full Code Here

                    IClasspathEntry ce = rt.getRawClasspathEntry();
                    IPath path = ce.getPath();
                    skip = "org.eclipse.jdt.launching.JRE_CONTAINER".equals(path.toString());
                    break;
                case IJavaElement.CLASS_FILE:
                    IClassFile cf = (IClassFile) e;
                    if (cf.getElementName().startsWith(pckg))
                    {
                        findIndirectReferences(indirect,
                            findPackage(cf.getType().getSuperclassName()), p, p);
                    }
                    break;
                case IJavaElement.COMPILATION_UNIT:
                    ICompilationUnit cu = (ICompilationUnit) e;
                    break;
View Full Code Here

  }
  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

  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

      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

    // 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

  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

        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

    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

TOP

Related Classes of org.eclipse.jdt.core.IClassFile

Copyright © 2018 www.massapicom. 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.