Examples of ITypeBinding


Examples of org.eclipse.jdt.core.dom.ITypeBinding

    private void writeSuperClass(StringBuffer buf, ImportsManager imports) {
        String superclass = getSuperClass();
        if (fTypeKind == CLASS_TYPE && superclass.length() > 0 && !"java.lang.Object".equals(superclass)) { //$NON-NLS-1$
            buf.append(" extends "); //$NON-NLS-1$

            ITypeBinding binding = null;
            if (fCurrType != null) {
                binding = TypeContextChecker.resolveSuperClass(superclass, fCurrType, getSuperClassStubTypeContext());
            }
            if (binding != null) {
                buf.append(imports.addImport(binding));
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

                bindings = TypeContextChecker.resolveSuperInterfaces(intfs, fCurrType, getSuperInterfacesStubTypeContext());
            } else {
                bindings = new ITypeBinding[intfs.length];
            }
            for (int i = 0; i <= last; i++) {
                ITypeBinding binding = bindings[i];
                if (binding != null) {
                    buf.append(imports.addImport(binding));
                } else {
                    buf.append(imports.addImport(intfs[i]));
                }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

        settings.createComments = isAddComments();
        ASTParser parser = ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL);
        parser.setResolveBindings(true);
        parser.setSource(cu);
        CompilationUnit unit = (CompilationUnit) parser.createAST(new SubProgressMonitor(monitor, 1));
        final ITypeBinding binding = ASTNodes.getTypeBinding(unit, type);
        if (binding != null) {
            if (doUnimplementedMethods) {
                AddUnimplementedMethodsOperation operation = new AddUnimplementedMethodsOperation(unit, binding, null, -1, false, true, false);
                operation.setCreateComments(isAddComments());
                operation.run(monitor);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

        @SuppressWarnings("unchecked")
        List<SingleVariableDeclaration> params = method.parameters();
        for (Iterator<SingleVariableDeclaration> iter = params.iterator(); iter.hasNext();) {
            String paramType;
            SingleVariableDeclaration param = iter.next();
            ITypeBinding typeBinding = param.getType().resolveBinding();
            if (typeBinding != null)
                paramType = typeBinding.getBinaryName();
            else
                paramType = param.getName().getIdentifier();

            builder.append(paramType);
            if (iter.hasNext())
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

        final List<MarkerData> markers = new LinkedList<MarkerData>();
        final CompilationUnit ast = createAST(javaProject, className);
        ast.accept(new ASTVisitor() {
            @Override
            public boolean visit(TypeDeclaration typeDecl) {
                ITypeBinding typeBinding = typeDecl.resolveBinding();
                if (typeBinding != null) {
                    if (typeBinding.getBinaryName().equals(className)) {
                        Map<String,Object> attribs = new HashMap<String,Object>();
                        SimpleName nameNode = typeDecl.getName();
                        attribs.put(IMarker.CHAR_START, nameNode.getStartPosition());
                        attribs.put(IMarker.CHAR_END, nameNode.getStartPosition() + nameNode.getLength());
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

        final List<MarkerData> markers = new LinkedList<MarkerData>();
        final CompilationUnit ast = createAST(javaProject, className);
        ast.accept(new ASTVisitor() {
            @Override
            public boolean visit(TypeDeclaration typeDecl) {
                ITypeBinding typeBinding = typeDecl.resolveBinding();
                if (typeBinding != null) {
                    if (typeBinding.getBinaryName().equals(className)) {
                        Map<String,Object> attribs = new HashMap<String,Object>();
                        SimpleName nameNode = typeDecl.getName();
                        attribs.put(IMarker.CHAR_START, nameNode.getStartPosition());
                        attribs.put(IMarker.CHAR_END, nameNode.getStartPosition() + nameNode.getLength());
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

    }
  }

  public static ITypeBinding findMockedType(final MethodDeclaration node, final IMethodBinding meth)
  {
    ITypeBinding typePar = null;
    if (meth == null)
    {
      return null;
    }

    ITypeBinding declaringClass = meth.getDeclaringClass();

    boolean isMockClass = hasMockClass(declaringClass);
    boolean isMockUpType = isMockUpType(declaringClass.getSuperclass());

    if (isMockUpType)
    {
      typePar = ASTUtil.getFirstTypeParameter(node.getParent());
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

   
    IMethodBinding origMethod = ASTUtil.findMethodInType(type, name, paramTypes);

    if( origMethod == null && type.isInterface() && ast != null ) // interfaces can mock Object.class methods
    {
      ITypeBinding objType = ast.resolveWellKnownType(Object.class.getName());
      origMethod = ASTUtil.findMethodInType(objType, name, paramTypes);
    }

    if (origMethod == null && type.getTypeArguments().length != 0)
    {
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

    return null;
  }

  public static ITypeBinding findMockedTypeFromNode(final ASTNode node)
  {
    ITypeBinding declaringType = null;

    if (node instanceof AnonymousClassDeclaration)
    {
      declaringType = ASTUtil.getFirstTypeParameter( (AnonymousClassDeclaration) node);
    }
    else if( node instanceof TypeDeclaration )
    {
      TypeDeclaration typeDec = (TypeDeclaration) node;
      ITypeBinding curType = typeDec.resolveBinding();

      if( hasMockClass(curType) )
      {
        declaringType = findRealClassType(curType);
      }
      else if( isMockUpType(curType.getSuperclass()) )
      {
        declaringType = ASTUtil.getFirstTypeParam(typeDec.getSuperclassType());
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ITypeBinding

    return declaringType;
  }

  public static ITypeBinding getMockType(final ASTNode node)
  {
    ITypeBinding mockType = null;
 
    if (node instanceof AnonymousClassDeclaration)
    {
      mockType = ((AnonymousClassDeclaration) node).resolveBinding();
    }
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.