Program: 139221
Project: 139221
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 < modelElementIndicators.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();
  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);
}