public static org.eclipse.jdt.core.dom.AbstractTypeDeclaration findTypeDeclaration(IType searchType, List<?> nodes) { for (Object object : nodes) { if (object instanceof org.eclipse.jdt.core.dom.AbstractTypeDeclaration) { org.eclipse.jdt.core.dom.AbstractTypeDeclaration typeDeclaration = (org.eclipse.jdt.core.dom.AbstractTypeDeclaration) object; if (typeDeclaration.getName().toString().equals(searchType.getElementName())) return typeDeclaration; } } return null; }
private boolean visitType(AbstractTypeDeclaration node) { result.add(node.getName().getIdentifier()); // don't dive into type declaration since they open a new // context. return false; } }
private AbstractTypeDeclaration findTypeDeclaration(List types, String name) { for (Iterator iter= types.iterator(); iter.hasNext();) { AbstractTypeDeclaration decl= (AbstractTypeDeclaration) iter.next(); if (name.equals(decl.getName().getIdentifier())) { return decl; } } return null; }
protected SimpleName rename(ASTNode node, SimpleName newName) { AbstractTypeDeclaration type = (AbstractTypeDeclaration) node; SimpleName oldName = type.getName(); type.setName(newName); return oldName; } }
private AbstractTypeDeclaration findTypeDeclaration(List<AbstractTypeDeclaration> types, String name) { for (Iterator<AbstractTypeDeclaration> iter= types.iterator(); iter.hasNext();) { AbstractTypeDeclaration decl= iter.next(); if (name.equals(decl.getName().getIdentifier())) { return decl; } } return null; }
protected SimpleName rename(ASTNode node, SimpleName newName) { AbstractTypeDeclaration type = (AbstractTypeDeclaration) node; SimpleName oldName = type.getName(); type.setName(newName); return oldName; } }
private boolean visitType(AbstractTypeDeclaration node) { result.add(node.getName().getIdentifier()); // don't dive into type declaration since they open a new // context. return false; } }
private boolean visitType(AbstractTypeDeclaration node) { if (fTypeCounter++ == 0) { addNameReference(node.getName()); } return true; } @Override
@Override protected SimpleName rename(ASTNode node, SimpleName newName) { AbstractTypeDeclaration type = (AbstractTypeDeclaration) node; SimpleName oldName = type.getName(); type.setName(newName); return oldName; } }
@Override public boolean visit(TypeDeclarationStatement node) { fScope.addName(node.getDeclaration().getName().getIdentifier()); return false; }
@Override public boolean visit(TypeDeclarationStatement node) { fScope.addName(node.getDeclaration().getName().getIdentifier()); return false; }
@Override public String getName() { return getDeclaration().getName().getIdentifier(); }
public String getName() { if (name == UNITIALIZED_STRING) { name = ASTFacadeHelper.toString(getASTNode().getName()); } return name; }
@Override public boolean visit(AbstractTypeDeclaration node) { Assert.isTrue(node.getParent() instanceof TypeDeclarationStatement); result.add(node.getName().getIdentifier()); return false; }
@Override public TypeDeclaration bodyDeclaration(CompilationUnit astRoot) { String name = this.getName(); for (AbstractTypeDeclaration typeDeclaration : this.types(astRoot)) { if (typeDeclaration.getName().getFullyQualifiedName().equals(name)) { return (TypeDeclaration) typeDeclaration; // assume no enum or annotation declarations } } return null; }
@Override public boolean visit(MethodDeclaration node) { if (node.isConstructor()) { AbstractTypeDeclaration decl= ASTNodes.getParent(node, AbstractTypeDeclaration.class); NameData name= fNames.get(decl.getName().resolveBinding()); if (name != null) { name.addReference(node.getName()); } } return true; } @Override
@Override public boolean visit(MethodDeclaration node) { if (node.isConstructor()) { AbstractTypeDeclaration decl= (AbstractTypeDeclaration) ASTNodes.getParent(node, AbstractTypeDeclaration.class); NameData name= fNames.get(decl.getName().resolveBinding()); if (name != null) { name.addReference(node.getName()); } } return true; } @Override
private String getTypeName(ASTNode type) { if (type instanceof AbstractTypeDeclaration) { return ((AbstractTypeDeclaration)type).getName().getIdentifier(); } else if (type instanceof AnonymousClassDeclaration) { ClassInstanceCreation node= ASTNodes.getParent(type, ClassInstanceCreation.class); return ASTNodes.asString(node.getType()); } Assert.isTrue(false, "Should not happen"); //$NON-NLS-1$ return null; }
private String getTypeName(ASTNode type) { if (type instanceof AbstractTypeDeclaration) { return ((AbstractTypeDeclaration) type).getName().getIdentifier(); } else if (type instanceof AnonymousClassDeclaration) { ClassInstanceCreation node = ASTNodes.getParent(type, ClassInstanceCreation.class); return ASTNodes.asString(node.getType()); } Assert.isTrue(false, "Should not happen"); //$NON-NLS-1$ return null; }
@Override public boolean visit(AbstractTypeDeclaration node) { String name= node.getName().getIdentifier(); if (name.equals(getNewElementName())) { fStatus.addError(Messages.format(RefactoringCoreMessages.RenameTypeParameterRefactoring_type_parameter_inner_class_clash, new String[] { name}), JavaStatusContext.create(fTypeParameter.getDeclaringMember().getCompilationUnit(), SourceRangeFactory.create(node))); return true; } return true; } }