Java Code Examples for org.eclipse.jdt.internal.corext.dom.ASTNodes#getVariableBinding()
The following examples show how to use
org.eclipse.jdt.internal.corext.dom.ASTNodes#getVariableBinding() .
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: ExtractClassRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Expression handleSimpleNameAssignment(ASTNode replaceNode, ParameterObjectFactory pof, String parameterName, AST ast, IJavaProject javaProject, boolean useSuper) { if (replaceNode instanceof Assignment) { Assignment assignment= (Assignment) replaceNode; Expression rightHandSide= assignment.getRightHandSide(); if (rightHandSide.getNodeType() == ASTNode.SIMPLE_NAME) { SimpleName sn= (SimpleName) rightHandSide; IVariableBinding binding= ASTNodes.getVariableBinding(sn); if (binding != null && binding.isField()) { if (fDescriptor.getType().getFullyQualifiedName().equals(binding.getDeclaringClass().getQualifiedName())) { FieldInfo fieldInfo= getFieldInfo(binding.getName()); if (fieldInfo != null && binding == fieldInfo.pi.getOldBinding()) { return pof.createFieldReadAccess(fieldInfo.pi, parameterName, ast, javaProject, useSuper, null); } } } } } return null; }
Example 2
Source File: SnippetFinder.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public boolean match(SimpleName candidate, Object s) { if (!(s instanceof SimpleName)) { return false; } SimpleName snippet = (SimpleName) s; if (candidate.isDeclaration() != snippet.isDeclaration()) { return false; } IBinding cb = candidate.resolveBinding(); IBinding sb = snippet.resolveBinding(); if (cb == null || sb == null) { return false; } IVariableBinding vcb = ASTNodes.getVariableBinding(candidate); IVariableBinding vsb = ASTNodes.getVariableBinding(snippet); if (vcb == null || vsb == null) { return Bindings.equals(cb, sb); } if (!vcb.isField() && !vsb.isField() && Bindings.equals(vcb.getType(), vsb.getType())) { SimpleName mapped = fMatch.getMappedName(vsb); if (mapped != null) { IVariableBinding mappedBinding = ASTNodes.getVariableBinding(mapped); if (!Bindings.equals(vcb, mappedBinding)) { return false; } } fMatch.addLocal(vsb, candidate); return true; } return Bindings.equals(cb, sb); }
Example 3
Source File: IntroduceParameterObjectProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private boolean isParameter(ParameterInfo pi, ASTNode node, List<SingleVariableDeclaration> enclosingMethodParameters, String qualifier) { if (node instanceof Name) { Name name= (Name) node; IVariableBinding binding= ASTNodes.getVariableBinding(name); if (binding != null && binding.isParameter()) { return binding.getName().equals(getNameInScope(pi, enclosingMethodParameters)); } else { if (node instanceof QualifiedName) { QualifiedName qn= (QualifiedName) node; return qn.getFullyQualifiedName().equals(JavaModelUtil.concatenateName(qualifier, getNameInScope(pi, enclosingMethodParameters))); } } } return false; }
Example 4
Source File: SnippetFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean match(SimpleName candidate, Object s) { if (!(s instanceof SimpleName)) return false; SimpleName snippet= (SimpleName)s; if (candidate.isDeclaration() != snippet.isDeclaration()) return false; IBinding cb= candidate.resolveBinding(); IBinding sb= snippet.resolveBinding(); if (cb == null || sb == null) return false; IVariableBinding vcb= ASTNodes.getVariableBinding(candidate); IVariableBinding vsb= ASTNodes.getVariableBinding(snippet); if (vcb == null || vsb == null) return Bindings.equals(cb, sb); if (!vcb.isField() && !vsb.isField() && Bindings.equals(vcb.getType(), vsb.getType())) { SimpleName mapped= fMatch.getMappedName(vsb); if (mapped != null) { IVariableBinding mappedBinding= ASTNodes.getVariableBinding(mapped); if (!Bindings.equals(vcb, mappedBinding)) return false; } fMatch.addLocal(vsb, candidate); return true; } return Bindings.equals(cb, sb); }
Example 5
Source File: SnippetFinder.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
public IVariableBinding getMappedBinding(IVariableBinding org) { SimpleName name = fLocalMappings.get(org); return ASTNodes.getVariableBinding(name); }
Example 6
Source File: ExtractClassRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public boolean visit(SimpleName node) { IVariableBinding variableBinding= ASTNodes.getVariableBinding(node); return checkVariableBinding(variableBinding); }
Example 7
Source File: SnippetFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public IVariableBinding getMappedBinding(IVariableBinding org) { SimpleName name= fLocalMappings.get(org); return ASTNodes.getVariableBinding(name); }