Program: 65425
Project: 65425
Buggy source:
public Control createControl(Composite parent){
  content=new Composite(parent,SWT.NONE);
  GridLayout layout=UIUtil.createGridLayoutWithoutMargin(2,false);
  layout.marginHeight=1;
  layout.marginWidth=1;
  layout.horizontalSpacing=10;
  content.setLayout(layout);
  content.setLayoutData(new GridData(GridData.FILL_BOTH));
  Composite choices=new Composite(content,SWT.NONE);
  GridData data=new GridData(GridData.FILL_BOTH);
  choices.setLayoutData(data);
  layout=WidgetUtil.createGridLayout(2);
  layout.marginHeight=1;
  layout.marginWidth=2;
  choices.setLayout(layout);
  Label styleLabel=FormWidgetFactory.getInstance().createLabel(choices,SWT.LEFT,isFormStyle);
  styleLabel.setText(styleProvider.getDisplayName());
  styleLabel.setLayoutData(new GridData());
  if (isFormStyle) {
    styleCombo=FormWidgetFactory.getInstance().createStyleCombo(choices,(IComboProvider)styleProvider);
  }
 else {
    styleCombo=new StyleCombo(choices,style,(IComboProvider)styleProvider);
  }
  data=new GridData();
  data.widthHint=200;
  styleCombo.setLayoutData(data);
  styleCombo.setItems(((IComboProvider)styleProvider).getDisplayItems());
  styleProvider.setIndex(styleProvider.getDisplayItems()[0].toString());
  Label colorLabel=FormWidgetFactory.getInstance().createLabel(choices,SWT.LEFT,isFormStyle);
  colorLabel.setText(colorProvider.getDisplayName());
  colorLabel.setLayoutData(new GridData());
  builder=new ColorBuilder(choices,SWT.NONE,isFormStyle);
  builder.setChoiceSet(colorProvider.getElementChoiceSet());
  data=new GridData();
  data.widthHint=200;
  data.heightHint=builder.computeSize(SWT.DEFAULT,SWT.DEFAULT).y;
  builder.setLayoutData(data);
  Label widthLabel=FormWidgetFactory.getInstance().createLabel(choices,SWT.LEFT,isFormStyle);
  widthLabel.setText(widthProvider.getDisplayName());
  widthLabel.setLayoutData(new GridData());
  if (isFormStyle) {
    widthCombo=FormWidgetFactory.getInstance().createStyleCombo(choices,(IComboProvider)widthProvider);
  }
 else {
    widthCombo=new StyleCombo(choices,style,(IComboProvider)widthProvider);
  }
  data=new GridData();
  data.widthHint=200;
  widthCombo.setLayoutData(data);
  widthCombo.setItems(((IComboProvider)widthProvider).getDisplayItems());
  widthProvider.setIndex(widthProvider.getDisplayItems()[1].toString());
  Composite composite=new Composite(choices,SWT.NONE);
  layout=new GridLayout();
  layout.horizontalSpacing=7;
  layout.numColumns=toggleProviders.length + 2;
  composite.setLayout(layout);
  data=new GridData();
  data.horizontalSpan=2;
  composite.setLayoutData(data);
  toggles=new Button[toggleProviders.length];
  for (int i=0; i < toggleProviders.length; i++) {
    Button button=new Button(composite,SWT.TOGGLE);
    toggles[i]=button;
    button.setLayoutData(new GridData());
    button.setToolTipText(toggleProviders[i].getTooltipText());
    button.setImage(ReportPlatformUIImages.getImage(toggleProviders[i].getImageName()));
    final BorderToggleDescriptorProvider provider=toggleProviders[i];
    button.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        Button button=((Button)e.widget);
        if (button.getSelection()) {
          handleBorderSelection(provider);
        }
 else {
          handleBorderDeselection(provider,button);
        }
        previewCanvas.redraw();
      }
    }
);
    button.setData(provider);
  }
  allButton=new Button(composite,SWT.TOGGLE);
  allButton.setImage(ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_FRAME));
  allButton.setToolTipText(Messages.getString("String_Node_Str"));
  allButton.setLayoutData(new GridData());
  allButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      RGB selectedColor=null;
      RGB oldColor=null;
      if (((Button)e.widget).getSelection()) {
        CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
        stack.startTrans(Messages.getString("String_Node_Str"));
        selectedColor=builder.getRGB();
        for (int i=0; i < toggleProviders.length; i++) {
          BorderInfomation oldInfo=(BorderInfomation)toggleProviders[i].load();
          BorderInfomation information=new BorderInfomation();
          information.setPosition(toggleProviders[i].getPosition());
          information.setColor(selectedColor);
          information.setStyle((String)styleProvider.getItems()[styleCombo.getSelectionIndex()]);
          information.setWidth((String)widthProvider.getItems()[widthCombo.getSelectionIndex()]);
          information.setInheritedColor(oldInfo.getInheritedColor());
          information.setInheritedStyle(oldInfo.getInheritedStyle());
          information.setInheritedWidth(oldInfo.getInheritedWidth());
          information.setDefaultColor(oldInfo.getDefaultColor());
          information.setDefaultStyle(oldInfo.getDefaultStyle());
          information.setDefaultWidth(oldInfo.getDefaultWidth());
          toggles[i].setSelection(true);
          previewCanvas.setBorderInfomation(information);
          restoreInfo=information;
          try {
            toggleProviders[i].save(information);
          }
 catch (          Exception e1) {
            ExceptionUtil.handle(e1);
          }
        }
        stack.commit();
      }
 else {
        boolean reset=true;
        for (int i=0; i < toggleProviders.length; i++) {
          BorderInfomation info=(BorderInfomation)toggleProviders[i].load();
          oldColor=info.getOriginColor();
          selectedColor=builder.getRGB();
          if (!(info.getOriginStyle().equals((String)styleProvider.getItems()[styleCombo.getSelectionIndex()])) || !((oldColor == null && selectedColor == null) || (oldColor != null && oldColor.equals(selectedColor))) || !(resolveEmptyWidth(info).equals((String)widthProvider.getItems()[widthCombo.getSelectionIndex()]))) {
            reset=false;
            break;
          }
        }
        if (reset) {
          CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
          stack.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) {
              ExceptionUtil.handle(e1);
            }
          }
          stack.commit();
        }
 else {
          CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
          stack.startTrans(Messages.getString("String_Node_Str"));
          for (int i=0; i < toggleProviders.length; i++) {
            BorderInfomation oldInfo=(BorderInfomation)toggleProviders[i].load();
            BorderInfomation information=new BorderInfomation();
            information.setPosition(toggleProviders[i].getPosition());
            information.setColor(builder.getRGB());
            information.setStyle((String)styleProvider.getItems()[styleCombo.getSelectionIndex()]);
            information.setWidth((String)widthProvider.getItems()[widthCombo.getSelectionIndex()]);
            information.setInheritedColor(oldInfo.getInheritedColor());
            information.setInheritedStyle(oldInfo.getInheritedStyle());
            information.setInheritedWidth(oldInfo.getInheritedWidth());
            information.setDefaultColor(oldInfo.getDefaultColor());
            information.setDefaultStyle(oldInfo.getDefaultStyle());
            information.setDefaultWidth(oldInfo.getDefaultWidth());
            previewCanvas.setBorderInfomation(information);
            restoreInfo=information;
            try {
              toggleProviders[i].save(information);
            }
 catch (            Exception e1) {
              ExceptionUtil.handle(e1);
            }
          }
          ((Button)e.widget).setSelection(true);
          stack.commit();
        }
      }
      previewCanvas.redraw();
    }
  }
);
  Button noneButton=new Button(composite,SWT.PUSH);
  noneButton.setImage(ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_NONE));
  noneButton.setToolTipText(Messages.getString("String_Node_Str"));
  noneButton.setLayoutData(new GridData());
  noneButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
      stack.startTrans(Messages.getString("String_Node_Str"));
      for (int i=0; i < toggleProviders.length; i++) {
        BorderInfomation oldInfo=(BorderInfomation)toggleProviders[i].load();
        BorderInfomation information=new BorderInfomation();
        information.setPosition(toggleProviders[i].getPosition());
        information.setStyle(DesignChoiceConstants.LINE_STYLE_NONE);
        information.setInheritedColor(oldInfo.getInheritedColor());
        information.setInheritedStyle(oldInfo.getInheritedStyle());
        information.setInheritedWidth(oldInfo.getInheritedWidth());
        information.setDefaultColor(oldInfo.getDefaultColor());
        information.setDefaultStyle(oldInfo.getDefaultStyle());
        information.setDefaultWidth(oldInfo.getDefaultWidth());
        toggles[i].setSelection(true);
        previewCanvas.setBorderInfomation(information);
        restoreInfo=information;
        try {
          toggleProviders[i].save(information);
        }
 catch (        Exception e1) {
          ExceptionUtil.handle(e1);
        }
      }
      stack.commit();
      previewCanvas.redraw();
    }
  }
);
  Composite previewContainer=new Composite(content,SWT.NONE);
  data=new GridData(GridData.FILL_BOTH);
  previewContainer.setLayoutData(data);
  layout=new GridLayout();
  layout.numColumns=2;
  layout.marginHeight=1;
  layout.marginWidth=10;
  previewContainer.setLayout(layout);
  Label previewLabel=FormWidgetFactory.getInstance().createLabel(previewContainer,SWT.LEFT,isFormStyle);
  data=new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
  previewLabel.setLayoutData(data);
  previewLabel.setText(Messages.getString("String_Node_Str"));
  previewCanvas=new BorderCanvas(previewContainer,SWT.NONE);
  data=new GridData();
  data.widthHint=130;
  data.heightHint=130;
  previewCanvas.setLayoutData(data);
  previewCanvas.setListener(this);
  return content;
}

Fixed version (ground truth):
public Control createControl(Composite parent){
  content=new Composite(parent,SWT.NONE);
  GridLayout layout=UIUtil.createGridLayoutWithoutMargin(2,false);
  layout.marginHeight=1;
  layout.marginWidth=1;
  layout.horizontalSpacing=10;
  content.setLayout(layout);
  content.setLayoutData(new GridData(GridData.FILL_BOTH));
  Composite choices=new Composite(content,SWT.NONE);
  GridData data=new GridData(GridData.FILL_BOTH);
  choices.setLayoutData(data);
  layout=WidgetUtil.createGridLayout(2);
  layout.marginHeight=1;
  layout.marginWidth=2;
  choices.setLayout(layout);
  Label styleLabel=FormWidgetFactory.getInstance().createLabel(choices,SWT.LEFT,isFormStyle);
  styleLabel.setText(styleProvider.getDisplayName());
  styleLabel.setLayoutData(new GridData());
  if (isFormStyle) {
    styleCombo=FormWidgetFactory.getInstance().createStyleCombo(choices,(IComboProvider)styleProvider);
  }
 else {
    styleCombo=new StyleCombo(choices,style,(IComboProvider)styleProvider);
  }
  data=new GridData();
  data.widthHint=200;
  styleCombo.setLayoutData(data);
  styleCombo.setItems(((IComboProvider)styleProvider).getDisplayItems());
  styleProvider.setIndex(styleProvider.getDisplayItems()[0].toString());
  Label colorLabel=FormWidgetFactory.getInstance().createLabel(choices,SWT.LEFT,isFormStyle);
  colorLabel.setText(colorProvider.getDisplayName());
  colorLabel.setLayoutData(new GridData());
  builder=new ColorBuilder(choices,SWT.NONE,isFormStyle);
  builder.setChoiceSet(colorProvider.getElementChoiceSet());
  data=new GridData();
  data.widthHint=200;
  data.heightHint=builder.computeSize(SWT.DEFAULT,SWT.DEFAULT).y;
  builder.setLayoutData(data);
  Label widthLabel=FormWidgetFactory.getInstance().createLabel(choices,SWT.LEFT,isFormStyle);
  widthLabel.setText(widthProvider.getDisplayName());
  widthLabel.setLayoutData(new GridData());
  if (isFormStyle) {
    widthCombo=FormWidgetFactory.getInstance().createStyleCombo(choices,(IComboProvider)widthProvider);
  }
 else {
    widthCombo=new StyleCombo(choices,style,(IComboProvider)widthProvider);
  }
  data=new GridData();
  data.widthHint=200;
  widthCombo.setLayoutData(data);
  widthCombo.setItems(((IComboProvider)widthProvider).getDisplayItems());
  widthProvider.setIndex(widthProvider.getDisplayItems()[1].toString());
  Composite composite=new Composite(choices,SWT.NONE);
  layout=new GridLayout();
  layout.horizontalSpacing=7;
  layout.numColumns=toggleProviders.length + 2;
  composite.setLayout(layout);
  data=new GridData();
  data.horizontalSpan=2;
  composite.setLayoutData(data);
  toggles=new Button[toggleProviders.length];
  for (int i=0; i < toggleProviders.length; i++) {
    Button button=new Button(composite,SWT.TOGGLE);
    toggles[i]=button;
    button.setLayoutData(new GridData());
    button.setToolTipText(toggleProviders[i].getTooltipText());
    button.setImage(ReportPlatformUIImages.getImage(toggleProviders[i].getImageName()));
    final BorderToggleDescriptorProvider provider=toggleProviders[i];
    button.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        Button button=((Button)e.widget);
        if (button.getSelection()) {
          handleBorderSelection(provider);
        }
 else {
          handleBorderDeselection(provider,button);
        }
        previewCanvas.redraw();
      }
    }
);
    button.setData(provider);
    button.getAccessible().addAccessibleListener(new AccessibleAdapter(){
      public void getName(      AccessibleEvent e){
        Accessible accessible=(Accessible)e.getSource();
        Button item=(Button)accessible.getControl();
        if (item != null) {
          e.result=item.getToolTipText();
        }
      }
    }
);
  }
  allButton=new Button(composite,SWT.TOGGLE);
  allButton.setImage(ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_FRAME));
  allButton.setToolTipText(Messages.getString("String_Node_Str"));
  allButton.getAccessible().addAccessibleListener(new AccessibleAdapter(){
    public void getName(    AccessibleEvent e){
      Accessible accessible=(Accessible)e.getSource();
      Button item=(Button)accessible.getControl();
      if (item != null) {
        e.result=item.getToolTipText();
      }
    }
  }
);
  allButton.setLayoutData(new GridData());
  allButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      RGB selectedColor=null;
      RGB oldColor=null;
      if (((Button)e.widget).getSelection()) {
        CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
        stack.startTrans(Messages.getString("String_Node_Str"));
        selectedColor=builder.getRGB();
        for (int i=0; i < toggleProviders.length; i++) {
          BorderInfomation oldInfo=(BorderInfomation)toggleProviders[i].load();
          BorderInfomation information=new BorderInfomation();
          information.setPosition(toggleProviders[i].getPosition());
          information.setColor(selectedColor);
          information.setStyle((String)styleProvider.getItems()[styleCombo.getSelectionIndex()]);
          information.setWidth((String)widthProvider.getItems()[widthCombo.getSelectionIndex()]);
          information.setInheritedColor(oldInfo.getInheritedColor());
          information.setInheritedStyle(oldInfo.getInheritedStyle());
          information.setInheritedWidth(oldInfo.getInheritedWidth());
          information.setDefaultColor(oldInfo.getDefaultColor());
          information.setDefaultStyle(oldInfo.getDefaultStyle());
          information.setDefaultWidth(oldInfo.getDefaultWidth());
          toggles[i].setSelection(true);
          previewCanvas.setBorderInfomation(information);
          restoreInfo=information;
          try {
            toggleProviders[i].save(information);
          }
 catch (          Exception e1) {
            ExceptionUtil.handle(e1);
          }
        }
        stack.commit();
      }
 else {
        boolean reset=true;
        for (int i=0; i < toggleProviders.length; i++) {
          BorderInfomation info=(BorderInfomation)toggleProviders[i].load();
          oldColor=info.getOriginColor();
          selectedColor=builder.getRGB();
          if (!(info.getOriginStyle().equals((String)styleProvider.getItems()[styleCombo.getSelectionIndex()])) || !((oldColor == null && selectedColor == null) || (oldColor != null && oldColor.equals(selectedColor))) || !(resolveEmptyWidth(info).equals((String)widthProvider.getItems()[widthCombo.getSelectionIndex()]))) {
            reset=false;
            break;
          }
        }
        if (reset) {
          CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
          stack.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) {
              ExceptionUtil.handle(e1);
            }
          }
          stack.commit();
        }
 else {
          CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
          stack.startTrans(Messages.getString("String_Node_Str"));
          for (int i=0; i < toggleProviders.length; i++) {
            BorderInfomation oldInfo=(BorderInfomation)toggleProviders[i].load();
            BorderInfomation information=new BorderInfomation();
            information.setPosition(toggleProviders[i].getPosition());
            information.setColor(builder.getRGB());
            information.setStyle((String)styleProvider.getItems()[styleCombo.getSelectionIndex()]);
            information.setWidth((String)widthProvider.getItems()[widthCombo.getSelectionIndex()]);
            information.setInheritedColor(oldInfo.getInheritedColor());
            information.setInheritedStyle(oldInfo.getInheritedStyle());
            information.setInheritedWidth(oldInfo.getInheritedWidth());
            information.setDefaultColor(oldInfo.getDefaultColor());
            information.setDefaultStyle(oldInfo.getDefaultStyle());
            information.setDefaultWidth(oldInfo.getDefaultWidth());
            previewCanvas.setBorderInfomation(information);
            restoreInfo=information;
            try {
              toggleProviders[i].save(information);
            }
 catch (            Exception e1) {
              ExceptionUtil.handle(e1);
            }
          }
          ((Button)e.widget).setSelection(true);
          stack.commit();
        }
      }
      previewCanvas.redraw();
    }
  }
);
  Button noneButton=new Button(composite,SWT.PUSH);
  noneButton.setImage(ReportPlatformUIImages.getImage(IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_NONE));
  noneButton.setToolTipText(Messages.getString("String_Node_Str"));
  noneButton.getAccessible().addAccessibleListener(new AccessibleAdapter(){
    public void getName(    AccessibleEvent e){
      Accessible accessible=(Accessible)e.getSource();
      Button item=(Button)accessible.getControl();
      if (item != null) {
        e.result=item.getToolTipText();
      }
    }
  }
);
  noneButton.setLayoutData(new GridData());
  noneButton.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      CommandStack stack=SessionHandleAdapter.getInstance().getCommandStack();
      stack.startTrans(Messages.getString("String_Node_Str"));
      for (int i=0; i < toggleProviders.length; i++) {
        BorderInfomation oldInfo=(BorderInfomation)toggleProviders[i].load();
        BorderInfomation information=new BorderInfomation();
        information.setPosition(toggleProviders[i].getPosition());
        information.setStyle(DesignChoiceConstants.LINE_STYLE_NONE);
        information.setInheritedColor(oldInfo.getInheritedColor());
        information.setInheritedStyle(oldInfo.getInheritedStyle());
        information.setInheritedWidth(oldInfo.getInheritedWidth());
        information.setDefaultColor(oldInfo.getDefaultColor());
        information.setDefaultStyle(oldInfo.getDefaultStyle());
        information.setDefaultWidth(oldInfo.getDefaultWidth());
        toggles[i].setSelection(true);
        previewCanvas.setBorderInfomation(information);
        restoreInfo=information;
        try {
          toggleProviders[i].save(information);
        }
 catch (        Exception e1) {
          ExceptionUtil.handle(e1);
        }
      }
      stack.commit();
      previewCanvas.redraw();
    }
  }
);
  Composite previewContainer=new Composite(content,SWT.NONE);
  data=new GridData(GridData.FILL_BOTH);
  previewContainer.setLayoutData(data);
  layout=new GridLayout();
  layout.numColumns=2;
  layout.marginHeight=1;
  layout.marginWidth=10;
  previewContainer.setLayout(layout);
  Label previewLabel=FormWidgetFactory.getInstance().createLabel(previewContainer,SWT.LEFT,isFormStyle);
  data=new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
  previewLabel.setLayoutData(data);
  previewLabel.setText(Messages.getString("String_Node_Str"));
  previewCanvas=new BorderCanvas(previewContainer,SWT.NONE);
  data=new GridData();
  data.widthHint=130;
  data.heightHint=130;
  previewCanvas.setLayoutData(data);
  previewCanvas.setListener(this);
  return content;
}