Program: 123240
Project: 123240
Buggy source:
public void selectionChanged(SelectionChangedEvent event){
  if (!event.getSelection().isEmpty() && event.getSelection() instanceof IStructuredSelection) {
    Iterator iterator=((IStructuredSelection)event.getSelection()).iterator();
    while (iterator.hasNext()) {
      Object firstElement=iterator.next();
      if (firstElement instanceof AbstractNodePart) {
        AbstractNode model=(AbstractNode)((AbstractNodePart)firstElement).getModel();
        boolean isInputMain=false;
        if (model instanceof OutputTreeNode) {
          OutputTreeNode outputTreeNodeRoot=(OutputTreeNode)XmlMapUtil.getTreeNodeRoot((OutputTreeNode)model);
          if (outputTreeNodeRoot != null && outputTreeNodeRoot.eContainer() instanceof OutputXmlTree) {
            selectOutputXmlTree((OutputXmlTree)outputTreeNodeRoot.eContainer());
            onSelectedEntries((IStructuredSelection)event.getSelection(),selectedOutputTree);
          }
        }
 else         if (model instanceof TreeNode) {
          TreeNode inputTreeNodeRoot=XmlMapUtil.getTreeNodeRoot((TreeNode)model);
          if (inputTreeNodeRoot != null && inputTreeNodeRoot.eContainer() instanceof InputXmlTree) {
            selectInputXmlTree((InputXmlTree)inputTreeNodeRoot.eContainer());
            isInputMain=!((InputXmlTree)inputTreeNodeRoot.eContainer()).isLookup();
            onSelectedEntries((IStructuredSelection)event.getSelection(),selectedInputTree);
          }
        }
        if (!isInputMain) {
          refreshStyledTextEditor(model);
        }
 else {
          refreshStyledTextEditor(null);
        }
      }
 else       if (firstElement instanceof InputXmlTreeEditPart) {
        selectInputXmlTree((InputXmlTree)((InputXmlTreeEditPart)firstElement).getModel());
        refreshStyledTextEditor(null);
      }
 else       if (firstElement instanceof OutputXmlTreeEditPart) {
        selectOutputXmlTree((OutputXmlTree)((OutputXmlTreeEditPart)firstElement).getModel());
        refreshStyledTextEditor(null);
      }
    }
  }
 else {
    ExtendedTableModel<TreeSchemaTableEntry> oldModel=mapperUI.getTabFolderEditors().getInputTreeSchemaEditor().getExtendedTableModel();
    if (oldModel != null && oldModel.getBeanCount() != 0) {
      List<TreeSchemaTableEntry> treeSchemaEntrys=new ArrayList<TreeSchemaTableEntry>();
      mapperUI.getTabFolderEditors().getInputTreeSchemaEditor().setExtendedControlModel(new ExtendedTableModel<TreeSchemaTableEntry>("String_Node_Str",treeSchemaEntrys));
      mapperUI.getTabFolderEditors().getInputTreeSchemaEditor().getTableViewerCreator().refresh();
    }
    refreshStyledTextEditor(null);
  }
}

Fixed version (ground truth):
public void selectionChanged(SelectionChangedEvent event){
  if (!event.getSelection().isEmpty() && event.getSelection() instanceof IStructuredSelection) {
    Iterator iterator=((IStructuredSelection)event.getSelection()).iterator();
    while (iterator.hasNext()) {
      Object firstElement=iterator.next();
      if (firstElement instanceof AbstractNodePart) {
        AbstractNode model=(AbstractNode)((AbstractNodePart)firstElement).getModel();
        boolean isInputMain=false;
        if (model instanceof OutputTreeNode) {
          OutputTreeNode outputTreeNodeRoot=(OutputTreeNode)XmlMapUtil.getTreeNodeRoot((OutputTreeNode)model);
          if (outputTreeNodeRoot != null && outputTreeNodeRoot.eContainer() instanceof OutputXmlTree) {
            selectOutputXmlTree((OutputXmlTree)outputTreeNodeRoot.eContainer());
            onSelectedEntries((IStructuredSelection)event.getSelection(),selectedOutputTree);
          }
        }
 else         if (model instanceof TreeNode) {
          TreeNode inputTreeNodeRoot=XmlMapUtil.getTreeNodeRoot((TreeNode)model);
          if (inputTreeNodeRoot != null && inputTreeNodeRoot.eContainer() instanceof InputXmlTree) {
            selectInputXmlTree((InputXmlTree)inputTreeNodeRoot.eContainer());
            isInputMain=!((InputXmlTree)inputTreeNodeRoot.eContainer()).isLookup();
            onSelectedEntries((IStructuredSelection)event.getSelection(),selectedInputTree);
          }
        }
        if (!isInputMain) {
          refreshStyledTextEditor((AbstractNodePart)firstElement);
        }
 else {
          refreshStyledTextEditor(null);
        }
      }
 else       if (firstElement instanceof InputXmlTreeEditPart) {
        selectInputXmlTree((InputXmlTree)((InputXmlTreeEditPart)firstElement).getModel());
        refreshStyledTextEditor(null);
      }
 else       if (firstElement instanceof OutputXmlTreeEditPart) {
        selectOutputXmlTree((OutputXmlTree)((OutputXmlTreeEditPart)firstElement).getModel());
        refreshStyledTextEditor(null);
      }
    }
  }
 else {
    ExtendedTableModel<TreeSchemaTableEntry> oldModel=mapperUI.getTabFolderEditors().getInputTreeSchemaEditor().getExtendedTableModel();
    if (oldModel != null && oldModel.getBeanCount() != 0) {
      List<TreeSchemaTableEntry> treeSchemaEntrys=new ArrayList<TreeSchemaTableEntry>();
      mapperUI.getTabFolderEditors().getInputTreeSchemaEditor().setExtendedControlModel(new ExtendedTableModel<TreeSchemaTableEntry>("String_Node_Str",treeSchemaEntrys));
      mapperUI.getTabFolderEditors().getInputTreeSchemaEditor().getTableViewerCreator().refresh();
    }
    refreshStyledTextEditor(null);
  }
}