Program: 69655
Project: 69655
Buggy source:
public Composite createArea(Composite parent){
  int numColumns=2;
  if (description != null && description.length() > 0) {
    numColumns++;
  }
  if ((style & BUTTON_AGGREGATION) == BUTTON_AGGREGATION) {
    numColumns++;
  }
  if ((style & BUTTON_GROUP) == BUTTON_GROUP) {
    numColumns++;
  }
  cmpTop=new Composite(parent,SWT.NONE);
{
    GridLayout glContent=new GridLayout();
    glContent.numColumns=numColumns;
    glContent.marginHeight=0;
    glContent.marginWidth=0;
    glContent.horizontalSpacing=2;
    cmpTop.setLayout(glContent);
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    cmpTop.setLayoutData(gd);
  }
  Label lblDesc=null;
  if (description != null && description.length() > 0) {
    lblDesc=new Label(cmpTop,SWT.NONE);
    lblDesc.setText(description);
    lblDesc.setToolTipText(tooltipWhenBlank);
  }
  if ((style & BUTTON_AGGREGATION) == BUTTON_AGGREGATION) {
    createAggregationItem(cmpTop);
  }
  boolean isSharingChart=context.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_CHART_QUERY);
  final Object[] predefinedQuery=context.getPredefinedQuery(queryType);
  IDataServiceProvider provider=context.getDataServiceProvider();
  boolean needComboField=predefinedQuery != null && predefinedQuery.length > 0 && (provider.checkState(IDataServiceProvider.SHARE_QUERY) || provider.checkState(IDataServiceProvider.HAS_CUBE) || provider.checkState(IDataServiceProvider.INHERIT_COLUMNS_GROUPS));
  needComboField&=!isSharingChart;
  boolean hasContentAssist=(!isSharingChart && predefinedQuery != null && predefinedQuery.length > 0);
  if (needComboField) {
    Composite control=new Composite(cmpTop,SWT.NONE);
    GridData gd=new GridData(GridData.FILL_BOTH);
    gd.widthHint=80;
    control.setLayoutData(gd);
    GridLayout gl=new GridLayout();
    FieldAssistHelper.getInstance().initDecorationMargin(gl);
    control.setLayout(gl);
    cmbDefinition=new CCombo(control,context.getDataServiceProvider().checkState(IDataServiceProvider.PART_CHART) ? SWT.READ_ONLY | SWT.BORDER : SWT.BORDER);
    gd=new GridData(GridData.FILL_HORIZONTAL);
    gd.grabExcessHorizontalSpace=true;
    cmbDefinition.setLayoutData(gd);
    if (hasContentAssist) {
      String[] items=getContentItems(predefinedQuery);
      if (items != null) {
        new CComboAssistField(cmbDefinition,null,items);
      }
    }
    if (predefinedQuery.length > 0) {
      populateExprComboItems(predefinedQuery);
    }
 else     if (getQuery().getDefinition() == null || getQuery().getDefinition().equals("String_Node_Str")) {
      cmbDefinition.setEnabled(false);
    }
    cmbDefinition.addListener(SWT.Selection,new Listener(){
      public void handleEvent(      Event event){
        String oldQuery=query.getDefinition() == null ? "String_Node_Str" : query.getDefinition();
        String text=cmbDefinition.getText();
        if (!isTableSharedBinding() && text.equals(oldQuery)) {
          return;
        }
        updateQuery(text);
        if (!oldQuery.equals(text) && queryType == ChartUIConstants.QUERY_VALUE) {
          if (context.getDataServiceProvider().update(ChartUIConstants.QUERY_VALUE,text)) {
            Event e=new Event();
            e.data=BaseDataDefinitionComponent.this;
            e.widget=cmbDefinition;
            e.type=IChartDataSheet.EVENT_QUERY;
            context.getDataSheet().notifyListeners(e);
          }
        }
        if (context.getDataServiceProvider().checkState(IDataServiceProvider.PART_CHART) && ChartUIConstants.QUERY_CATEGORY.equals(queryType) && context.getModel() instanceof ChartWithAxes) {
          ((ChartWithAxes)context.getModel()).setTransposed(cmbDefinition.getSelectionIndex() > 0);
        }
        if (predefinedQuery.length == 0 && (getQuery().getDefinition() == null || getQuery().getDefinition().equals("String_Node_Str"))) {
          cmbDefinition.setEnabled(false);
        }
      }
    }
);
    cmbDefinition.addModifyListener(this);
    cmbDefinition.addFocusListener(this);
    cmbDefinition.addKeyListener(this);
    initComboExprText();
  }
 else {
    Composite control=cmpTop;
    if (hasContentAssist) {
      control=new Composite(cmpTop,SWT.NONE);
      GridData gd=new GridData(GridData.FILL_BOTH);
      gd.widthHint=80;
      control.setLayoutData(gd);
      GridLayout gl=new GridLayout();
      FieldAssistHelper.getInstance().initDecorationMargin(gl);
      control.setLayout(gl);
    }
    txtDefinition=new Text(control,SWT.BORDER | SWT.SINGLE);
    GridData gdTXTDefinition=new GridData(GridData.FILL_HORIZONTAL);
    gdTXTDefinition.widthHint=80;
    gdTXTDefinition.grabExcessHorizontalSpace=true;
    txtDefinition.setLayoutData(gdTXTDefinition);
    if (query != null && query.getDefinition() != null) {
      txtDefinition.setText(query.getDefinition());
      txtDefinition.setToolTipText(getTooltipForDataText(query.getDefinition()));
    }
    txtDefinition.addModifyListener(this);
    txtDefinition.addFocusListener(this);
    txtDefinition.addKeyListener(this);
    if (hasContentAssist) {
      String[] items=getContentItems(predefinedQuery);
      if (items != null) {
        TextAssistField taf=new TextAssistField(txtDefinition,null,items);
        ((CTextContentAdapter)taf.getContentAdapter()).addContentChangeListener(new IContentChangeListener(){
          public void contentChanged(          Control control,          Object newValue,          Object oldValue){
            isQueryModified=true;
            saveQuery();
          }
        }
);
      }
    }
  }
  Control dropControl=getInputControl();
  DropTarget target=new DropTarget(dropControl,DND.DROP_COPY);
  Transfer[] types=new Transfer[]{SimpleTextTransfer.getInstance()};
  target.setTransfer(types);
  target.addDropListener(new DataTextDropListener(dropControl));
  DataDefinitionTextManager.getInstance().addDataDefinitionText(dropControl,this);
  btnBuilder=new Button(cmpTop,SWT.PUSH);
{
    GridData gdBTNBuilder=new GridData();
    ChartUIUtil.setChartImageButtonSizeByPlatform(gdBTNBuilder);
    btnBuilder.setLayoutData(gdBTNBuilder);
    btnBuilder.setImage(UIHelper.getImage("String_Node_Str"));
    btnBuilder.addSelectionListener(this);
    btnBuilder.setToolTipText(Messages.getString("String_Node_Str"));
    btnBuilder.getImage().setBackground(btnBuilder.getBackground());
    btnBuilder.setEnabled(context.getUIServiceProvider().isInvokingSupported());
    btnBuilder.setVisible(context.getUIServiceProvider().isEclipseModeSupported());
  }
  if ((style & BUTTON_GROUP) == BUTTON_GROUP) {
    btnGroup=new Button(cmpTop,SWT.PUSH);
    GridData gdBTNGroup=new GridData();
    ChartUIUtil.setChartImageButtonSizeByPlatform(gdBTNGroup);
    btnGroup.setLayoutData(gdBTNGroup);
    btnGroup.setImage(UIHelper.getImage("String_Node_Str"));
    btnGroup.addSelectionListener(this);
    btnGroup.setToolTipText(Messages.getString("String_Node_Str"));
  }
  setColor();
  boolean isCubeNoMultiDimensions=(provider.checkState(IDataServiceProvider.HAS_CUBE) || provider.checkState(IDataServiceProvider.SHARE_CROSSTAB_QUERY)) && !provider.checkState(IDataServiceProvider.MULTI_CUBE_DIMENSIONS);
  if (context.getDataServiceProvider().checkState(IDataServiceProvider.PART_CHART) || context.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_QUERY)) {
    if (txtDefinition != null && (!context.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_CROSSTAB_QUERY) || isSharingChart)) {
      txtDefinition.setEnabled(false);
    }
    btnBuilder.setEnabled(false);
    if (btnGroup != null) {
      btnGroup.setEnabled(false);
    }
  }
  if (cmbDefinition != null && ChartUIConstants.QUERY_OPTIONAL.equals(queryType) && isCubeNoMultiDimensions) {
    cmbDefinition.setEnabled(false);
    btnBuilder.setEnabled(false);
  }
  setTooltipForInputControl();
  boolean isRequiredField=(ChartUIConstants.QUERY_CATEGORY.equals(queryType));
  if (lblDesc != null && isRequiredField) {
    FieldAssistHelper.getInstance().addRequiredFieldIndicator(lblDesc);
  }
  return cmpTop;
}

Fixed version (ground truth):
public Composite createArea(Composite parent){
  int numColumns=2;
  if (description != null && description.length() > 0) {
    numColumns++;
  }
  if ((style & BUTTON_AGGREGATION) == BUTTON_AGGREGATION) {
    numColumns++;
  }
  if ((style & BUTTON_GROUP) == BUTTON_GROUP) {
    numColumns++;
  }
  cmpTop=new Composite(parent,SWT.NONE);
{
    GridLayout glContent=new GridLayout();
    glContent.numColumns=numColumns;
    glContent.marginHeight=0;
    glContent.marginWidth=0;
    glContent.horizontalSpacing=2;
    cmpTop.setLayout(glContent);
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    cmpTop.setLayoutData(gd);
  }
  Label lblDesc=null;
  if (description != null && description.length() > 0) {
    lblDesc=new Label(cmpTop,SWT.NONE);
    lblDesc.setText(description);
    lblDesc.setToolTipText(tooltipWhenBlank);
  }
  if ((style & BUTTON_AGGREGATION) == BUTTON_AGGREGATION) {
    createAggregationItem(cmpTop);
  }
  boolean isSharingChart=context.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_CHART_QUERY);
  final Object[] predefinedQuery=context.getPredefinedQuery(queryType);
  IDataServiceProvider provider=context.getDataServiceProvider();
  boolean needComboField=predefinedQuery != null && predefinedQuery.length > 0 && (provider.checkState(IDataServiceProvider.SHARE_QUERY) || provider.checkState(IDataServiceProvider.HAS_CUBE) || provider.checkState(IDataServiceProvider.INHERIT_COLUMNS_GROUPS));
  needComboField&=!isSharingChart;
  boolean hasContentAssist=(!isSharingChart && predefinedQuery != null && predefinedQuery.length > 0);
  if (needComboField) {
    Composite control=new Composite(cmpTop,SWT.NONE);
    GridData gd=new GridData(GridData.FILL_BOTH);
    gd.widthHint=80;
    control.setLayoutData(gd);
    GridLayout gl=new GridLayout();
    FieldAssistHelper.getInstance().initDecorationMargin(gl);
    control.setLayout(gl);
    cmbDefinition=new CCombo(control,context.getDataServiceProvider().checkState(IDataServiceProvider.PART_CHART) ? SWT.READ_ONLY | SWT.BORDER : SWT.BORDER);
    gd=new GridData(GridData.FILL_HORIZONTAL);
    gd.grabExcessHorizontalSpace=true;
    cmbDefinition.setLayoutData(gd);
    if (hasContentAssist) {
      String[] items=getContentItems(predefinedQuery);
      if (items != null) {
        new CComboAssistField(cmbDefinition,null,items);
      }
    }
    if (predefinedQuery.length > 0) {
      populateExprComboItems(predefinedQuery);
    }
 else     if (getQuery().getDefinition() == null || getQuery().getDefinition().equals("String_Node_Str")) {
      cmbDefinition.setEnabled(false);
    }
    cmbDefinition.addListener(SWT.Selection,new Listener(){
      public void handleEvent(      Event event){
        String oldQuery=query.getDefinition() == null ? "String_Node_Str" : query.getDefinition();
        String text=cmbDefinition.getText();
        if (!isTableSharedBinding() && text.equals(oldQuery)) {
          return;
        }
        updateQuery(text);
        if (!oldQuery.equals(text) && queryType == ChartUIConstants.QUERY_VALUE) {
          if (context.getDataServiceProvider().update(ChartUIConstants.QUERY_VALUE,text)) {
            Event e=new Event();
            e.data=BaseDataDefinitionComponent.this;
            e.widget=cmbDefinition;
            e.type=IChartDataSheet.EVENT_QUERY;
            context.getDataSheet().notifyListeners(e);
          }
        }
        if (context.getDataServiceProvider().checkState(IDataServiceProvider.PART_CHART) && ChartUIConstants.QUERY_CATEGORY.equals(queryType) && context.getModel() instanceof ChartWithAxes) {
          ((ChartWithAxes)context.getModel()).setTransposed(cmbDefinition.getSelectionIndex() > 0);
        }
        if (predefinedQuery.length == 0 && (getQuery().getDefinition() == null || getQuery().getDefinition().equals("String_Node_Str"))) {
          cmbDefinition.setEnabled(false);
        }
      }
    }
);
    cmbDefinition.addModifyListener(this);
    cmbDefinition.addFocusListener(this);
    cmbDefinition.addKeyListener(this);
    initComboExprText();
  }
 else {
    Composite control=cmpTop;
    if (hasContentAssist) {
      control=new Composite(cmpTop,SWT.NONE);
      GridData gd=new GridData(GridData.FILL_BOTH);
      gd.widthHint=80;
      control.setLayoutData(gd);
      GridLayout gl=new GridLayout();
      FieldAssistHelper.getInstance().initDecorationMargin(gl);
      control.setLayout(gl);
    }
    txtDefinition=new Text(control,SWT.BORDER | SWT.SINGLE);
    GridData gdTXTDefinition=new GridData(GridData.FILL_HORIZONTAL);
    gdTXTDefinition.widthHint=80;
    gdTXTDefinition.grabExcessHorizontalSpace=true;
    txtDefinition.setLayoutData(gdTXTDefinition);
    if (query != null && query.getDefinition() != null) {
      txtDefinition.setText(query.getDefinition());
      txtDefinition.setToolTipText(getTooltipForDataText(query.getDefinition()));
    }
    txtDefinition.addModifyListener(this);
    txtDefinition.addFocusListener(this);
    txtDefinition.addKeyListener(this);
    if (hasContentAssist) {
      String[] items=getContentItems(predefinedQuery);
      if (items != null) {
        TextAssistField taf=new TextAssistField(txtDefinition,null,items);
        ((CTextContentAdapter)taf.getContentAdapter()).addContentChangeListener(new IContentChangeListener(){
          public void contentChanged(          Control control,          Object newValue,          Object oldValue){
            isQueryModified=true;
            saveQuery();
          }
        }
);
      }
    }
  }
  Control dropControl=getInputControl();
  DropTarget target=new DropTarget(dropControl,DND.DROP_COPY);
  Transfer[] types=new Transfer[]{SimpleTextTransfer.getInstance()};
  target.setTransfer(types);
  target.addDropListener(new DataTextDropListener(dropControl));
  DataDefinitionTextManager.getInstance().addDataDefinitionText(dropControl,this);
  btnBuilder=new Button(cmpTop,SWT.PUSH);
{
    GridData gdBTNBuilder=new GridData();
    ChartUIUtil.setChartImageButtonSizeByPlatform(gdBTNBuilder);
    btnBuilder.setLayoutData(gdBTNBuilder);
    btnBuilder.setImage(UIHelper.getImage("String_Node_Str"));
    btnBuilder.addSelectionListener(this);
    btnBuilder.setToolTipText(Messages.getString("String_Node_Str"));
    btnBuilder.getImage().setBackground(btnBuilder.getBackground());
    btnBuilder.setEnabled(context.getUIServiceProvider().isInvokingSupported());
    btnBuilder.setVisible(context.getUIServiceProvider().isEclipseModeSupported());
  }
  if ((style & BUTTON_GROUP) == BUTTON_GROUP) {
    btnGroup=new Button(cmpTop,SWT.PUSH);
    GridData gdBTNGroup=new GridData();
    ChartUIUtil.setChartImageButtonSizeByPlatform(gdBTNGroup);
    btnGroup.setLayoutData(gdBTNGroup);
    btnGroup.setImage(UIHelper.getImage("String_Node_Str"));
    btnGroup.addSelectionListener(this);
    btnGroup.setToolTipText(Messages.getString("String_Node_Str"));
  }
  setColor();
  boolean isCubeNoMultiDimensions=(provider.checkState(IDataServiceProvider.HAS_CUBE) || provider.checkState(IDataServiceProvider.SHARE_CROSSTAB_QUERY)) && !provider.checkState(IDataServiceProvider.MULTI_CUBE_DIMENSIONS);
  if (context.getDataServiceProvider().checkState(IDataServiceProvider.PART_CHART) || context.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_QUERY)) {
    if (txtDefinition != null && (!context.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_CROSSTAB_QUERY) || isSharingChart)) {
      if (!ChartUIConstants.QUERY_OPTIONAL.equals(queryType) || !provider.checkState(IDataServiceProvider.SHARE_TABLE_QUERY) || getQuery().getDefinition() == null || getQuery().getDefinition().trim().length() == 0) {
        txtDefinition.setEnabled(false);
      }
    }
    btnBuilder.setEnabled(false);
    if (btnGroup != null) {
      btnGroup.setEnabled(false);
    }
  }
  if (cmbDefinition != null && ChartUIConstants.QUERY_OPTIONAL.equals(queryType) && isCubeNoMultiDimensions) {
    cmbDefinition.setEnabled(false);
    btnBuilder.setEnabled(false);
  }
  setTooltipForInputControl();
  boolean isRequiredField=(ChartUIConstants.QUERY_CATEGORY.equals(queryType));
  if (lblDesc != null && isRequiredField) {
    FieldAssistHelper.getInstance().addRequiredFieldIndicator(lblDesc);
  }
  return cmpTop;
}