if (name.getLocationInParent() == SimpleType.NAME_PROPERTY || name.getLocationInParent() == NameQualifiedType.NAME_PROPERTY) { ASTNode type= name.getParent(); if (type.getLocationInParent() == ParameterizedType.TYPE_PROPERTY) {
if (name.getLocationInParent() == SimpleType.NAME_PROPERTY || name.getLocationInParent() == NameQualifiedType.NAME_PROPERTY) { ASTNode type= name.getParent(); if (type.getLocationInParent() == ParameterizedType.TYPE_PROPERTY) {
private static void addNullityAnnotationTypesProposals(ICompilationUnit cu, Name node, Collection<ICommandAccess> proposals) throws CoreException { ASTNode parent= node.getParent(); boolean isAnnotationName= parent instanceof Annotation && ((Annotation) parent).getTypeNameProperty() == node.getLocationInParent(); if (!isAnnotationName) { boolean isImportName= parent instanceof ImportDeclaration && ImportDeclaration.NAME_PROPERTY == node.getLocationInParent(); if (!isImportName) return;
private static void addNullityAnnotationTypesProposals(ICompilationUnit cu, Name node, Collection<ICommandAccess> proposals) throws CoreException { ASTNode parent= node.getParent(); boolean isAnnotationName= parent instanceof Annotation && ((Annotation) parent).getTypeNameProperty() == node.getLocationInParent(); if (!isAnnotationName) { boolean isImportName= parent instanceof ImportDeclaration && ImportDeclaration.NAME_PROPERTY == node.getLocationInParent(); if (!isImportName) return;
@Override protected boolean shouldReport(IProblem problem, CompilationUnit cu) { if (!super.shouldReport(problem, cu)) return false; ASTNode node= ASTNodeSearchUtil.getAstNode(cu, problem.getSourceStart(), problem.getSourceEnd() - problem.getSourceStart() + 1); if (node instanceof Type) { Type type= (Type) node; if (problem.getID() == IProblem.UndefinedType && getClassName().equals(ASTNodes.getTypeName(type))) { return false; } } if (node instanceof Name) { Name name= (Name) node; if (problem.getID() == IProblem.ImportNotFound && getPackage().indexOf(name.getFullyQualifiedName()) != -1) return false; if (problem.getID() == IProblem.MissingTypeInMethod) { StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); String[] arguments= problem.getArguments(); if ((locationInParent == MethodInvocation.NAME_PROPERTY || locationInParent == SuperMethodInvocation.NAME_PROPERTY) && arguments.length > 3 && arguments[3].endsWith(getClassName())) return false; } } return true; }
@Override protected boolean shouldReport(IProblem problem, CompilationUnit cu) { if (!super.shouldReport(problem, cu)) return false; ASTNode node= ASTNodeSearchUtil.getAstNode(cu, problem.getSourceStart(), problem.getSourceEnd() - problem.getSourceStart() + 1); if (node instanceof Type) { Type type= (Type) node; if (problem.getID() == IProblem.UndefinedType && getClassName().equals(ASTNodes.getTypeName(type))) { return false; } } if (node instanceof Name) { Name name= (Name) node; if (problem.getID() == IProblem.ImportNotFound && getPackage().indexOf(name.getFullyQualifiedName()) != -1) return false; if (problem.getID() == IProblem.MissingTypeInMethod) { StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); String[] arguments= problem.getArguments(); if ((locationInParent == MethodInvocation.NAME_PROPERTY || locationInParent == SuperMethodInvocation.NAME_PROPERTY) && arguments.length > 3 && arguments[3].endsWith(getClassName())) return false; } } return true; }
@Override public boolean visit(Name name) { StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); if (locationInParent == ExpressionMethodReference.NAME_PROPERTY || locationInParent == TypeMethodReference.NAME_PROPERTY || locationInParent == SuperMethodReference.NAME_PROPERTY) { return false; } SimpleName leftmost= getLeftmost(name); IBinding leftmostBinding= leftmost.resolveBinding(); if (leftmostBinding instanceof IVariableBinding || leftmostBinding instanceof IMethodBinding || leftmostBinding instanceof ITypeBinding) { if (shouldUnqualify(leftmost)) unqualifyMemberName(leftmost); else qualifyUnqualifiedMemberNameIfNecessary(leftmost); } if (leftmostBinding instanceof ITypeBinding) { String addedImport= fNewLocationCuRewrite.getImportRewrite().addImport((ITypeBinding)leftmostBinding, fNewLocationContext); fNewLocationCuRewrite.getImportRemover().registerAddedImport(addedImport); } return false; }
@Override public boolean visit(Name name) { StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); if (locationInParent == ExpressionMethodReference.NAME_PROPERTY || locationInParent == TypeMethodReference.NAME_PROPERTY || locationInParent == SuperMethodReference.NAME_PROPERTY) { return false; } SimpleName leftmost= getLeftmost(name); IBinding leftmostBinding= leftmost.resolveBinding(); if (leftmostBinding instanceof IVariableBinding || leftmostBinding instanceof IMethodBinding || leftmostBinding instanceof ITypeBinding) { if (shouldUnqualify(leftmost)) unqualifyMemberName(leftmost); else qualifyUnqualifiedMemberNameIfNecessary(leftmost); } if (leftmostBinding instanceof ITypeBinding) { String addedImport= fNewLocationCuRewrite.getImportRewrite().addImport((ITypeBinding)leftmostBinding, fNewLocationContext); fNewLocationCuRewrite.getImportRemover().registerAddedImport(addedImport); } return false; }
node= (SimpleName) selectedNode; ASTNode parent= node.getParent(); StructuralPropertyDescriptor locationInParent= node.getLocationInParent(); if (locationInParent == MethodInvocation.EXPRESSION_PROPERTY) { typeKind= SimilarElementsRequestor.CLASSES;
node= (SimpleName) selectedNode; ASTNode parent= node.getParent(); StructuralPropertyDescriptor locationInParent= node.getLocationInParent(); if (locationInParent == MethodInvocation.EXPRESSION_PROPERTY) { typeKind= SimilarElementsRequestor.CLASSES;
node= (SimpleName) selectedNode; ASTNode parent= node.getParent(); StructuralPropertyDescriptor locationInParent= node.getLocationInParent(); if (locationInParent == ExpressionMethodReference.EXPRESSION_PROPERTY) { typeKind= TypeKinds.REF_TYPES;
node= (SimpleName) selectedNode; ASTNode parent= node.getParent(); StructuralPropertyDescriptor locationInParent= node.getLocationInParent(); if (locationInParent == ExpressionMethodReference.EXPRESSION_PROPERTY) { typeKind= TypeKinds.REF_TYPES;
node= (SimpleName) selectedNode; ASTNode parent= node.getParent(); StructuralPropertyDescriptor locationInParent= node.getLocationInParent(); if (locationInParent == ExpressionMethodReference.EXPRESSION_PROPERTY) { typeKind= SimilarElementsRequestor.REF_TYPES;
StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); if (locationInParent == QualifiedName.NAME_PROPERTY || (locationInParent == FieldAccess.NAME_PROPERTY && !(((FieldAccess) name.getParent()).getExpression() instanceof ThisExpression))) { status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_part_of_qualified_name);
StructuralPropertyDescriptor locationInParent = name.getLocationInParent(); boolean isPartOfQualifiedName = false; boolean isPartOfQualifier = false;
StructuralPropertyDescriptor locationInParent= name.getLocationInParent(); boolean isPartOfQualifiedName= false; boolean isPartOfQualifier= false;