Program: 139132
Project: 139132
Buggy source:
/** 
 * DOC yyi 7466 2010-03-22 change the order of appearence of indicators
 * @param newTree
 * @param step
 */
protected void moveSelectedElements(Tree newTree,int step){
  TreeItem[] selection=newTree.getSelection();
  List<Integer> indexElement=new ArrayList<Integer>();
  List<Integer> indexIndicator=new ArrayList<Integer>();
  int indexColumn=-1;
  String movedType=null;
  for (  TreeItem item : selection) {
    IndicatorUnit indicatorUnit=(IndicatorUnit)item.getData(INDICATOR_UNIT_KEY);
    if (indicatorUnit != null) {
      ModelElementIndicator data=(ModelElementIndicator)item.getData(MODELELEMENT_INDICATOR_KEY);
      IndicatorUnit[] units=data.getIndicatorUnits();
      int index=-1;
      for (int i=0; i < units.length; i++) {
        if (indicatorUnit == units[i]) {
          index=i;
          break;
        }
      }
      if (index + step > -1 && index + step < units.length) {
        Indicator[] inds=new Indicator[units.length];
        for (int i=0; i < units.length; i++) {
          inds[i]=units[i].getIndicator();
        }
        Indicator tmpIndicator=inds[index + step];
        inds[index + step]=inds[index];
        inds[index]=tmpIndicator;
        data.setIndicators(inds);
        movedType="String_Node_Str";
        indexIndicator.add(index + step);
        for (int ic=0; ic < modelElementIndicators.length; ic++) {
          if (modelElementIndicators[ic] == data) {
            indexColumn=ic;
          }
        }
      }
    }
 else {
      ModelElementIndicator data=(ModelElementIndicator)item.getData(MODELELEMENT_INDICATOR_KEY);
      int index=-1;
      for (int i=0; i < modelElementIndicators.length; i++) {
        if (data == modelElementIndicators[i]) {
          index=i;
          break;
        }
      }
      if (index + step > -1 && index + step < modelElementIndicators.length) {
        ModelElementIndicator tmpElement=modelElementIndicators[index + step];
        modelElementIndicators[index + step]=modelElementIndicators[index];
        modelElementIndicators[index]=tmpElement;
        movedType="String_Node_Str";
        indexElement.add(index + step);
      }
    }
  }
  if (null != movedType) {
    setElements(modelElementIndicators);
    if (movedType.equals("String_Node_Str")) {
      for (      int i : indexElement) {
        tree.select(tree.getItem(i));
      }
    }
 else     if (movedType.equals("String_Node_Str")) {
      for (      int i : indexIndicator) {
        tree.select(tree.getItem(indexColumn).getItem(i));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC yyi 7466 2010-03-22 change the order of appearence of indicators
 * @param newTree
 * @param step
 */
protected void moveSelectedElements(Tree newTree,int step){
  TreeItem[] selection=newTree.getSelection();
  if (selection.length > 0) {
    TreeItem item=selection[0];
    IndicatorUnit indicatorUnit=(IndicatorUnit)item.getData(INDICATOR_UNIT_KEY);
    ModelElementIndicator data=(ModelElementIndicator)item.getData(MODELELEMENT_INDICATOR_KEY);
    if (indicatorUnit != null) {
      data=(ModelElementIndicator)item.getData(MODELELEMENT_INDICATOR_KEY);
      TypedReturnCode<IndicatorUnit[]> code=sortIndicatorUnits(data.getIndicatorUnits(),indicatorUnit,step);
      if (code.isOk()) {
        if (null != code.getObject()) {
          Indicator[] inds=new Indicator[code.getObject().length];
          for (int i=0; i < code.getObject().length; i++) {
            inds[i]=code.getObject()[i].getIndicator();
          }
          data.setIndicators(inds);
        }
        setElements(modelElementIndicators);
        selectElement(tree.getItems(),indicatorUnit);
      }
    }
 else {
      data=(ModelElementIndicator)item.getData(MODELELEMENT_INDICATOR_KEY);
      int index=-1;
      for (int i=0; i < modelElementIndicators.length; i++) {
        if (data == modelElementIndicators[i]) {
          index=i;
          break;
        }
      }
      if (index + step > -1 && index + step < modelElementIndicators.length) {
        ModelElementIndicator tmpElement=modelElementIndicators[index + step];
        modelElementIndicators[index + step]=modelElementIndicators[index];
        modelElementIndicators[index]=tmpElement;
        setElements(modelElementIndicators);
        selectElement(tree.getItems(),data);
      }
    }
  }
}