Program: 118827
Project: 118827
Buggy source:
/** 
 * DOC hcw Comment method "createContents".
 * @param composite
 */
@Override Control createScdContents(Composite parent){
  SashForm sashForm=new SashForm(parent,SWT.VERTICAL | SWT.SMOOTH);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(sashForm);
  sashForm.setLayout(new GridLayout(1,true));
  sashForm.SASH_WIDTH=1;
  Composite sashPart1=new Composite(sashForm,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20,10).applyTo(sashPart1);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(sashPart1);
  Composite filterUnusedComposite=new Composite(sashPart1,SWT.NONE);
  GridLayoutFactory.swtDefaults().margins(0,0).spacing(0,0).applyTo(filterUnusedComposite);
  GridDataFactory.fillDefaults().span(1,2).grab(true,true).applyTo(filterUnusedComposite);
  ViewerFilter filter=createFilter(filterUnusedComposite);
  unusedFields=new FieldSection(filterUnusedComposite,scdManager,false,false);
  unusedFields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(198,195,198));
  unusedFields.setTableInput(scdManager.getUnusedFields());
  unusedFields.getTableViewer().addFilter(filter);
  unusedFields.setSortable(true);
  GridDataFactory.swtDefaults().grab(true,true).align(SWT.FILL,SWT.FILL).applyTo(unusedFields.getControl());
  addContextHelp(unusedFields.getTableViewer().getTable(),"String_Node_Str");
  type0Fields=new FieldSection(sashPart1,scdManager,false,false);
  type0Fields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(255,146,0));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(type0Fields.getControl());
  type0Fields.setTableInput(scdManager.getType0Table());
  addContextHelp(type0Fields.getTableViewer().getTable(),"String_Node_Str");
  type1Fields=new FieldSection(sashPart1,scdManager,false,false,ScdParameterConstants.DROP_COPY_TYPE1FIELDS);
  type1Fields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(255,203,0));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(type1Fields.getControl());
  type1Fields.setTableInput(scdManager.getType1Table());
  addContextHelp(type1Fields.getTableViewer().getTable(),"String_Node_Str");
  Composite sashPart2=new Composite(sashForm,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20,10).applyTo(sashPart2);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(sashPart2);
  sourceKeys=new FieldSection(sashPart2,scdManager,false,false,ScdParameterConstants.DROP_COPY_SOURCEKEYS);
  sourceKeys.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(156,0,255));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(sourceKeys.getControl());
  sourceKeys.setTableInput(scdManager.getSourceKeys());
  addContextHelp(sourceKeys.getTableViewer().getTable(),"String_Node_Str");
  type2Fields=new Type2Section(sashPart2,scdManager,ScdParameterConstants.DROP_COPY_TYPE2FIELDS);
  type2Fields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(255,255,0));
  GridDataFactory.swtDefaults().span(1,2).align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(type2Fields.getControl());
  type2Fields.setTableInput(scdManager.getType2Table());
  if (scdManager.getVersionData() != null) {
    type2Fields.setVersionInput(scdManager.getVersionData());
  }
 else {
    type2Fields.setVersionInput(new Versioning());
  }
  addContextHelp(type2Fields.getTableViewer().getTable(),"String_Node_Str");
  surrogateKeys=new SurrogateSection(sashPart2,scdManager);
  surrogateKeys.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(214,40,255));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,false).applyTo(surrogateKeys.getControl());
  surrogateKeys.setTableInput(scdManager.getSurrogateKeys());
  surrogateKeys.addContextHelp(this);
  Composite sashPart3=new Composite(sashForm,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20,10).applyTo(sashPart3);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(sashPart3);
  Label placeHolder=new Label(sashPart3,SWT.NONE);
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(placeHolder);
  type3Fields=new Type3Section(sashPart3,scdManager);
  type3Fields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(24,182,255));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(type3Fields.getControl());
  type3Fields.setTableInput(scdManager.getType3Table());
  addContextHelp(type3Fields.getTable(),"String_Node_Str");
  scdManager.setUnusedFieldsSource(unusedFields);
  ScdSection[] sections={surrogateKeys,sourceKeys,type0Fields,type1Fields,type2Fields,type3Fields};
  for (  ScdSection scd : sections) {
    scdManager.addUnusedFieldsTarget(scd);
  }
  sashForm.setSashWidth(3);
  sashForm.pack();
  GridData gridData1=(GridData)filterUnusedComposite.getLayoutData();
  Control type2Control=type2Fields.getControl();
  type2Control.pack();
  GridData gridData2=(GridData)type2Control.getLayoutData();
  Control surrogateControl=surrogateKeys.getControl();
  surrogateControl.pack();
  int totalHeight=getDialogSize().y;
  int surrogateHeight=(surrogateControl.getSize().y + 40) * 2;
  int averageHeight=(int)(totalHeight * 1.0 / 3);
  int sashForm2Height=type2Control.getSize().y;
  if (sashForm2Height < surrogateHeight) {
    sashForm2Height=surrogateHeight;
  }
  if (averageHeight < sashForm2Height) {
    sashForm2Height=(int)((sashForm2Height - averageHeight) * 3.0 / 4 + averageHeight);
    averageHeight=(int)((totalHeight - sashForm2Height) * 2.0 / 5);
  }
  int sashForm3Height=averageHeight;
  int sashForm1Height=totalHeight - sashForm2Height - sashForm3Height;
  gridData1.heightHint=sashForm1Height;
  gridData2.heightHint=sashForm2Height;
  sashForm.setWeights(new int[]{sashForm1Height,sashForm2Height,sashForm3Height});
  return sashForm;
}

Fixed version (ground truth):
/** 
 * DOC hcw Comment method "createContents".
 * @param composite
 */
@Override Control createScdContents(Composite parent){
  SashForm sashForm=new SashForm(parent,SWT.VERTICAL | SWT.SMOOTH);
  GridDataFactory.fillDefaults().grab(true,true).applyTo(sashForm);
  sashForm.setLayout(new GridLayout(1,true));
  sashForm.SASH_WIDTH=1;
  Composite sashPart1=new Composite(sashForm,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20,10).applyTo(sashPart1);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(sashPart1);
  Composite filterUnusedComposite=new Composite(sashPart1,SWT.NONE);
  GridLayoutFactory.swtDefaults().margins(0,0).spacing(0,0).applyTo(filterUnusedComposite);
  GridDataFactory.fillDefaults().span(1,2).grab(true,true).applyTo(filterUnusedComposite);
  ViewerFilter filter=createFilter(filterUnusedComposite);
  unusedFields=new FieldSection(filterUnusedComposite,scdManager,false,false);
  unusedFields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(198,195,198));
  unusedFields.setTableInput(scdManager.getUnusedFields());
  unusedFields.getTableViewer().addFilter(filter);
  unusedFields.setSortable(true);
  GridDataFactory.swtDefaults().grab(true,true).align(SWT.FILL,SWT.FILL).applyTo(unusedFields.getControl());
  addContextHelp(unusedFields.getTableViewer().getTable(),"String_Node_Str");
  type0Fields=new FieldSection(sashPart1,scdManager,false,false);
  type0Fields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(255,146,0));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(type0Fields.getControl());
  type0Fields.setTableInput(scdManager.getType0Table());
  addContextHelp(type0Fields.getTableViewer().getTable(),"String_Node_Str");
  type1Fields=new FieldSection(sashPart1,scdManager,false,false,ScdParameterConstants.DROP_COPY_TYPE1FIELDS);
  type1Fields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(255,203,0));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(type1Fields.getControl());
  type1Fields.setTableInput(scdManager.getType1Table());
  addContextHelp(type1Fields.getTableViewer().getTable(),"String_Node_Str");
  Composite sashPart2=new Composite(sashForm,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20,10).applyTo(sashPart2);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(sashPart2);
  sourceKeys=new FieldSection(sashPart2,scdManager,false,false,ScdParameterConstants.DROP_COPY_SOURCEKEYS);
  sourceKeys.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(156,0,255));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(sourceKeys.getControl());
  sourceKeys.setTableInput(scdManager.getSourceKeys());
  addContextHelp(sourceKeys.getTableViewer().getTable(),"String_Node_Str");
  type2Fields=new Type2Section(sashPart2,scdManager,ScdParameterConstants.DROP_COPY_TYPE2FIELDS);
  type2Fields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(255,255,0));
  GridDataFactory.swtDefaults().span(1,2).align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(type2Fields.getControl());
  type2Fields.setTableInput(scdManager.getType2Table());
  if (scdManager.getVersionData() != null) {
    type2Fields.setVersionInput(scdManager.getVersionData());
  }
 else {
    type2Fields.setVersionInput(new Versioning());
  }
  addContextHelp(type2Fields.getTableViewer().getTable(),"String_Node_Str");
  surrogateKeys=new SurrogateSection(sashPart2,scdManager);
  surrogateKeys.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(214,40,255));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,false).applyTo(surrogateKeys.getControl());
  surrogateKeys.setTableInput(scdManager.getSurrogateKeys());
  surrogateKeys.addContextHelp(this);
  Composite sashPart3=new Composite(sashForm,SWT.NONE);
  GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20,10).applyTo(sashPart3);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(sashPart3);
  Label placeHolder=new Label(sashPart3,SWT.NONE);
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(placeHolder);
  type3Fields=new Type3Section(sashPart3,scdManager);
  type3Fields.setTitle(Messages.getString("String_Node_Str"),SWTResourceManager.getColor(24,182,255));
  GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(type3Fields.getControl());
  type3Fields.setTableInput(scdManager.getType3Table());
  addContextHelp(type3Fields.getTable(),"String_Node_Str");
  scdManager.setUnusedFieldsSource(unusedFields);
  ScdSection[] sections={surrogateKeys,sourceKeys,type0Fields,type1Fields,type2Fields,type3Fields};
  for (  ScdSection scd : sections) {
    scdManager.addUnusedFieldsTarget(scd);
  }
  sashForm.setSashWidth(3);
  int totalHeight=getDialogSize().y;
  sashForm.setWeights(new int[]{totalHeight / 4,totalHeight / 2,totalHeight / 4});
  return sashForm;
}