/*
   * @see org.eclipse.jface.contentassist.IContentAssistProcessorExtension#computeCompletionProposals(org.eclipse.jface.contentassist.IContentAssistSubject, int)
   */
  public ICompletionProposal[] computeCompletionProposals(
      IContentAssistSubjectControl contentAssistSubject, int documentOffset) {
    if (fFieldNameProposals.length == 0) return null;
    String input = contentAssistSubject.getDocument().get();

    ArrayList proposals = new ArrayList();
    String prefix = input.substring(0, documentOffset);
    ImageDescriptor imageDescriptor =
        JavaElementImageProvider.getFieldImageDescriptor(false, fRefactoring.getVisibility());
    Image image = fImageRegistry.get(imageDescriptor);
    for (int i = 0; i < fFieldNameProposals.length; i++) {
      String tempName = fFieldNameProposals[i];
      if (tempName.length() == 0 || !tempName.startsWith(prefix)) continue;
      JavaCompletionProposal proposal =
          new JavaCompletionProposal(tempName, 0, input.length(), image, tempName, 0);
      proposals.add(proposal);
    }
    fErrorMessage =
        proposals.size() > 0 ? null : JavaUIMessages.JavaEditor_codeassist_noCompletions;
    return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
  }
 public FieldNameProcessor(String[] guessedFieldNames, PromoteTempToFieldRefactoring refactoring) {
   fRefactoring = refactoring;
   fFieldNameProposals = refactoring.guessFieldNames();
   Arrays.sort(fFieldNameProposals);
 }