/** * Checks if the given name is a valid Java field name. * * @param name the java field name. * @param context an {@link IJavaElement} or <code>null</code> * @return a refactoring status containing the error message if the * name is not a valid java field name. */ public static RefactoringStatus checkFieldName(String name, IJavaElement context) { return checkName(name, JavaConventionsUtil.validateFieldName(name, context)); }
/** * Checks if the given name is a valid Java field name. * * @param name the java field name. * @param context an {@link IJavaElement} or <code>null</code> * @return a refactoring status containing the error message if the * name is not a valid java field name. */ public static RefactoringStatus checkFieldName(String name, IJavaElement context) { return checkName(name, JavaConventionsUtil.validateFieldName(name, context)); }
private IStatus validateName() { if (fName == null) return null; String text= fName.getText(); if (text.length() == 0) return createErrorStatus(RefactoringMessages.ParameterEditDialog_name_error); IStatus status= fContext != null ? JavaConventionsUtil.validateFieldName(text, fContext.getCuHandle().getJavaProject()) : JavaConventions.validateFieldName(text, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3); if (status.matches(IStatus.ERROR)) return status; if (! Checks.startsWithLowerCase(text)) return createWarningStatus(RefactoringCoreMessages.ExtractTempRefactoring_convention); return Status.OK_STATUS; }
private IStatus validateName() { if (fName == null) return null; String text= fName.getText(); if (text.length() == 0) return createErrorStatus(RefactoringMessages.ParameterEditDialog_name_error); IStatus status= fContext != null ? JavaConventionsUtil.validateFieldName(text, fContext.getCuHandle().getJavaProject()) : JavaConventions.validateFieldName(text, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3); if (status.matches(IStatus.ERROR)) return status; if (! Checks.startsWithLowerCase(text)) return createWarningStatus(RefactoringCoreMessages.ExtractTempRefactoring_convention); return Status.OK_STATUS; }