public static IMethod getGetter(IField field) throws JavaModelException{ String getterName= getGetterName(field, EMPTY, true); IMethod primaryCandidate= JavaModelUtil.findMethod(getterName, new String[0], false, field.getDeclaringType()); if (! JavaModelUtil.isBoolean(field) || (primaryCandidate != null && primaryCandidate.exists())) return primaryCandidate; //bug 30906 describes why we need to look for other alternatives here (try with get... for booleans) String secondCandidateName= getGetterName(field, EMPTY, false); return JavaModelUtil.findMethod(secondCandidateName, new String[0], false, field.getDeclaringType()); }
private boolean isAvailableInDestination(final IMethod method, final IProgressMonitor monitor) throws JavaModelException { try { final IType destination= getDestinationType(); final IMethod first= JavaModelUtil.findMethod(method.getElementName(), method.getParameterTypes(), false, destination); if (first != null && MethodChecks.isVirtual(first)) return true; final ITypeHierarchy hierarchy= getDestinationTypeHierarchy(monitor); final IMethod found= JavaModelUtil.findMethodInHierarchy(hierarchy, destination, method.getElementName(), method.getParameterTypes(), false); return found != null && MethodChecks.isVirtual(found); } finally { monitor.done(); } }
public static IMethod getGetter(IField field) throws JavaModelException{ String getterName= getGetterName(field, EMPTY, true); IMethod primaryCandidate= JavaModelUtil.findMethod(getterName, new String[0], false, field.getDeclaringType()); if (! JavaModelUtil.isBoolean(field) || (primaryCandidate != null && primaryCandidate.exists())) return primaryCandidate; //bug 30906 describes why we need to look for other alternatives here (try with get... for booleans) String secondCandidateName= getGetterName(field, EMPTY, false); return JavaModelUtil.findMethod(secondCandidateName, new String[0], false, field.getDeclaringType()); }
private boolean isAvailableInDestination(final IMethod method, final IProgressMonitor monitor) throws JavaModelException { try { final IType destination= getDestinationType(); final IMethod first= JavaModelUtil.findMethod(method.getElementName(), method.getParameterTypes(), false, destination); if (first != null && MethodChecks.isVirtual(first)) return true; final ITypeHierarchy hierarchy= getDestinationTypeHierarchy(monitor); final IMethod found= JavaModelUtil.findMethodInHierarchy(hierarchy, destination, method.getElementName(), method.getParameterTypes(), false); return found != null && MethodChecks.isVirtual(found); } finally { monitor.done(); } }
public static IMethod getSetter(IField field) throws JavaModelException{ String[] args= new String[] { field.getTypeSignature() }; return JavaModelUtil.findMethod(getSetterName(field, EMPTY), args, false, field.getDeclaringType()); }
private boolean isAvailableInDestination(final IMethod method, final IProgressMonitor monitor) throws JavaModelException { try { final IType destination= getDestinationType(); final IMethod first= JavaModelUtil.findMethod(method.getElementName(), method.getParameterTypes(), false, destination); if (first != null && MethodChecks.isVirtual(first)) return true; final ITypeHierarchy hierarchy= getDestinationTypeHierarchy(monitor); final IMethod found= JavaModelUtil.findMethodInHierarchy(hierarchy, destination, method.getElementName(), method.getParameterTypes(), false); return found != null && MethodChecks.isVirtual(found); } finally { monitor.done(); } }
public static IMethod getGetter(IField field) throws JavaModelException{ String getterName= getGetterName(field, EMPTY, true); IMethod primaryCandidate= JavaModelUtil.findMethod(getterName, new String[0], false, field.getDeclaringType()); if (! JavaModelUtil.isBoolean(field) || (primaryCandidate != null && primaryCandidate.exists())) return primaryCandidate; //bug 30906 describes why we need to look for other alternatives here (try with get... for booleans) String secondCandidateName= getGetterName(field, EMPTY, false); return JavaModelUtil.findMethod(secondCandidateName, new String[0], false, field.getDeclaringType()); }
public static IMethod getSetter(IField field) throws JavaModelException{ String[] args= new String[] { field.getTypeSignature() }; return JavaModelUtil.findMethod(getSetterName(field, EMPTY), args, false, field.getDeclaringType()); }
public static IMethod getSetter(IField field) throws JavaModelException{ String[] args= new String[] { field.getTypeSignature() }; return JavaModelUtil.findMethod(getSetterName(field, EMPTY), args, false, field.getDeclaringType()); }
private RefactoringStatus checkIfMethodDeclaredIn(final IMethod iMethod, final IType type) throws JavaModelException { final IMethod methodInType= JavaModelUtil.findMethod(iMethod.getElementName(), iMethod.getParameterTypes(), iMethod.isConstructor(), type); if (methodInType == null || !methodInType.exists()) return null; final String[] keys= { JavaElementLabels.getTextLabel(methodInType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED)}; final String msg= Messages.format(RefactoringCoreMessages.PullUpRefactoring_Method_declared_in_class, keys); final RefactoringStatusContext context= JavaStatusContext.create(methodInType); return RefactoringStatus.createWarningStatus(msg, context); }
private RefactoringStatus checkIfMethodDeclaredIn(final IMethod iMethod, final IType type) throws JavaModelException { final IMethod methodInType= JavaModelUtil.findMethod(iMethod.getElementName(), iMethod.getParameterTypes(), iMethod.isConstructor(), type); if (methodInType == null || !methodInType.exists()) return null; final String[] keys= { JavaElementLabels.getTextLabel(methodInType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED)}; final String msg= Messages.format(RefactoringCoreMessages.PullUpRefactoring_Method_declared_in_class, keys); final RefactoringStatusContext context= JavaStatusContext.create(methodInType); return RefactoringStatus.createWarningStatus(msg, context); }
private RefactoringStatus checkIfMethodDeclaredIn(final IMethod iMethod, final IType type) throws JavaModelException { final IMethod methodInType= JavaModelUtil.findMethod(iMethod.getElementName(), iMethod.getParameterTypes(), iMethod.isConstructor(), type); if (methodInType == null || !methodInType.exists()) return null; final String[] keys= { JavaElementLabels.getTextLabel(methodInType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED)}; final String msg= Messages.format(RefactoringCoreMessages.PullUpRefactoring_Method_declared_in_class, keys); final RefactoringStatusContext context= JavaStatusContext.create(methodInType); return RefactoringStatus.createWarningStatus(msg, context); }
private RefactoringStatus checkNewAccessor(IMethod existingAccessor, String newAccessorName) throws CoreException{ RefactoringStatus result= new RefactoringStatus(); IMethod accessor= JavaModelUtil.findMethod(newAccessorName, existingAccessor.getParameterTypes(), false, fField.getDeclaringType()); if (accessor == null || !accessor.exists()) return null; String message= Messages.format(RefactoringCoreMessages.RenameFieldRefactoring_already_exists, new String[]{JavaElementUtil.createMethodSignature(accessor), JavaModelUtil.getFullyQualifiedName(fField.getDeclaringType())}); result.addError(message, JavaStatusContext.create(accessor)); return result; }
private RefactoringStatus checkNewAccessor(IMethod existingAccessor, String newAccessorName) throws CoreException{ RefactoringStatus result= new RefactoringStatus(); IMethod accessor= JavaModelUtil.findMethod(newAccessorName, existingAccessor.getParameterTypes(), false, fField.getDeclaringType()); if (accessor == null || !accessor.exists()) return null; String message= Messages.format(RefactoringCoreMessages.RenameFieldRefactoring_already_exists, new String[]{JavaElementUtil.createMethodSignature(accessor), BasicElementLabels.getJavaElementName(fField.getDeclaringType().getFullyQualifiedName('.'))}); result.addError(message, JavaStatusContext.create(accessor)); return result; }
private RefactoringStatus checkNewAccessor(IMethod existingAccessor, String newAccessorName) throws CoreException{ RefactoringStatus result= new RefactoringStatus(); IMethod accessor= JavaModelUtil.findMethod(newAccessorName, existingAccessor.getParameterTypes(), false, fField.getDeclaringType()); if (accessor == null || !accessor.exists()) { return null; } String message= Messages.format(RefactoringCoreMessages.RenameFieldRefactoring_already_exists, new String[]{JavaElementUtil.createMethodSignature(accessor), BasicElementLabels.getJavaElementName(fField.getDeclaringType().getFullyQualifiedName('.'))}); result.addError(message, JavaStatusContext.create(accessor)); return result; }
private RefactoringStatus checkNewAccessor(IMethod existingAccessor, String newAccessorName) throws CoreException{ RefactoringStatus result= new RefactoringStatus(); IMethod accessor= JavaModelUtil.findMethod(newAccessorName, existingAccessor.getParameterTypes(), false, fField.getDeclaringType()); if (accessor == null || !accessor.exists()) return null; String message= Messages.format(RefactoringCoreMessages.RenameFieldRefactoring_already_exists, new String[]{JavaElementUtil.createMethodSignature(accessor), BasicElementLabels.getJavaElementName(fField.getDeclaringType().getFullyQualifiedName('.'))}); result.addError(message, JavaStatusContext.create(accessor)); return result; }
public String getNewGetterName() throws CoreException { IMethod primaryGetterCandidate= JavaModelUtil.findMethod(GetterSetterUtil.getGetterName(fField, new String[0]), new String[0], false, fField.getDeclaringType()); if (! JavaModelUtil.isBoolean(fField) || (primaryGetterCandidate != null && primaryGetterCandidate.exists())) return GetterSetterUtil.getGetterName(fField.getJavaProject(), getNewElementName(), fField.getFlags(), JavaModelUtil.isBoolean(fField), null); //bug 30906 describes why we need to look for other alternatives here return GetterSetterUtil.getGetterName(fField.getJavaProject(), getNewElementName(), fField.getFlags(), false, null); }
public String getNewGetterName() throws CoreException { IMethod primaryGetterCandidate= JavaModelUtil.findMethod(GetterSetterUtil.getGetterName(fField, new String[0]), new String[0], false, fField.getDeclaringType()); if (! JavaModelUtil.isBoolean(fField) || (primaryGetterCandidate != null && primaryGetterCandidate.exists())) { return GetterSetterUtil.getGetterName(fField.getJavaProject(), getNewElementName(), fField.getFlags(), JavaModelUtil.isBoolean(fField), null); } //bug 30906 describes why we need to look for other alternatives here return GetterSetterUtil.getGetterName(fField.getJavaProject(), getNewElementName(), fField.getFlags(), false, null); }
public String getNewGetterName() throws CoreException { IMethod primaryGetterCandidate= JavaModelUtil.findMethod(GetterSetterUtil.getGetterName(fField, new String[0]), new String[0], false, fField.getDeclaringType()); if (! JavaModelUtil.isBoolean(fField) || (primaryGetterCandidate != null && primaryGetterCandidate.exists())) return GetterSetterUtil.getGetterName(fField.getJavaProject(), getNewElementName(), fField.getFlags(), JavaModelUtil.isBoolean(fField), null); //bug 30906 describes why we need to look for other alternatives here return GetterSetterUtil.getGetterName(fField.getJavaProject(), getNewElementName(), fField.getFlags(), false, null); }
public String getNewGetterName() throws CoreException { IMethod primaryGetterCandidate= JavaModelUtil.findMethod(GetterSetterUtil.getGetterName(fField, new String[0]), new String[0], false, fField.getDeclaringType()); if (! JavaModelUtil.isBoolean(fField) || (primaryGetterCandidate != null && primaryGetterCandidate.exists())) return GetterSetterUtil.getGetterName(fField.getJavaProject(), getNewElementName(), fField.getFlags(), JavaModelUtil.isBoolean(fField), null); //bug 30906 describes why we need to look for other alternatives here return GetterSetterUtil.getGetterName(fField.getJavaProject(), getNewElementName(), fField.getFlags(), false, null); }