Java Code Examples for org.eclipse.jdt.core.dom.MethodRef#getQualifier()

The following examples show how to use org.eclipse.jdt.core.dom.MethodRef#getQualifier() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MovedMemberAnalyzer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public boolean visit(MethodRef 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);
}
 
Example 2
Source File: JavaASTFlattener.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean visit(final MethodRef node) {
  Name _qualifier = node.getQualifier();
  boolean _tripleNotEquals = (_qualifier != null);
  if (_tripleNotEquals) {
    node.getQualifier().accept(this);
  }
  this.appendToBuffer("#");
  node.getName().accept(this);
  this.appendToBuffer("(");
  this.visitAllSeparatedByComma(node.parameters());
  this.appendToBuffer(")");
  return false;
}
 
Example 3
Source File: MoveStaticMemberAnalyzer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void rewrite(MethodRef 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, MethodRef.QUALIFIER_PROPERTY, qualifier, fCuRewrite.createGroupDescription(REFERENCE_UPDATE));
		fNeedsImport= true;
	} else {
		rewriteName(qualifier, type);
	}
	fProcessed.add(node.getName());
}
 
Example 4
Source File: ImportReferencesCollector.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean visit(MethodRef node) {
	Name qualifier= node.getQualifier();
	if (qualifier != null) {
		typeRefFound(qualifier);
	}
	List<MethodRefParameter> list= node.parameters();
	if (list != null) {
		doVisitChildren(list); // visit MethodRefParameter with Type
	}
	return false;
}