Program: 129702
Project: 129702
Buggy source:
/** 
 * Only activate the view content providers with the extension ID belonging to extensionIdsToActivate array.
 * @param extensionIdsToActivate
 * @param restoring, used because setting new selection cause renentrance and may create 2 action types whenrestoring state
 */
protected void refreshNavigatorContents(String[] extensionIdsToActivate,boolean restoring){
  boolean updateExtensionActivation=false;
  String[] contentExtensionsToActivate=Arrays.copyOf(extensionIdsToActivate,extensionIdsToActivate.length);
  Arrays.sort(contentExtensionsToActivate);
  IStructuredSelection ssel=null;
  CommonViewer commonViewer=getCommonViewer();
  INavigatorContentService contentService=getNavigatorContentService();
  try {
    commonViewer.getControl().setRedraw(false);
    ISelection selection=commonViewer.getSelection();
    if (selection instanceof IStructuredSelection) {
      ssel=(IStructuredSelection)selection;
    }
    INavigatorContentDescriptor[] visibleContentDescriptors=contentService.getVisibleExtensions();
    int indexofContentExtensionIdToBeActivated;
    for (int i=0; i < visibleContentDescriptors.length && !updateExtensionActivation; i++) {
      indexofContentExtensionIdToBeActivated=Arrays.binarySearch(contentExtensionsToActivate,visibleContentDescriptors[i].getId());
      if (indexofContentExtensionIdToBeActivated >= 0 ^ contentService.isActive(visibleContentDescriptors[i].getId())) {
        updateExtensionActivation=true;
      }
    }
    if (updateExtensionActivation) {
      contentService.getActivationService().activateExtensions(contentExtensionsToActivate,true);
      contentService.getActivationService().persistExtensionActivations();
      Object[] expandedElements=commonViewer.getExpandedElements();
      contentService.update();
      commonViewer.refresh();
      if (!restoring) {
        Object[] originalObjects=ssel != null ? ssel.toArray() : new Object[0];
        commonViewer.setExpandedElements(expandedElements);
        IStructuredSelection newSelection=new StructuredSelection(originalObjects);
        commonViewer.setSelection(newSelection,true);
      }
    }
  }
  finally {
    commonViewer.getControl().setRedraw(true);
  }
}

Fixed version (ground truth):
/** 
 * Only activate the view content providers with the extension ID belonging to extensionIdsToActivate array.
 * @param extensionIdsToActivate
 * @param restoring, used because setting new selection cause renentrance and may create 2 action types whenrestoring state
 */
protected void refreshNavigatorContents(String[] extensionIdsToActivate,boolean restoring){
  boolean updateExtensionActivation=false;
  String[] contentExtensionsToActivate=Arrays.copyOf(extensionIdsToActivate,extensionIdsToActivate.length);
  Arrays.sort(contentExtensionsToActivate);
  IStructuredSelection ssel=null;
  TreeViewer commonViewer=getTreeViewer();
  INavigatorContentService contentService=getNavigatorContentService();
  try {
    commonViewer.getControl().setRedraw(false);
    ISelection selection=commonViewer.getSelection();
    if (selection instanceof IStructuredSelection) {
      ssel=(IStructuredSelection)selection;
    }
    INavigatorContentDescriptor[] visibleContentDescriptors=contentService.getVisibleExtensions();
    int indexofContentExtensionIdToBeActivated;
    for (int i=0; i < visibleContentDescriptors.length && !updateExtensionActivation; i++) {
      indexofContentExtensionIdToBeActivated=Arrays.binarySearch(contentExtensionsToActivate,visibleContentDescriptors[i].getId());
      if (indexofContentExtensionIdToBeActivated >= 0 ^ contentService.isActive(visibleContentDescriptors[i].getId())) {
        updateExtensionActivation=true;
      }
    }
    if (updateExtensionActivation) {
      contentService.getActivationService().activateExtensions(contentExtensionsToActivate,true);
      contentService.getActivationService().persistExtensionActivations();
      Object[] expandedElements=commonViewer.getExpandedElements();
      contentService.update();
      commonViewer.refresh();
      if (!restoring) {
        Object[] originalObjects=ssel != null ? ssel.toArray() : new Object[0];
        commonViewer.setExpandedElements(expandedElements);
        IStructuredSelection newSelection=new StructuredSelection(originalObjects);
        commonViewer.setSelection(newSelection,true);
      }
    }
  }
  finally {
    commonViewer.getControl().setRedraw(true);
  }
}