当前位置: 首页>>代码示例>>Java>>正文


Java FieldAccess.resolveFieldBinding方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.FieldAccess.resolveFieldBinding方法的典型用法代码示例。如果您正苦于以下问题:Java FieldAccess.resolveFieldBinding方法的具体用法?Java FieldAccess.resolveFieldBinding怎么用?Java FieldAccess.resolveFieldBinding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.FieldAccess的用法示例。


在下文中一共展示了FieldAccess.resolveFieldBinding方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLeftHandSideVarBinding

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
/**
 * for an assignment x = y returns the variable binding of x
 * 
 * @param varBinding
 * @param assignment
 * @return
 */
private static IVariableBinding getLeftHandSideVarBinding(Assignment assignment) {
	Expression leftHnsd = assignment.getLeftHandSide();
	if (leftHnsd instanceof SimpleName) {
		IBinding bind = ((SimpleName) leftHnsd).resolveBinding();
		if (bind instanceof IVariableBinding) {
			return ((IVariableBinding) bind).getVariableDeclaration();
		}
	}
	if (leftHnsd instanceof FieldAccess) {
		FieldAccess fa = (FieldAccess) leftHnsd;
		return fa.resolveFieldBinding();
	}
	// Leave it null - cannot determine actual domains for arrays
	// workaround for bugs related to objects created in complex expression
	// if (leftHnsd instanceof ArrayAccess) {
	// ArrayAccess aa = (ArrayAccess) leftHnsd;
	// return getArrayAccessVarBinding(aa);
	// }
	return null;
}
 
开发者ID:aroog,项目名称:code,代码行数:28,代码来源:Utils.java

示例2: visit

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
/**
 * Add the variable to the node aliases.
 */
public boolean visit(FieldAccess node){
	/* All we really need from this is the variable binding. */
	IBinding binding = node.resolveFieldBinding();
	
	if(binding == null){
		if(this.aliases.contains(node.getName().toString())){
			this.result = true;
			return false;
		}
			
	}
	else if(binding instanceof IVariableBinding){
		if(this.aliases.contains(binding.getKey())){
			this.result = true;
			return false;
		}
	}
	
	return true;
}
 
开发者ID:qhanam,项目名称:Slicer,代码行数:24,代码来源:FDDVisitor.java

示例3: visit

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
/**
 * Add the variable to the node aliases.
 */
public boolean visit(FieldAccess node){
	/* All we really need from this is the variable binding. */
	IBinding binding = node.resolveFieldBinding();
	
	if(binding == null){
		if(!seedVariables.contains(node.getName().toString()))
			seedVariables.add(node.getName().toString());
	}
	else if(binding instanceof IVariableBinding){
		if(!seedVariables.contains(binding.getKey()))
			seedVariables.add(binding.getKey());
	}
	
	return false;
}
 
开发者ID:qhanam,项目名称:Slicer,代码行数:19,代码来源:BDDSeedVisitor.java

示例4: visit

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
@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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:MovedMemberAnalyzer.java

示例5: visit

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
@Override
public final boolean visit(FieldAccess node) {
	IVariableBinding fieldBinding = node.resolveFieldBinding();
	if (fieldBinding != null) {
	    handleTypeBinding(node, fieldBinding.getDeclaringClass(), false);
	    handleFieldBinding(node, fieldBinding);
	}
	return true;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:10,代码来源:DependenciesAstVisitor.java

示例6: visit

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
public boolean visit(FieldAccess node)
{
  IVariableBinding ivb = node.resolveFieldBinding();
  if (this.mtbStack.isEmpty()) {
    return true;
  }
  IMethodBinding mtb = (IMethodBinding)this.mtbStack.peek();
  try
  {
    if ((!node.getName().toString().equals("length")) || 
      (ivb.getDeclaringClass() != null)) {
      this.facts.add(Fact.makeAccessesFact(
        getQualifiedName(node.resolveFieldBinding()), 
        getQualifiedName(mtb)));
    }
  }
  catch (Exception localException1)
  {
    System.err.println("Cannot resolve field access \"" + 
      node.getName().toString() + "\"");
  }
  try
  {
    String simpleMethodName = getSimpleName(mtb);
    if (simpleMethodName.toLowerCase().startsWith("get")) {
      this.facts.add(Fact.makeGetterFact(getQualifiedName(mtb), 
        getQualifiedName(node.resolveFieldBinding())));
    } else if (simpleMethodName.toLowerCase().startsWith("set")) {
      this.facts.add(Fact.makeSetterFact(getQualifiedName(mtb), 
        getQualifiedName(node.resolveFieldBinding())));
    }
  }
  catch (Exception localException2)
  {
    System.err.println("Cannot resolve bindings for exceptions");
  }
  return true;
}
 
开发者ID:SEAL-UCLA,项目名称:Ref-Finder,代码行数:39,代码来源:ASTVisitorAtomicChange.java

示例7: visit

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
@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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:MoveInstanceMethodProcessor.java

示例8: visit

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
@Override
public boolean visit(FieldAccess node) {
	IVariableBinding fieldBinding= node.resolveFieldBinding();
	return checkVariableBinding(fieldBinding);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:6,代码来源:ExtractClassRefactoring.java

示例9: endVisit

import org.eclipse.jdt.core.dom.FieldAccess; //导入方法依赖的package包/类
@Override
public final void endVisit(final FieldAccess node) {
	final IVariableBinding binding= node.resolveFieldBinding();
	if (binding != null)
		endVisit(binding, node.getExpression(), node);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:SuperTypeConstraintsCreator.java


注:本文中的org.eclipse.jdt.core.dom.FieldAccess.resolveFieldBinding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。