/** * Returns the range of the name of the given {@link IApiField} to select when creating {@link * IApiProblem}s. Source ranges are computed and tried in the following order: * * <ol> * <li>Try the type-qualified name of the variable * <li>Try looking for 'super.variable' * <li>Try looking for 'this.variable' * <li>Try looking for pattern '*.variable' * <li>Else select the entire line optimistically * </ol> * * @param field the field to find the name range for * @param document the document to look within * @param reference the reference the field is from * @return the range of text to select, or <code>null</code> if one could not be computed * @throws BadLocationException * @throws CoreException */ protected Position getFieldNameRange(IApiField field, IDocument document, IReference reference) throws BadLocationException, CoreException { return getFieldNameRange( field.getEnclosingType().getName(), field.getName(), document, reference); }