Program: 88477
Project: 88477
Buggy source:
protected void runQuery(){
  Collection<Element> selectedElements=CollectionUtil.createNewSequence();
  if (diagramCB.isSelected()) {
    selectedElements.addAll(MDUtils.getSelectionInDiagram());
  }
  if (browserCB.isSelected()) {
    selectedElements.addAll(MDUtils.getSelectionInContainmentBrowser());
  }
  query=editableListPanel.getQuery();
  if (query != null) {
    Object result=null;
    if (objectRadioButton.isSelected()) {
      Object context=selectedElements;
      if (selectedElements.isEmpty()) {
        context=null;
      }
 else       if (selectedElements.size() == 1) {
        context=selectedElements.iterator().next();
      }
      processor=new OclQueryAction.ProcessOclQuery(context);
      result=processor.process(query);
      String processedResult=processResults(result);
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          editableListPanel.setResult(processedResult);
          editableListPanel.setCompletions(processor.getCompletionChoices(),ProcessOclQuery.toString(processor.getSourceOfCompletion()) + "String_Node_Str" + ProcessOclQuery.getTypeName(processor.getSourceOfCompletion()));
        }
      }
);
    }
 else {
      final List<Object> resultList=new ArrayList<Object>();
      final List<String> completionList=new ArrayList<String>();
      final List<Class<?>> classList=new ArrayList<Class<?>>();
      for (      final Object context : selectedElements) {
        processor=new OclQueryAction.ProcessOclQuery(context);
        result=processor.process(query);
        String processedResult=processResults(result);
        resultList.add(processedResult);
        if (result != null && !classList.contains(result.getClass())) {
          completionList.add(editableListPanel.getCompletionHeader(processor.getSourceOfCompletion()));
          completionList.addAll(processor.getCompletionChoices());
          classList.add(result.getClass());
        }
      }
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          editableListPanel.setResult(MoreToString.Helper.toString(resultList,false,true,null,null,"String_Node_Str","String_Node_Str","String_Node_Str",false));
          editableListPanel.setCompletions(completionList,ProcessOclQuery.toString(processor.getSourceOfCompletion()) + "String_Node_Str" + ProcessOclQuery.getTypeName(processor.getSourceOfCompletion()));
        }
      }
);
    }
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        choices.push(query);
        while (choices.size() > maxChoices) {
          choices.pollLast();
        }
        editableListPanel.setItems(choices.toArray());
      }
    }
);
  }
}

Fixed version (ground truth):
protected void runQuery(){
  Collection<Element> selectedElements=CollectionUtil.createNewSequence();
  if (diagramCB.isSelected()) {
    selectedElements.addAll(MDUtils.getSelectionInDiagram());
  }
  if (browserCB.isSelected()) {
    selectedElements.addAll(MDUtils.getSelectionInContainmentBrowser());
  }
  query=editableListPanel.getQuery();
  if (query != null) {
    Object result=null;
    if (objectRadioButton.isSelected()) {
      Object context=selectedElements;
      if (selectedElements.isEmpty()) {
        context=null;
      }
 else       if (selectedElements.size() == 1) {
        context=selectedElements.iterator().next();
      }
      processor=new OclQueryAction.ProcessOclQuery(context);
      result=processor.process(query);
      String processedResult=processResults(result);
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          editableListPanel.setResult(processedResult);
          editableListPanel.setCompletions(processor.getCompletionChoices(),ProcessOclQuery.toString(processor.getSourceOfCompletion()) + "String_Node_Str" + ProcessOclQuery.getTypeName(processor.getSourceOfCompletion()));
        }
      }
);
    }
 else {
      final List<Object> resultList=new ArrayList<Object>();
      final List<String> completionList=new ArrayList<String>();
      final List<Class<?>> classList=new ArrayList<Class<?>>();
      for (      final Object context : selectedElements) {
        processor=new OclQueryAction.ProcessOclQuery(context);
        result=processor.process(query);
        String processedResult=processResults(result);
        resultList.add(processedResult);
        if (result != null && !classList.contains(result.getClass())) {
          completionList.addAll(processor.getCompletionChoices());
          classList.add(result.getClass());
        }
      }
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          editableListPanel.setResult(MoreToString.Helper.toString(resultList,false,true,null,null,"String_Node_Str","String_Node_Str","String_Node_Str",false));
          editableListPanel.setCompletions(completionList,ProcessOclQuery.toString(processor.getSourceOfCompletion()) + "String_Node_Str" + ProcessOclQuery.getTypeName(processor.getSourceOfCompletion()));
        }
      }
);
    }
    SwingUtilities.invokeLater(new Runnable(){
      @Override public void run(){
        choices.push(query);
        while (choices.size() > maxChoices) {
          choices.pollLast();
        }
        editableListPanel.setItems(choices.toArray());
      }
    }
);
  }
}