Package org.eclipse.jdt.core.dom

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


          source,
          new EclipseSuperFieldAccess(target, eclipseVariableQuery),
          eclipseVariableQuery);
    }
    if(targetNode instanceof QualifiedName) {
      QualifiedName target = (QualifiedName) targetNode;
      IBinding binding = target.resolveBinding();
      if(binding instanceof IVariableBinding) {
        IVariableBinding vb = (IVariableBinding) binding;
        if(vb.isField()) {
          return new StoreFieldInstructionImpl(
              node,
              source,
              new EclipseBrokenFieldAccess(target, eclipseVariableQuery),
              eclipseVariableQuery);
        }
      }
    }
    if(targetNode instanceof SimpleName) {
      SimpleName target = (SimpleName) targetNode;
      IBinding binding = target.resolveBinding();
      if(binding instanceof IVariableBinding) {
        IVariableBinding vb = (IVariableBinding) binding;
        if(vb.isField()) {
          // implicit field access on this
          return new StoreFieldInstructionImpl(
View Full Code Here


            } else if (name instanceof SimpleName) {
                name = ast.newQualifiedName(ast.newSimpleName(part), ast
                        .newSimpleName(((SimpleName) name).getIdentifier()));
                newName = name;
            } else {
                QualifiedName qualifiedName = (QualifiedName) name;
                SimpleName leftPart = (SimpleName) qualifiedName.getQualifier();
                qualifiedName.setQualifier(ast.newQualifiedName(ast
                        .newSimpleName(part), ast.newSimpleName(leftPart
                        .getIdentifier())));
                name = qualifiedName.getQualifier();
            }
        }

        return newName;
    }
View Full Code Here

  @Override
  public ImportDeclaration newImportDeclaration(AST ast, Optional<String> name) {
    Name qualifier = ast.newName(this.name);
    SimpleName theName = ast.newSimpleName(name.or("*"));
    QualifiedName qualifiedName = ast.newQualifiedName(qualifier, theName);

    ImportDeclaration declaration = ast.newImportDeclaration();
    declaration.setName(qualifiedName);
    return declaration;
  }
View Full Code Here

    // Make a copy of the simple name.
    final AST ast = name.getAST();
    final SimpleName nameCopy = (SimpleName) ASTNode.copySubtree(ast, name);

    final String typeName = importRewrite.addImport(fullyQualifiedTypeName);
    final QualifiedName newNameNode = ast.newQualifiedName(ast
        .newName(typeName), nameCopy);

    astRewrite.replace(nodeToReplace, newNameNode, null);
    return status;
  }
View Full Code Here

//        return "Prefix expression";
//      case ASTNode.PRIMITIVE_TYPE:
//        PrimitiveType primitiveType = (PrimitiveType) node;
//        return "Primitive type: " + primitiveType.getPrimitiveTypeCode().toString();
      case ASTNode.QUALIFIED_NAME:
                QualifiedName qualifiedName = (QualifiedName) node;
                return new AstUtils.QualifiedNameValue(
                        qualifiedName.getQualifier().getFullyQualifiedName(),
                        qualifiedName.getName().getIdentifier());
//      case ASTNode.RETURN_STATEMENT:
//        return "Return statement";
//      case ASTNode.SIMPLE_NAME:
//        SimpleName simpleName = (SimpleName) node;
//        return "Simple name: " + simpleName.getIdentifier();
View Full Code Here

    rewriteImports();
  }

  protected void useSimpleNameAndAddToImport(SimpleType simpleType) {
    if (simpleType.getName().isQualifiedName()) {
      QualifiedName qualifiedName = (QualifiedName) simpleType.getName();
      String qualifier = qualifiedName.getQualifier()
          .getFullyQualifiedName();
      String simpleName = simpleName(qualifiedName);
      AST ast = compilationUnit.getAST();
      if (isAlreadyImported(simpleName, qualifier)) {
        simpleType.setName(ast.newName(simpleName));
View Full Code Here

  }

  public List<String> tokenize() {
    final List<String> tokens = new ArrayList<String>();
    if (javaName.isQualifiedName()) {
      final QualifiedName qualifiedName = (QualifiedName) javaName;
      tokens.addAll(new NameInfo(qualifiedName.getQualifier()).tokenize());
      tokens.add(qualifiedName.getName().getIdentifier());
    } else if (javaName.isSimpleName()) {
      final SimpleName simpleName = (SimpleName) javaName;
      tokens.add(simpleName.getIdentifier());
    } else {
      throw new IllegalStateException("Unsupported name: " + javaName);
View Full Code Here

        return true;
      }
    }

    if (parent instanceof QualifiedName) {
      QualifiedName qualifiedName = (QualifiedName) parent;
      if (expr == qualifiedName.getQualifier()) {
        return false;
      }
    }

    if (parent instanceof PrefixExpression) {
View Full Code Here

  protected ITypeBinding scope(SimpleName node) {
    ASTNode parent = node.getParent();

    if (parent instanceof QualifiedName) {
      QualifiedName qn = (QualifiedName) parent;

      if (node == qn.getName()) {
        return qn.getQualifier().resolveTypeBinding();
      }
    } else if (parent instanceof FieldAccess) {
      FieldAccess fa = (FieldAccess) parent;
      if (node == fa.getName()) {
        return fa.getExpression().resolveTypeBinding();
View Full Code Here

  }

  protected static boolean unqualified(SimpleName node) {
    ASTNode parent = node.getParent();
    if (parent instanceof QualifiedName) {
      QualifiedName qn = (QualifiedName) parent;
      return qn.getQualifier() == node;
    }

    if (parent instanceof FieldAccess) {
      FieldAccess fa = (FieldAccess) parent;
      return fa.getExpression() == node;
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.QualifiedName

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.