private Map getMatchingMembersMapping(final IType initial) throws JavaModelException { final Map result= new HashMap(); final IMember[] members= getCreatedDestinationMembers(); for (int i= 0; i < members.length; i++) { final IMember member= members[i]; if (member instanceof IMethod) { final IMethod method= (IMethod) member; final IMethod found= MemberCheckUtil.findMethod(method, initial.getMethods()); if (found != null) addMatchingMember(result, method, found); } else if (member instanceof IField) { final IField field= (IField) member; final IField found= initial.getField(field.getElementName()); if (found.exists()) addMatchingMember(result, field, found); } else if (member instanceof IType) { final IType type= (IType) member; final IType found= initial.getType(type.getElementName()); if (found.exists()) addMatchingMember(result, type, found); } else Assert.isTrue(false); } return result; }
private Map<IMember, Set<IMember>> getMatchingMembersMapping(final IType initial) throws JavaModelException { final Map<IMember, Set<IMember>> result= new HashMap<>(); final IMember[] members= getCreatedDestinationMembers(); for (int i= 0; i < members.length; i++) { final IMember member= members[i]; if (member instanceof IMethod) { final IMethod method= (IMethod) member; final IMethod found= MemberCheckUtil.findMethod(method, initial.getMethods()); if (found != null) addMatchingMember(result, method, found); } else if (member instanceof IField) { final IField field= (IField) member; final IField found= initial.getField(field.getElementName()); if (found.exists()) addMatchingMember(result, field, found); } else if (member instanceof IType) { final IType type= (IType) member; final IType found= initial.getType(type.getElementName()); if (found.exists()) addMatchingMember(result, type, found); } else Assert.isTrue(false); } return result; }
private Map<IMember, Set<IMember>> getMatchingMembersMapping(final IType initial) throws JavaModelException { final Map<IMember, Set<IMember>> result= new HashMap<>(); final IMember[] members= getCreatedDestinationMembers(); for (int i= 0; i < members.length; i++) { final IMember member= members[i]; if (member instanceof IMethod) { final IMethod method= (IMethod) member; final IMethod found= MemberCheckUtil.findMethod(method, initial.getMethods()); if (found != null) addMatchingMember(result, method, found); } else if (member instanceof IField) { final IField field= (IField) member; final IField found= initial.getField(field.getElementName()); if (found.exists()) addMatchingMember(result, field, found); } else if (member instanceof IType) { final IType type= (IType) member; final IType found= initial.getType(type.getElementName()); if (found.exists()) addMatchingMember(result, type, found); } else Assert.isTrue(false); } return result; }
private static void checkMethodInType(IType destinationType, RefactoringStatus result, IMethod method) throws JavaModelException { IMethod[] destinationTypeMethods= destinationType.getMethods(); IMethod found= findMethod(method, destinationTypeMethods); if (found != null){ RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), found.getSourceRange()); String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_signature_exists, new String[]{method.getElementName(), JavaModelUtil.getFullyQualifiedName(destinationType)}); result.addError(message, context); } else { IMethod similar= Checks.findMethod(method, destinationType); if (similar != null){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_same_param_count, new String[]{method.getElementName(), JavaModelUtil.getFullyQualifiedName(destinationType)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), similar.getSourceRange()); result.addWarning(message, context); } } }
private static void checkMethodInType(IType destinationType, RefactoringStatus result, IMethod method) throws JavaModelException { IMethod[] destinationTypeMethods= destinationType.getMethods(); IMethod found= findMethod(method, destinationTypeMethods); if (found != null){ RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), found.getSourceRange()); String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_signature_exists, new String[]{ BasicElementLabels.getJavaElementName(method.getElementName()), getQualifiedLabel(destinationType)}); result.addError(message, context); } else { IMethod similar= Checks.findMethod(method, destinationType); if (similar != null){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_same_param_count, new String[]{ BasicElementLabels.getJavaElementName(method.getElementName()), getQualifiedLabel(destinationType)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), similar.getSourceRange()); result.addWarning(message, context); } } }
private static void checkMethodInType(IType destinationType, RefactoringStatus result, IMethod method) throws JavaModelException { IMethod[] destinationTypeMethods= destinationType.getMethods(); IMethod found= findMethod(method, destinationTypeMethods); if (found != null){ RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), found.getSourceRange()); String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_signature_exists, new String[]{ BasicElementLabels.getJavaElementName(method.getElementName()), getQualifiedLabel(destinationType)}); result.addError(message, context); } else { IMethod similar= Checks.findMethod(method, destinationType); if (similar != null){ String message= Messages.format(RefactoringCoreMessages.MemberCheckUtil_same_param_count, new String[]{ BasicElementLabels.getJavaElementName(method.getElementName()), getQualifiedLabel(destinationType)}); RefactoringStatusContext context= JavaStatusContext.create(destinationType.getCompilationUnit(), similar.getSourceRange()); result.addWarning(message, context); } } }