Program: 68645
Project: 68645
Buggy source:
public void widgetSelected(SelectionEvent e){
  if (e.getSource().equals(btnAddLine)) {
    MarkerLine line=MarkerLineImpl.create(getAxisForProcessing(),createDefaultDataElement(),ColorDefinitionImpl.RED());
    line.eAdapters().addAll(getAxisForProcessing().eAdapters());
    iLineCount++;
    buildList();
    lstMarkers.select(lstMarkers.getItemCount() - 1);
    updateUIForSelection();
    if (lstMarkers.getItemCount() == 1) {
      setState(true);
    }
    refreshButtons();
  }
 else   if (e.getSource().equals(btnAddRange)) {
    MarkerRange range=MarkerRangeImpl.create(getAxisForProcessing(),createDefaultDataElement(),createDefaultDataElement(),ColorDefinitionImpl.TRANSPARENT(),ColorDefinitionImpl.RED());
    range.eAdapters().addAll(getAxisForProcessing().eAdapters());
    iRangeCount++;
    buildList();
    lstMarkers.select(lstMarkers.getItemCount() - 1);
    updateUIForSelection();
    if (lstMarkers.getItemCount() == 1) {
      setState(true);
    }
    refreshButtons();
  }
 else   if (e.getSource().equals(btnRemove)) {
    if (lstMarkers.getSelection().length == 0) {
      return;
    }
    String sSelectedMarker=lstMarkers.getSelection()[0];
    boolean bLine=sSelectedMarker.startsWith(MARKER_LINE_LABEL);
    int iMarkerIndex=getMarkerIndex();
    if (bLine) {
      getAxisForProcessing().getMarkerLines().remove(iMarkerIndex);
      iLineCount--;
    }
 else {
      getAxisForProcessing().getMarkerRanges().remove(iMarkerIndex);
      iRangeCount--;
    }
    buildList();
    if (lstMarkers.getItemCount() > 0) {
      lstMarkers.select(0);
      updateUIForSelection();
    }
 else {
      setState(false);
      resetUI();
    }
    refreshButtons();
  }
 else   if (e.getSource().equals(lstMarkers)) {
    updateUIForSelection();
    refreshButtons();
  }
 else   if (e.getSource().equals(cmbLineAnchor)) {
    getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).setLabelAnchor(ChartUIUtil.getFlippedAnchor(Anchor.getByName(LiteralHelper.anchorSet.getNameByDisplayName(cmbLineAnchor.getText())),isFlippedAxes()));
  }
 else   if (e.getSource().equals(cmbRangeAnchor)) {
    getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).setLabelAnchor(ChartUIUtil.getFlippedAnchor(Anchor.getByName(LiteralHelper.anchorSet.getNameByDisplayName(cmbRangeAnchor.getText())),isFlippedAxes()));
  }
 else   if (e.getSource().equals(btnLineFormatSpecifier)) {
    String sAxisTitle="String_Node_Str";
    try {
      sAxisTitle=new MessageFormat(Messages.getString("String_Node_Str")).format(new Object[]{getAxisForProcessing().getTitle().getCaption().getValue()});
    }
 catch (    NullPointerException e1) {
    }
    FormatSpecifier formatspecifier=null;
    if (getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).getFormatSpecifier() != null) {
      formatspecifier=getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).getFormatSpecifier();
    }
    FormatSpecifierDialog editor=new FormatSpecifierDialog(cmpContent.getShell(),formatspecifier,getAxisForProcessing().getType(),new MessageFormat(Messages.getString("String_Node_Str")).format(new Object[]{Integer.valueOf(getMarkerIndex() + 1),sAxisTitle}));
    if (editor.open() == Window.OK) {
      if (editor.getFormatSpecifier() == null) {
        getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).eUnset(ComponentPackage.eINSTANCE.getMarkerLine_FormatSpecifier());
        return;
      }
      getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).setFormatSpecifier(editor.getFormatSpecifier());
    }
  }
 else   if (e.getSource().equals(btnStartFormatSpecifier) || e.getSource().equals(btnEndFormatSpecifier)) {
    String sAxisTitle="String_Node_Str";
    try {
      String sTitleString=getAxisForProcessing().getTitle().getCaption().getValue();
      int iSeparatorIndex=sTitleString.indexOf(ExternalizedTextEditorComposite.SEPARATOR);
      if (iSeparatorIndex > 0) {
        sTitleString=sTitleString.substring(iSeparatorIndex);
      }
 else       if (iSeparatorIndex == 0) {
        sTitleString=sTitleString.substring(ExternalizedTextEditorComposite.SEPARATOR.length());
      }
      sAxisTitle=new MessageFormat(Messages.getString("String_Node_Str")).format(new Object[]{sTitleString});
    }
 catch (    NullPointerException e1) {
    }
    FormatSpecifier formatspecifier=null;
    if (getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).getFormatSpecifier() != null) {
      formatspecifier=getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).getFormatSpecifier();
    }
    FormatSpecifierDialog editor=new FormatSpecifierDialog(cmpContent.getShell(),formatspecifier,getAxisForProcessing().getType(),new MessageFormat(Messages.getString("String_Node_Str")).format(new Object[]{Integer.valueOf(getMarkerIndex() + 1),sAxisTitle}));
    if (editor.open() == Window.OK) {
      if (editor.getFormatSpecifier() == null) {
        getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).eUnset(ComponentPackage.eINSTANCE.getMarkerRange_FormatSpecifier());
        return;
      }
      getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).setFormatSpecifier(editor.getFormatSpecifier());
    }
  }
 else   if (e.widget.equals(btnLineTriggers)) {
    new TriggerEditorDialog(cmpContent.getShell(),getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).getTriggers(),getAxisForProcessing().getMarkerLines().get(getMarkerIndex()),getContext(),Messages.getString("String_Node_Str"),TriggerSupportMatrix.TYPE_MARKERLINE,false,true).open();
  }
 else   if (e.widget.equals(btnRangeTriggers)) {
    new TriggerEditorDialog(cmpContent.getShell(),getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).getTriggers(),getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()),getContext(),Messages.getString("String_Node_Str"),TriggerSupportMatrix.TYPE_MARKERRANGE,false,true).open();
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  if (e.getSource().equals(btnAddLine)) {
    MarkerLine line=MarkerLineImpl.create(getAxisForProcessing(),createDefaultDataElement(),ColorDefinitionImpl.RED());
    line.eAdapters().addAll(getAxisForProcessing().eAdapters());
    iLineCount++;
    buildList();
    lstMarkers.select(lstMarkers.getItemCount() - 1);
    updateUIForSelection();
    if (lstMarkers.getItemCount() == 1) {
      setState(true);
    }
    refreshButtons();
  }
 else   if (e.getSource().equals(btnAddRange)) {
    MarkerRange range=MarkerRangeImpl.create(getAxisForProcessing(),createDefaultDataElement(),createDefaultDataElement(),ColorDefinitionImpl.TRANSPARENT(),ColorDefinitionImpl.RED());
    range.eAdapters().addAll(getAxisForProcessing().eAdapters());
    iRangeCount++;
    buildList();
    lstMarkers.select(lstMarkers.getItemCount() - 1);
    updateUIForSelection();
    if (lstMarkers.getItemCount() == 1) {
      setState(true);
    }
    refreshButtons();
  }
 else   if (e.getSource().equals(btnRemove)) {
    if (lstMarkers.getSelection().length == 0) {
      return;
    }
    String sSelectedMarker=lstMarkers.getSelection()[0];
    boolean bLine=sSelectedMarker.startsWith(MARKER_LINE_LABEL);
    int iMarkerIndex=getMarkerIndex();
    if (bLine) {
      getAxisForProcessing().getMarkerLines().remove(iMarkerIndex);
      iLineCount--;
    }
 else {
      getAxisForProcessing().getMarkerRanges().remove(iMarkerIndex);
      iRangeCount--;
    }
    buildList();
    if (lstMarkers.getItemCount() > 0) {
      lstMarkers.select(0);
      updateUIForSelection();
    }
 else {
      setState(false);
      resetUI();
    }
    refreshButtons();
  }
 else   if (e.getSource().equals(lstMarkers)) {
    updateUIForSelection();
    refreshButtons();
  }
 else   if (e.getSource().equals(cmbLineAnchor)) {
    getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).setLabelAnchor(ChartUIUtil.getFlippedAnchor(Anchor.getByName(LiteralHelper.anchorSet.getNameByDisplayName(cmbLineAnchor.getText())),isFlippedAxes()));
  }
 else   if (e.getSource().equals(cmbRangeAnchor)) {
    getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).setLabelAnchor(ChartUIUtil.getFlippedAnchor(Anchor.getByName(LiteralHelper.anchorSet.getNameByDisplayName(cmbRangeAnchor.getText())),isFlippedAxes()));
  }
 else   if (e.getSource().equals(btnLineFormatSpecifier)) {
    String sAxisTitle="String_Node_Str";
    try {
      sAxisTitle=new MessageFormat(Messages.getString("String_Node_Str")).format(new Object[]{getAxisForProcessing().getTitle().getCaption().getValue()});
    }
 catch (    NullPointerException e1) {
    }
    FormatSpecifier formatspecifier=null;
    if (getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).getFormatSpecifier() != null) {
      formatspecifier=getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).getFormatSpecifier();
    }
    FormatSpecifierDialog editor=new FormatSpecifierDialog(cmpContent.getShell(),formatspecifier,getDataElementType(getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).getValue()),new MessageFormat(Messages.getString("String_Node_Str")).format(new Object[]{Integer.valueOf(getMarkerIndex() + 1),sAxisTitle}));
    if (editor.open() == Window.OK) {
      if (editor.getFormatSpecifier() == null) {
        getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).eUnset(ComponentPackage.eINSTANCE.getMarkerLine_FormatSpecifier());
        return;
      }
      getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).setFormatSpecifier(editor.getFormatSpecifier());
    }
  }
 else   if (e.getSource().equals(btnStartFormatSpecifier) || e.getSource().equals(btnEndFormatSpecifier)) {
    String sAxisTitle="String_Node_Str";
    try {
      String sTitleString=getAxisForProcessing().getTitle().getCaption().getValue();
      int iSeparatorIndex=sTitleString.indexOf(ExternalizedTextEditorComposite.SEPARATOR);
      if (iSeparatorIndex > 0) {
        sTitleString=sTitleString.substring(iSeparatorIndex);
      }
 else       if (iSeparatorIndex == 0) {
        sTitleString=sTitleString.substring(ExternalizedTextEditorComposite.SEPARATOR.length());
      }
      sAxisTitle=new MessageFormat(Messages.getString("String_Node_Str")).format(new Object[]{sTitleString});
    }
 catch (    NullPointerException e1) {
    }
    FormatSpecifier formatspecifier=null;
    if (getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).getFormatSpecifier() != null) {
      formatspecifier=getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).getFormatSpecifier();
    }
    FormatSpecifierDialog editor=new FormatSpecifierDialog(cmpContent.getShell(),formatspecifier,getDataElementType(getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).getStartValue()),new MessageFormat(Messages.getString("String_Node_Str")).format(new Object[]{Integer.valueOf(getMarkerIndex() + 1),sAxisTitle}));
    if (editor.open() == Window.OK) {
      if (editor.getFormatSpecifier() == null) {
        getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).eUnset(ComponentPackage.eINSTANCE.getMarkerRange_FormatSpecifier());
        return;
      }
      getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).setFormatSpecifier(editor.getFormatSpecifier());
    }
  }
 else   if (e.widget.equals(btnLineTriggers)) {
    new TriggerEditorDialog(cmpContent.getShell(),getAxisForProcessing().getMarkerLines().get(getMarkerIndex()).getTriggers(),getAxisForProcessing().getMarkerLines().get(getMarkerIndex()),getContext(),Messages.getString("String_Node_Str"),TriggerSupportMatrix.TYPE_MARKERLINE,false,true).open();
  }
 else   if (e.widget.equals(btnRangeTriggers)) {
    new TriggerEditorDialog(cmpContent.getShell(),getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()).getTriggers(),getAxisForProcessing().getMarkerRanges().get(getMarkerIndex()),getContext(),Messages.getString("String_Node_Str"),TriggerSupportMatrix.TYPE_MARKERRANGE,false,true).open();
  }
}