Program: 93160
Project: 93160
Buggy source:
private ContentAssistant newContentAssistant(){
  ContentAssistant assistant=new ContentAssistant(){
    @Override public void hide(){
      if (isFocused(searchText) && state != AssistantControlState.ENABLE_HIDE) {
      }
 else {
        super.hide();
        selectedProposal=null;
      }
    }
    private boolean isFocused(    Control control){
      Control focusControl=Display.getCurrent().getFocusControl();
      return control.equals(focusControl);
    }
  }
;
  assistant.addCompletionListener(new ICompletionListener(){
    @Override public void assistSessionEnded(    ContentAssistEvent event){
      selectedProposal=null;
      if (searchShell != null) {
        searchShell.dispose();
      }
    }
    @Override public void selectionChanged(    ICompletionProposal proposal,    boolean smartToggle){
      if (proposal instanceof ICompletionProposal) {
        selectedProposal=proposal;
      }
 else {
        selectedProposal=null;
      }
    }
    @Override public void assistSessionStarted(    ContentAssistEvent event){
    }
  }
);
  assistant.setShowEmptyList(true);
  assistant.enablePrefixCompletion(true);
  assistant.enableColoredLabels(true);
  assistant.setContentAssistProcessor(processor,DEFAULT_CONTENT_TYPE);
  assistant.setInformationControlCreator(new TemplateInformationControlCreator(SWT.LEFT_TO_RIGHT));
  assistant.setEmptyMessage(Messages.COMPLETION_ENGINE_NO_SNIPPETS_FOUND);
  assistant.setRepeatedInvocationMode(true);
  assistant.setStatusLineVisible(true);
  assistant.setSorter(new AbstractProposalSorter(){
    private final ICompletionProposalSorter RELEVANCE_SORTER=new RelevanceSorter();
    @Override public int compare(    ICompletionProposal p1,    ICompletionProposal p2){
      if (p1 instanceof SnippetProposal && p2 instanceof SnippetProposal) {
        SnippetProposal s1=(SnippetProposal)p1;
        SnippetProposal s2=(SnippetProposal)p2;
        return ComparisonChain.start().compare(s1.getRepositoryRelevance(),s2.getRepositoryRelevance()).compare(s2.getRelevance(),s1.getRelevance()).compare(s1.getSnippet().getName(),s2.getSnippet().getName()).result();
      }
 else       if (p1 instanceof RepositoryProposal && p2 instanceof RepositoryProposal) {
        RepositoryProposal s1=(RepositoryProposal)p1;
        RepositoryProposal s2=(RepositoryProposal)p2;
        return ComparisonChain.start().compare(s1.getRepositoryPriority(),s2.getRepositoryPriority()).result();
      }
 else       if (p1 instanceof RepositoryProposal && p2 instanceof SnippetProposal) {
        return compareSnippetWithRepository((SnippetProposal)p2,(RepositoryProposal)p1);
      }
 else       if (p1 instanceof SnippetProposal && p2 instanceof RepositoryProposal) {
        return compareSnippetWithRepository((SnippetProposal)p1,(RepositoryProposal)p2);
      }
 else {
        return RELEVANCE_SORTER.compare(p1,p2);
      }
    }
  }
);
  return assistant;
}

Fixed version (ground truth):
private ContentAssistant newContentAssistant(){
  ContentAssistant assistant=new ContentAssistant(){
    @Override public void hide(){
      if (isFocused(searchText) && state != AssistantControlState.ENABLE_HIDE) {
      }
 else {
        super.hide();
        selectedProposal=null;
      }
    }
    private boolean isFocused(    Control control){
      Control focusControl=Display.getCurrent().getFocusControl();
      return control.equals(focusControl);
    }
  }
;
  assistant.addCompletionListener(new ICompletionListener(){
    @Override public void assistSessionEnded(    ContentAssistEvent event){
      selectedProposal=null;
      if (searchShell != null) {
        searchShell.dispose();
      }
    }
    @Override public void selectionChanged(    ICompletionProposal proposal,    boolean smartToggle){
      if (proposal instanceof ICompletionProposal) {
        selectedProposal=proposal;
      }
 else {
        selectedProposal=null;
      }
    }
    @Override public void assistSessionStarted(    ContentAssistEvent event){
    }
  }
);
  assistant.setShowEmptyList(true);
  assistant.enablePrefixCompletion(true);
  assistant.enableColoredLabels(true);
  assistant.setContentAssistProcessor(processor,DEFAULT_CONTENT_TYPE);
  assistant.setInformationControlCreator(new TemplateInformationControlCreator(SWT.LEFT_TO_RIGHT));
  assistant.setEmptyMessage(Messages.COMPLETION_ENGINE_NO_SNIPPETS_FOUND);
  assistant.setRepeatedInvocationMode(true);
  assistant.setStatusLineVisible(true);
  assistant.setSorter(new AbstractProposalSorter(){
    private final ICompletionProposalSorter RELEVANCE_SORTER=new RelevanceSorter();
    @Override public int compare(    ICompletionProposal p1,    ICompletionProposal p2){
      if (p1 instanceof SnippetProposal && p2 instanceof SnippetProposal) {
        SnippetProposal s1=(SnippetProposal)p1;
        SnippetProposal s2=(SnippetProposal)p2;
        return ComparisonChain.start().compare(s1.getRepositoryRelevance(),s2.getRepositoryRelevance()).compare(s2.getRelevance(),s1.getRelevance()).compare(s1.getSnippet().getName(),s2.getSnippet().getName()).result();
      }
 else       if (p1 instanceof RepositoryProposal && p2 instanceof RepositoryProposal) {
        RepositoryProposal s1=(RepositoryProposal)p1;
        RepositoryProposal s2=(RepositoryProposal)p2;
        return ComparisonChain.start().compare(s1.getRepositoryPriority(),s2.getRepositoryPriority()).result();
      }
 else       if (p1 instanceof RepositoryProposal && p2 instanceof SnippetProposal) {
        int i=compareSnippetWithRepository((SnippetProposal)p2,(RepositoryProposal)p1);
        return i;
      }
 else       if (p1 instanceof SnippetProposal && p2 instanceof RepositoryProposal) {
        int i=-compareSnippetWithRepository((SnippetProposal)p1,(RepositoryProposal)p2);
        return i;
      }
 else {
        return RELEVANCE_SORTER.compare(p1,p2);
      }
    }
  }
);
  return assistant;
}