Examples of AbstractTypeDeclaration


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

      final List<AbstractTypeDeclaration> result = new ArrayList<AbstractTypeDeclaration>(declarations);
      if (!declarations.isEmpty())
      {
         // We don't want to return the current enum constant body's declaration.
         final AbstractTypeDeclaration first = declarations.remove(0);
         result.remove(first);
         for (AbstractTypeDeclaration declaration : declarations)
         {
            result.removeAll(getNestedDeclarations(declaration));
         }
View Full Code Here

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

        // update main type name
        IType[] types = cu.getTypes();
        for (int i = 0, max = types.length; i < max; i++) {
          IType currentType = types[i];
          if (currentType.getElementName().equals(oldTypeName)) {
            AbstractTypeDeclaration typeNode = (AbstractTypeDeclaration) ((JavaElement) currentType).findNode(astCU);
            if (typeNode != null) {
              // rename type
              rewriter.replace(typeNode.getName(), ast.newSimpleName(newTypeName), null);
              // rename constructors
              Iterator bodyDeclarations = typeNode.bodyDeclarations().iterator();
              while (bodyDeclarations.hasNext()) {
                Object bodyDeclaration = bodyDeclarations.next();
                if (bodyDeclaration instanceof MethodDeclaration) {
                  MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
                  if (methodDeclaration.isConstructor()) {
View Full Code Here

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

    parser.setSource(source.toCharArray()); // set source
    parser.setResolveBindings(true); // we need bindings later on
    CompilationUnit cu = (CompilationUnit) parser.createAST(null);
//    List types = cu.structuralPropertiesForType();
    for(Object o:cu.types()){
      AbstractTypeDeclaration dec = (AbstractTypeDeclaration) o;
      List bodyDeclarations = dec.bodyDeclarations();
      assertNotNull(dec.resolveBinding());
      for(Object body:bodyDeclarations){
        MethodDeclaration methodDec = (MethodDeclaration) body;
        IMethodBinding binding = methodDec.resolveBinding();
        assertNotNull(binding);
        ASTNode node = cu.findDeclaringNode(binding);
View Full Code Here

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

    parser.setResolveBindings(true); // we need bindings later on
    CompilationUnit cu = (CompilationUnit) parser.createAST(null);
//    List types = cu.structuralPropertiesForType();
    ASTRewrite rewriter = ASTRewrite.create(cu.getAST());
    for(Object o:cu.types()){
      AbstractTypeDeclaration dec = (AbstractTypeDeclaration) o;
      List bodyDeclarations = dec.bodyDeclarations();
      for(Object body:bodyDeclarations){
        MethodDeclaration methodDec = (MethodDeclaration) body;
        ListRewrite listRewrite = rewriter.getListRewrite(methodDec.getJavadoc(), Javadoc.TAGS_PROPERTY);
        List originalList = listRewrite.getOriginalList();
        ASTNode node = createNode(cu.getAST());
View Full Code Here

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

   }

   @Override
   public boolean isClass()
   {
      AbstractTypeDeclaration declaration = getBodyDeclaration();
      return (declaration instanceof TypeDeclaration)
               && !((TypeDeclaration) declaration).isInterface();

   }
View Full Code Here

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

   }

   @Override
   public boolean isEnum()
   {
      AbstractTypeDeclaration declaration = getBodyDeclaration();
      return declaration instanceof EnumDeclaration;
   }
View Full Code Here

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

   }

   @Override
   public boolean isInterface()
   {
      AbstractTypeDeclaration declaration = getBodyDeclaration();
      return (declaration instanceof TypeDeclaration)
               && ((TypeDeclaration) declaration).isInterface();
   }
View Full Code Here

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

   }

   @Override
   public boolean isAnnotation()
   {
      AbstractTypeDeclaration declaration = getBodyDeclaration();
      return declaration instanceof AnnotationTypeDeclaration;
   }
View Full Code Here

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

      unit.accept(visitor);

      List<AbstractTypeDeclaration> declarations = visitor.getTypeDeclarations();
      if (!declarations.isEmpty())
      {
         AbstractTypeDeclaration declaration = declarations.get(0);
         return getJavaSource(null, document, unit, declaration);
      }
      throw new ParserException("Could not find type declaration in Java source - is this actually code?");
   }
View Full Code Here

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

      final List<AbstractTypeDeclaration> result = new ArrayList<AbstractTypeDeclaration>(declarations);
      if (!declarations.isEmpty())
      {
         // We don't want to return the current enum constant body's declaration.
         final AbstractTypeDeclaration first = declarations.remove(0);
         result.remove(first);
         for (AbstractTypeDeclaration declaration : declarations)
         {
            result.removeAll(getNestedDeclarations(declaration));
         }
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.