Java 类org.eclipse.jdt.core.dom.MemberRef 实例源码

项目:che    文件:ChangeSignatureProcessor.java   
private OccurrenceUpdate<? extends ASTNode> createOccurrenceUpdate(
    ASTNode node, CompilationUnitRewrite cuRewrite, RefactoringStatus result) {
  if (BUG_89686
      && node instanceof SimpleName
      && node.getParent() instanceof EnumConstantDeclaration) node = node.getParent();

  if (Invocations.isInvocationWithArguments(node))
    return new ReferenceUpdate(node, cuRewrite, result);
  else if (node instanceof SimpleName && node.getParent() instanceof MethodDeclaration)
    return new DeclarationUpdate((MethodDeclaration) node.getParent(), cuRewrite, result);
  else if (node instanceof MemberRef || node instanceof MethodRef)
    return new DocReferenceUpdate(node, cuRewrite, result);
  else if (ASTNodes.getParent(node, ImportDeclaration.class) != null)
    return new StaticImportUpdate(
        (ImportDeclaration) ASTNodes.getParent(node, ImportDeclaration.class), cuRewrite, result);
  else if (node instanceof LambdaExpression)
    return new LambdaExpressionUpdate((LambdaExpression) node, cuRewrite, result);
  else if (node.getLocationInParent() == ExpressionMethodReference.NAME_PROPERTY)
    return new ExpressionMethodRefUpdate(
        (ExpressionMethodReference) node.getParent(), cuRewrite, result);
  else return new NullOccurrenceUpdate(node, cuRewrite, result);
}
项目:Eclipse-Postfix-Code-Completion    文件:MovedMemberAnalyzer.java   
@Override
public boolean visit(MemberRef node) {
    IBinding binding= node.resolveBinding();
    if (isSourceAccess(binding)) {
        if (isMovedMember(binding)) {
            if (node.getQualifier() != null)
                rewrite(node, fTarget);
        } else
            rewrite(node, fSource);

    } else if (isTargetAccess(binding)) {
        // remove qualifier:
        SimpleName replace= (SimpleName)fCuRewrite.getASTRewrite().createCopyTarget(node.getName());
        fCuRewrite.getASTRewrite().replace(node, replace, null);
        fCuRewrite.getImportRemover().registerRemovedNode(node);
    }
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeSignatureProcessor.java   
private OccurrenceUpdate<? extends ASTNode> createOccurrenceUpdate(ASTNode node, CompilationUnitRewrite cuRewrite, RefactoringStatus result) {
    if (BUG_89686 && node instanceof SimpleName && node.getParent() instanceof EnumConstantDeclaration)
        node= node.getParent();

    if (Invocations.isInvocationWithArguments(node))
        return new ReferenceUpdate(node, cuRewrite, result);

    else if (node instanceof SimpleName && node.getParent() instanceof MethodDeclaration)
        return new DeclarationUpdate((MethodDeclaration) node.getParent(), cuRewrite, result);

    else if (node instanceof MemberRef || node instanceof MethodRef)
        return new DocReferenceUpdate(node, cuRewrite, result);

    else if (ASTNodes.getParent(node, ImportDeclaration.class) != null)
        return new StaticImportUpdate((ImportDeclaration) ASTNodes.getParent(node, ImportDeclaration.class), cuRewrite, result);

    else if (node instanceof LambdaExpression)
        return new LambdaExpressionUpdate((LambdaExpression) node, cuRewrite, result);

    else if (node.getLocationInParent() == ExpressionMethodReference.NAME_PROPERTY)
        return new ExpressionMethodRefUpdate((ExpressionMethodReference) node.getParent(), cuRewrite, result);

    else
        return new NullOccurrenceUpdate(node, cuRewrite, result);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:MovedMemberAnalyzer.java   
@Override
public boolean visit(MemberRef node) {
    IBinding binding= node.resolveBinding();
    if (isSourceAccess(binding)) {
        if (isMovedMember(binding)) {
            if (node.getQualifier() != null)
                rewrite(node, fTarget);
        } else
            rewrite(node, fSource);

    } else if (isTargetAccess(binding)) {
        // remove qualifier:
        SimpleName replace= (SimpleName)fCuRewrite.getASTRewrite().createCopyTarget(node.getName());
        fCuRewrite.getASTRewrite().replace(node, replace, null);
        fCuRewrite.getImportRemover().registerRemovedNode(node);
    }
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeSignatureProcessor.java   
private OccurrenceUpdate<? extends ASTNode> createOccurrenceUpdate(ASTNode node, CompilationUnitRewrite cuRewrite, RefactoringStatus result) {
    if (BUG_89686 && node instanceof SimpleName && node.getParent() instanceof EnumConstantDeclaration)
        node= node.getParent();

    if (Invocations.isInvocationWithArguments(node))
        return new ReferenceUpdate(node, cuRewrite, result);

    else if (node instanceof SimpleName && node.getParent() instanceof MethodDeclaration)
        return new DeclarationUpdate((MethodDeclaration) node.getParent(), cuRewrite, result);

    else if (node instanceof MemberRef || node instanceof MethodRef)
        return new DocReferenceUpdate(node, cuRewrite, result);

    else if (ASTNodes.getParent(node, ImportDeclaration.class) != null)
        return new StaticImportUpdate((ImportDeclaration) ASTNodes.getParent(node, ImportDeclaration.class), cuRewrite, result);

    else
        return new NullOccurrenceUpdate(node, cuRewrite, result);
}
项目:eclipse.jdt.ls    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MemberRef node) {
    Name qualifier= node.getQualifier();
    if (qualifier != null) {
        typeRefFound(qualifier);
    }
    return false;
}
项目:che    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MemberRef node) {
  Name qualifier = node.getQualifier();
  if (qualifier != null) {
    typeRefFound(qualifier);
  }
  return false;
}
项目:che    文件:ChangeSignatureProcessor.java   
@Override
protected SimpleName getMethodNameNode() {
  if (fNode instanceof MemberRef) return ((MemberRef) fNode).getName();

  if (fNode instanceof MethodRef) return ((MethodRef) fNode).getName();

  return null;
}
项目:che    文件:DelegateFieldCreator.java   
@Override
protected ASTNode createDocReference(BodyDeclaration declaration) {
  MemberRef ref = getAst().newMemberRef();
  ref.setName(getAst().newSimpleName(getNewElementName()));

  if (isMoveToAnotherFile()) ref.setQualifier(createDestinationTypeName());
  return ref;
}
项目:Eclipse-Postfix-Code-Completion    文件:MoveStaticMemberAnalyzer.java   
protected void rewrite(MemberRef node, ITypeBinding type) {
    Name qualifier= node.getQualifier();
    if (qualifier == null) {
        ImportRewriteContext context= new ContextSensitiveImportRewriteContext(node, fCuRewrite.getImportRewrite());
        Type result= fCuRewrite.getImportRewrite().addImport(type, fCuRewrite.getAST(), context);
        fCuRewrite.getImportRemover().registerAddedImport(type.getQualifiedName());
        qualifier= ASTNodeFactory.newName(fCuRewrite.getAST(), ASTFlattener.asString(result));
        fCuRewrite.getASTRewrite().set(node, MemberRef.QUALIFIER_PROPERTY, qualifier, fCuRewrite.createGroupDescription(REFERENCE_UPDATE));
        fNeedsImport= true;
    } else {
        rewriteName(qualifier, type);
    }
    fProcessed.add(node.getName());
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeSignatureProcessor.java   
@Override
protected SimpleName getMethodNameNode() {
    if (fNode instanceof MemberRef)
        return ((MemberRef) fNode).getName();

    if (fNode instanceof MethodRef)
        return ((MethodRef) fNode).getName();

    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:DelegateFieldCreator.java   
@Override
protected ASTNode createDocReference(BodyDeclaration declaration) {
    MemberRef ref= getAst().newMemberRef();
    ref.setName(getAst().newSimpleName(getNewElementName()));

    if (isMoveToAnotherFile())
        ref.setQualifier(createDestinationTypeName());
    return ref;
}
项目:Eclipse-Postfix-Code-Completion    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MemberRef node) {
    Name qualifier= node.getQualifier();
    if (qualifier != null) {
        typeRefFound(qualifier);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:MoveStaticMemberAnalyzer.java   
protected void rewrite(MemberRef node, ITypeBinding type) {
    Name qualifier= node.getQualifier();
    if (qualifier == null) {
        ImportRewriteContext context= new ContextSensitiveImportRewriteContext(node, fCuRewrite.getImportRewrite());
        Type result= fCuRewrite.getImportRewrite().addImport(type, fCuRewrite.getAST(), context);
        fCuRewrite.getImportRemover().registerAddedImport(type.getQualifiedName());
        qualifier= ASTNodeFactory.newName(fCuRewrite.getAST(), ASTFlattener.asString(result));
        fCuRewrite.getASTRewrite().set(node, MemberRef.QUALIFIER_PROPERTY, qualifier, fCuRewrite.createGroupDescription(REFERENCE_UPDATE));
        fNeedsImport= true;
    } else {
        rewriteName(qualifier, type);
    }
    fProcessed.add(node.getName());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeSignatureProcessor.java   
@Override
protected SimpleName getMethodNameNode() {
    if (fNode instanceof MemberRef)
        return ((MemberRef) fNode).getName();

    if (fNode instanceof MethodRef)
        return ((MethodRef) fNode).getName();

    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:DelegateFieldCreator.java   
@Override
protected ASTNode createDocReference(BodyDeclaration declaration) {
    MemberRef ref= getAst().newMemberRef();
    ref.setName(getAst().newSimpleName(getNewElementName()));

    if (isMoveToAnotherFile())
        ref.setQualifier(createDestinationTypeName());
    return ref;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ASTFlattener.java   
@Override
public boolean visit(MemberRef node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
    }
    this.fBuffer.append("#");//$NON-NLS-1$
    node.getName().accept(this);
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ImportReferencesCollector.java   
@Override
public boolean visit(MemberRef node) {
    Name qualifier= node.getQualifier();
    if (qualifier != null) {
        typeRefFound(qualifier);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NaiveASTFlattener.java   
public boolean visit(MemberRef node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
    }
    this.buffer.append("#");//$NON-NLS-1$
    node.getName().accept(this);
    return false;
}
项目:2uml    文件:CompilationUnitASTVisitor.java   
@Override
public boolean visit(MemberRef memberRef) {
    if (currentClassifier == null) {
        CreatorActivator.log(IStatus.WARNING,
                "Visit a memberRef whithout currentClassifier should not appended");
    }
    return super.visit(memberRef);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public void endVisit(MemberRef node) {
    logger.warn("Method endVisitMemberRef for " + node + " for " + node + " not implemented!");
    super.endVisit(node);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public boolean visit(MemberRef node) {
    logger.warn("Method visitMemberValuePair for " + node + " not implemented!");
    return super.visit(node);
}
项目:Beagle    文件:NotRecursingAstVisitor.java   
@Override
public boolean visit(final MemberRef node) {
    return false;
}
项目:Beagle    文件:InstrumentableAstNodeLister.java   
@Override
public boolean visit(final MemberRef node) {
    // will never be visited
    assert false;
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:ReferenceAnalyzer.java   
@Override
public boolean visit(MemberRef node) {
    if (isMovedMember(node.resolveBinding()))
        rewrite(node, fTarget);
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(MemberRef node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public void endVisit(MemberRef node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public boolean visit(MemberRef node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:CopyQualifiedNameAction.java   
private Object getSelectedElement(JavaEditor editor) {
    ISourceViewer viewer= editor.getViewer();
    if (viewer == null)
        return null;

    Point selectedRange= viewer.getSelectedRange();
    int length= selectedRange.y;
    int offset= selectedRange.x;

    ITypeRoot element= JavaUI.getEditorInputTypeRoot(editor.getEditorInput());
    if (element == null)
        return null;

    CompilationUnit ast= SharedASTProvider.getAST(element, SharedASTProvider.WAIT_YES, null);
    if (ast == null)
        return null;

    NodeFinder finder= new NodeFinder(ast, offset, length);
    ASTNode node= finder.getCoveringNode();

    IBinding binding= null;
    if (node instanceof Name) {
        binding= getConstructorBindingIfAvailable((Name)node);
        if (binding != null)
            return binding;
        binding= ((Name)node).resolveBinding();
    } else if (node instanceof MethodInvocation) {
        binding= ((MethodInvocation)node).resolveMethodBinding();
    } else if (node instanceof MethodDeclaration) {
        binding= ((MethodDeclaration)node).resolveBinding();
    } else if (node instanceof Type) {
        binding= ((Type)node).resolveBinding();
    } else if (node instanceof AnonymousClassDeclaration) {
        binding= ((AnonymousClassDeclaration)node).resolveBinding();
    } else if (node instanceof TypeDeclaration) {
        binding= ((TypeDeclaration)node).resolveBinding();
    } else if (node instanceof CompilationUnit) {
        return ((CompilationUnit)node).getJavaElement();
    } else if (node instanceof Expression) {
        binding= ((Expression)node).resolveTypeBinding();
    } else if (node instanceof ImportDeclaration) {
        binding= ((ImportDeclaration)node).resolveBinding();
    } else if (node instanceof MemberRef) {
        binding= ((MemberRef)node).resolveBinding();
    } else if (node instanceof MemberValuePair) {
        binding= ((MemberValuePair)node).resolveMemberValuePairBinding();
    } else if (node instanceof PackageDeclaration) {
        binding= ((PackageDeclaration)node).resolveBinding();
    } else if (node instanceof TypeParameter) {
        binding= ((TypeParameter)node).resolveBinding();
    } else if (node instanceof VariableDeclaration) {
        binding= ((VariableDeclaration)node).resolveBinding();
    }

    if (binding != null)
        return binding.getJavaElement();

    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ReferenceAnalyzer.java   
@Override
public boolean visit(MemberRef node) {
    if (isMovedMember(node.resolveBinding()))
        rewrite(node, fTarget);
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(MemberRef node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public boolean visit(MemberRef node) {
    return visit((ASTNode)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public void endVisit(MemberRef node) {
    endVisit((ASTNode)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public boolean visit(MemberRef node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public void endVisit(MemberRef node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CopyQualifiedNameAction.java   
private Object getSelectedElement(JavaEditor editor) {
    ISourceViewer viewer= editor.getViewer();
    if (viewer == null)
        return null;

    Point selectedRange= viewer.getSelectedRange();
    int length= selectedRange.y;
    int offset= selectedRange.x;

    ITypeRoot element= JavaUI.getEditorInputTypeRoot(editor.getEditorInput());
    if (element == null)
        return null;

    CompilationUnit ast= SharedASTProvider.getAST(element, SharedASTProvider.WAIT_YES, null);
    if (ast == null)
        return null;

    NodeFinder finder= new NodeFinder(ast, offset, length);
    ASTNode node= finder.getCoveringNode();

    IBinding binding= null;
    if (node instanceof Name) {
        binding= getConstructorBindingIfAvailable((Name)node);
        if (binding != null)
            return binding;
        binding= ((Name)node).resolveBinding();
    } else if (node instanceof MethodInvocation) {
        binding= ((MethodInvocation)node).resolveMethodBinding();
    } else if (node instanceof MethodDeclaration) {
        binding= ((MethodDeclaration)node).resolveBinding();
    } else if (node instanceof Type) {
        binding= ((Type)node).resolveBinding();
    } else if (node instanceof AnonymousClassDeclaration) {
        binding= ((AnonymousClassDeclaration)node).resolveBinding();
    } else if (node instanceof TypeDeclaration) {
        binding= ((TypeDeclaration)node).resolveBinding();
    } else if (node instanceof CompilationUnit) {
        return ((CompilationUnit)node).getJavaElement();
    } else if (node instanceof Expression) {
        binding= ((Expression)node).resolveTypeBinding();
    } else if (node instanceof ImportDeclaration) {
        binding= ((ImportDeclaration)node).resolveBinding();
    } else if (node instanceof MemberRef) {
        binding= ((MemberRef)node).resolveBinding();
    } else if (node instanceof MemberValuePair) {
        binding= ((MemberValuePair)node).resolveMemberValuePairBinding();
    } else if (node instanceof PackageDeclaration) {
        binding= ((PackageDeclaration)node).resolveBinding();
    } else if (node instanceof TypeParameter) {
        binding= ((TypeParameter)node).resolveBinding();
    } else if (node instanceof VariableDeclaration) {
        binding= ((VariableDeclaration)node).resolveBinding();
    }

    if (binding != null)
        return binding.getJavaElement();

    return null;
}
项目:eclipse-i18ntools    文件:ASTNodeFinder.java   
@Override
public boolean visit(final MemberRef node) {
    return this.internalVisit(node);
}
项目:j2d    文件:J2dVisitor.java   
@Override
public boolean visit(MemberRef node) {
    System.out.println("Found: " + node.getClass());
    return super.visit(node);
}