Program: 65295
Project: 65295
Buggy source:
public void handleSelectionChanged(ISelection selection){
  if (editorUIEnabled == true) {
    saveModel();
  }
  if (selection != null) {
    Object[] sel=((IStructuredSelection)selection).toArray();
    IElementPropertyDefn targetMethod=null;
    if (sel.length == 1) {
      editObject=sel[0];
      if (sel[0] instanceof ScriptElementNode) {
        editObject=((ScriptElementNode)editObject).getParent();
      }
 else       if (sel[0] instanceof ScriptObjectNode) {
        editObject=((ScriptObjectNode)editObject).getParent();
      }
      if (editObject instanceof PropertyHandle) {
        targetMethod=((PropertyHandle)editObject).getPropertyDefn();
        if (targetMethod.getMethodInfo() != null) {
          editObject=((PropertyHandle)editObject).getElementHandle();
        }
      }
    }
    if (editObject instanceof DesignElementHandle) {
      palettePage.getSupport().setCurrentEditObject(editObject);
      setComboViewerInput(editObject);
      cmbItemLastSelected=null;
      setEditorText("String_Node_Str");
      if (cmbExpList.getItemCount() > 0) {
        enableEditor();
        if (targetMethod != null) {
          selectItemInComboExpList(new StructuredSelection(targetMethod));
        }
 else {
          ISelection oldSelection=(ISelection)selectionMap.get(getModel());
          if (oldSelection instanceof StructuredSelection && ((StructuredSelection)oldSelection).size() > 1) {
            selectItemInComboExpList(new StructuredSelection(((StructuredSelection)oldSelection).toArray()[0]));
            cmbSubFunctionsViewer.setSelection(new StructuredSelection(((StructuredSelection)oldSelection).toArray()[1]));
          }
 else {
            selectItemInComboExpList(oldSelection);
          }
        }
      }
 else {
        disableEditor();
      }
      checkDirty();
      palettePage.getSupport().updateParametersTree();
    }
 else {
      disableEditor();
      cmbExpList.removeAll();
      cmbSubFunctions.setItems(null);
      cmbItemLastSelected=null;
      palettePage.getSupport().setCurrentEditObject(null);
    }
    if (sel.length > 0) {
      updateAnnotationLabel(sel[0]);
    }
  }
}

Fixed version (ground truth):
public void handleSelectionChanged(ISelection selection){
  if (editorUIEnabled == true) {
    saveModel();
  }
  if (selection != null) {
    Object[] sel=((IStructuredSelection)selection).toArray();
    IElementPropertyDefn targetMethod=null;
    if (sel.length == 1) {
      editObject=sel[0];
      if (sel[0] instanceof ScriptElementNode) {
        editObject=((ScriptElementNode)editObject).getParent();
      }
 else       if (sel[0] instanceof ScriptObjectNode) {
        editObject=((ScriptObjectNode)editObject).getParent();
      }
      if (editObject instanceof PropertyHandle) {
        targetMethod=((PropertyHandle)editObject).getPropertyDefn();
        if (targetMethod.getMethodInfo() != null) {
          editObject=((PropertyHandle)editObject).getElementHandle();
        }
      }
    }
    if (editObject instanceof DesignElementHandle) {
      palettePage.getSupport().setCurrentEditObject(editObject);
      setComboViewerInput(editObject);
      cmbItemLastSelected=null;
      setEditorText("String_Node_Str");
      if (cmbExpList.getItemCount() > 0) {
        enableEditor();
        if (targetMethod != null) {
          selectItemInComboExpList(new StructuredSelection(targetMethod));
        }
 else {
          ISelection oldSelection=(ISelection)selectionMap.get(getModel());
          if (oldSelection instanceof StructuredSelection && ((StructuredSelection)oldSelection).size() > 1) {
            Object[] sels=((StructuredSelection)oldSelection).toArray();
            selectItemInComboExpList(new StructuredSelection(sels[0]));
            cmbSubFunctionsViewer.setSelection(new StructuredSelection(sels[1]));
          }
 else {
            selectItemInComboExpList(oldSelection);
          }
        }
      }
 else {
        disableEditor();
      }
      checkDirty();
      palettePage.getSupport().updateParametersTree();
    }
 else {
      disableEditor();
      cmbExpList.removeAll();
      cmbSubFunctions.setItems(null);
      cmbItemLastSelected=null;
      palettePage.getSupport().setCurrentEditObject(null);
    }
    if (sel.length > 0) {
      updateAnnotationLabel(sel[0]);
    }
  }
}