Program: 76673
Project: 76673
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (((Button)e.widget).getSelection()) {
    SessionHandleAdapter.getInstance().getCommandStack().startTrans(Messages.getString("String_Node_Str"));
    for (int i=0; i < toggleProviders.length; i++) {
      BorderInfomation information=new BorderInfomation();
      information.setPosition(toggleProviders[i].getPosition());
      information.setColor(builder.getRGB());
      information.setStyle((String)styleCombo.getSelectedItem());
      information.setWidth((String)widthCombo.getSelectedItem());
      toggles[i].setSelection(true);
      previewCanvas.setBorderInfomation(information);
      try {
        toggleProviders[i].save(information);
      }
 catch (      Exception e1) {
        ExceptionHandler.handle(e1);
      }
    }
    restoreInfo=(BorderInfomation)toggleProviders[toggleProviders.length - 1].load();
    SessionHandleAdapter.getInstance().getCommandStack().commit();
  }
 else {
    boolean reset=true;
    RGB oldColor=null;
    for (int i=0; i < toggleProviders.length; i++) {
      BorderInfomation info=(BorderInfomation)toggleProviders[i].load();
      oldColor=info.getColor();
      if (oldColor == null) {
        oldColor=autoColor;
      }
      if (!(info.getStyle().equals((String)styleCombo.getSelectedItem())) || !(oldColor.equals(builder.getRGB())) || !(info.getWidth().equals((String)widthCombo.getSelectedItem()))) {
        reset=false;
        break;
      }
    }
    if (reset) {
      SessionHandleAdapter.getInstance().getCommandStack().startTrans(Messages.getString("String_Node_Str"));
      for (int i=0; i < toggleProviders.length; i++) {
        previewCanvas.removeBorderInfomation(toggleProviders[i].getPosition());
        toggles[i].setSelection(false);
        try {
          toggleProviders[i].reset();
        }
 catch (        Exception e1) {
          ExceptionHandler.handle(e1);
        }
      }
      SessionHandleAdapter.getInstance().getCommandStack().commit();
    }
 else {
      SessionHandleAdapter.getInstance().getCommandStack().startTrans(Messages.getString("String_Node_Str"));
      for (int i=0; i < toggleProviders.length; i++) {
        BorderInfomation information=new BorderInfomation();
        information.setPosition(toggleProviders[i].getPosition());
        information.setColor(builder.getRGB());
        information.setStyle((String)styleCombo.getSelectedItem());
        information.setWidth((String)widthCombo.getSelectedItem());
        previewCanvas.setBorderInfomation(information);
        restoreInfo=information;
        try {
          toggleProviders[i].save(information);
        }
 catch (        Exception e1) {
          ExceptionHandler.handle(e1);
        }
      }
      ((Button)e.widget).setSelection(true);
      SessionHandleAdapter.getInstance().getCommandStack().commit();
    }
  }
  previewCanvas.redraw();
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  RGB selectedColor=null;
  RGB oldColor=null;
  if (((Button)e.widget).getSelection()) {
    SessionHandleAdapter.getInstance().getCommandStack().startTrans(Messages.getString("String_Node_Str"));
    selectedColor=builder.getRGB();
    if (selectedColor == null) {
      selectedColor=autoColor;
    }
    for (int i=0; i < toggleProviders.length; i++) {
      BorderInfomation information=new BorderInfomation();
      information.setPosition(toggleProviders[i].getPosition());
      information.setColor(selectedColor);
      information.setStyle((String)styleCombo.getSelectedItem());
      information.setWidth((String)widthCombo.getSelectedItem());
      toggles[i].setSelection(true);
      previewCanvas.setBorderInfomation(information);
      restoreInfo=information;
      try {
        toggleProviders[i].save(information);
      }
 catch (      Exception e1) {
        ExceptionHandler.handle(e1);
      }
    }
    SessionHandleAdapter.getInstance().getCommandStack().commit();
  }
 else {
    boolean reset=true;
    for (int i=0; i < toggleProviders.length; i++) {
      BorderInfomation info=(BorderInfomation)toggleProviders[i].load();
      oldColor=info.getColor();
      selectedColor=builder.getRGB();
      if (oldColor == null) {
        oldColor=autoColor;
      }
      if (selectedColor == null) {
        selectedColor=autoColor;
      }
      if (!(info.getStyle().equals((String)styleCombo.getSelectedItem())) || !(oldColor.equals(selectedColor)) || !(info.getWidth().equals((String)widthCombo.getSelectedItem()))) {
        reset=false;
        break;
      }
    }
    if (reset) {
      SessionHandleAdapter.getInstance().getCommandStack().startTrans(Messages.getString("String_Node_Str"));
      for (int i=0; i < toggleProviders.length; i++) {
        previewCanvas.removeBorderInfomation(toggleProviders[i].getPosition());
        toggles[i].setSelection(false);
        try {
          toggleProviders[i].reset();
        }
 catch (        Exception e1) {
          ExceptionHandler.handle(e1);
        }
      }
      SessionHandleAdapter.getInstance().getCommandStack().commit();
    }
 else {
      SessionHandleAdapter.getInstance().getCommandStack().startTrans(Messages.getString("String_Node_Str"));
      for (int i=0; i < toggleProviders.length; i++) {
        BorderInfomation information=new BorderInfomation();
        information.setPosition(toggleProviders[i].getPosition());
        if (builder.getRGB() == null) {
          information.setColor(autoColor);
        }
 else {
          information.setColor(builder.getRGB());
        }
        information.setStyle((String)styleCombo.getSelectedItem());
        information.setWidth((String)widthCombo.getSelectedItem());
        previewCanvas.setBorderInfomation(information);
        restoreInfo=information;
        try {
          toggleProviders[i].save(information);
        }
 catch (        Exception e1) {
          ExceptionHandler.handle(e1);
        }
      }
      ((Button)e.widget).setSelection(true);
      SessionHandleAdapter.getInstance().getCommandStack().commit();
    }
  }
  previewCanvas.redraw();
}