Program: 139139
Project: 139139
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();
  boolean moved=false;
  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);
        moved=true;
      }
    }
 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;
        moved=true;
      }
    }
  }
  if (moved)   setElements(modelElementIndicators);
}

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();
  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));
      }
    }
  }
}