Java Code Examples for org.eclipse.jdt.core.dom.FieldAccess#resolveFieldBinding()

The following examples show how to use org.eclipse.jdt.core.dom.FieldAccess#resolveFieldBinding() . 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(FieldAccess node) {
	IBinding binding= node.resolveFieldBinding();
	if (isSourceAccess(binding)) {
		if (isMovedMember(binding)) {
			if (node.getExpression() != null)
				rewrite(node, fTarget);
		} else
			rewrite(node, fSource);

	} else if (isTargetAccess(binding)) {
		fCuRewrite.getASTRewrite().remove(node.getExpression(), null);
		fCuRewrite.getImportRemover().registerRemovedNode(node.getExpression());
	}
	return super.visit(node);
}
 
Example 2
Source File: MoveInstanceMethodProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public final boolean visit(final FieldAccess node) {
	Assert.isNotNull(node);
	final Expression expression= node.getExpression();
	final IVariableBinding variable= node.resolveFieldBinding();
	final AST ast= fRewrite.getAST();
	if (expression instanceof ThisExpression) {
		if (Bindings.equals(fTarget, variable)) {
			if (fAnonymousClass > 0) {
				final ThisExpression target= ast.newThisExpression();
				target.setQualifier(ast.newSimpleName(fTargetType.getElementName()));
				fRewrite.replace(node, target, null);
			} else
				fRewrite.replace(node, ast.newThisExpression(), null);
			return false;
		} else {
			expression.accept(this);
			return false;
		}
	} else if (expression instanceof FieldAccess) {
		final FieldAccess access= (FieldAccess) expression;
		final IBinding binding= access.getName().resolveBinding();
		if (access.getExpression() instanceof ThisExpression && Bindings.equals(fTarget, binding)) {
			ASTNode newFieldAccess= getFieldReference(node.getName(), fRewrite);
			fRewrite.replace(node, newFieldAccess, null);
			return false;
		}
	} else if (expression != null) {
		expression.accept(this);
		return false;
	}
	return true;
}
 
Example 3
Source File: ExtractClassRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(FieldAccess node) {
	IVariableBinding fieldBinding= node.resolveFieldBinding();
	return checkVariableBinding(fieldBinding);
}
 
Example 4
Source File: SuperTypeConstraintsCreator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public final void endVisit(final FieldAccess node) {
	final IVariableBinding binding= node.resolveFieldBinding();
	if (binding != null)
		endVisit(binding, node.getExpression(), node);
}