private static void checkHierarchyOfEnclosedTypes(IType destinationType, RefactoringStatus result, IType type) throws JavaModelException { IType[] enclosedTypes= getAllEnclosedTypes(type); for (int i= 0; i < enclosedTypes.length; i++) { IType enclosedType= enclosedTypes[i]; if (destinationType.getElementName().equals(enclosedType.getElementName())){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict3, new String[] { getQualifiedLabel(enclosedType), getQualifiedLabel(type)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } if (typeNameExistsInEnclosingTypeChain(destinationType, enclosedType.getElementName())){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict4, new String[] { getQualifiedLabel(enclosedType), getQualifiedLabel(type)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } } }
private static void checkHierarchyOfEnclosedTypes(IType destinationType, RefactoringStatus result, IType type) throws JavaModelException { IType[] enclosedTypes= getAllEnclosedTypes(type); for (int i= 0; i < enclosedTypes.length; i++) { IType enclosedType= enclosedTypes[i]; if (destinationType.getElementName().equals(enclosedType.getElementName())){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict3, new String[]{JavaModelUtil.getFullyQualifiedName(enclosedType), JavaModelUtil.getFullyQualifiedName(type)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } if (typeNameExistsInEnclosingTypeChain(destinationType, enclosedType.getElementName())){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict4, new String[]{JavaModelUtil.getFullyQualifiedName(enclosedType), JavaModelUtil.getFullyQualifiedName(type)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } } }
private static void checkHierarchyOfEnclosedTypes(IType destinationType, RefactoringStatus result, IType type) throws JavaModelException { IType[] enclosedTypes= getAllEnclosedTypes(type); for (int i= 0; i < enclosedTypes.length; i++) { IType enclosedType= enclosedTypes[i]; if (destinationType.getElementName().equals(enclosedType.getElementName())){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict3, new String[] { getQualifiedLabel(enclosedType), getQualifiedLabel(type)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } if (typeNameExistsInEnclosingTypeChain(destinationType, enclosedType.getElementName())){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict4, new String[] { getQualifiedLabel(enclosedType), getQualifiedLabel(type)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } } }
private static void checkTypeInType(IType destinationType, RefactoringStatus result, IType type) throws JavaModelException { String typeName= type.getElementName(); IType destinationTypeType= destinationType.getType(typeName); if (destinationTypeType.exists()){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict0, new String[]{typeName, JavaModelUtil.getFullyQualifiedName(destinationType)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationTypeType.getNameRange()); result.addError(message, context); } else { //need to check the hierarchy of enclosing and enclosed types if (destinationType.getElementName().equals(typeName)){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict1, new String[]{JavaModelUtil.getFullyQualifiedName(type)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } if (typeNameExistsInEnclosingTypeChain(destinationType, typeName)){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict2, new String[]{JavaModelUtil.getFullyQualifiedName(type)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } checkHierarchyOfEnclosedTypes(destinationType, result, type); } }
private static void checkTypeInType(IType destinationType, RefactoringStatus result, IType type) throws JavaModelException { String typeName= type.getElementName(); IType destinationTypeType= destinationType.getType(typeName); if (destinationTypeType.exists()){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict0, new String[]{ BasicElementLabels.getJavaElementName(typeName), getQualifiedLabel(destinationType)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationTypeType.getNameRange()); result.addError(message, context); } else { //need to check the hierarchy of enclosing and enclosed types if (destinationType.getElementName().equals(typeName)){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict1, getQualifiedLabel(type)); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } if (typeNameExistsInEnclosingTypeChain(destinationType, typeName)){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict2, getQualifiedLabel(type)); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } checkHierarchyOfEnclosedTypes(destinationType, result, type); } }
private static void checkTypeInType(IType destinationType, RefactoringStatus result, IType type) throws JavaModelException { String typeName= type.getElementName(); IType destinationTypeType= destinationType.getType(typeName); if (destinationTypeType.exists()){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict0, new String[]{ BasicElementLabels.getJavaElementName(typeName), getQualifiedLabel(destinationType)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationTypeType.getNameRange()); result.addError(message, context); } else { //need to check the hierarchy of enclosing and enclosed types if (destinationType.getElementName().equals(typeName)){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict1, getQualifiedLabel(type)); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } if (typeNameExistsInEnclosingTypeChain(destinationType, typeName)){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_type_name_conflict2, getQualifiedLabel(type)); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), destinationType.getNameRange()); result.addError(message, context); } checkHierarchyOfEnclosedTypes(destinationType, result, type); } }