Program: 148434
Project: 148434
Buggy source:
public IStatus doAction(){
  try {
    IStructuredSelection selection=(TreeSelection)page.getTreeViewer().getSelection();
    XSDComponent xSDCom=null;
    if (selection.getFirstElement() instanceof Element) {
      TreePath tPath=((TreeSelection)selection).getPaths()[0];
      for (int i=0; i < tPath.getSegmentCount(); i++) {
        if (tPath.getSegment(i) instanceof XSDAnnotation)         xSDCom=(XSDAnnotation)(tPath.getSegment(i));
      }
    }
 else     xSDCom=(XSDComponent)selection.getFirstElement();
    XSDAnnotationsStructure struc=new XSDAnnotationsStructure(xSDCom);
    if (struc.getAnnotation() == null) {
      throw new RuntimeException("String_Node_Str" + xSDCom.getClass().getName());
    }
    AnnotationLanguageLabelsDialog dlg=new AnnotationLanguageLabelsDialog(struc.getLabels(),new AnnotationLabelDialogSelectionListener(page),page.getEditorSite().getShell(),"String_Node_Str");
    dlg.setBlockOnOpen(true);
    dlg.open();
    if (dlg.getReturnCode() == Window.OK) {
      struc.removeAllLabels();
      LinkedHashMap<String,String> descriptions=dlg.getDescriptionsMap();
      Set<String> isoCodes=descriptions.keySet();
      for (Iterator iter=isoCodes.iterator(); iter.hasNext(); ) {
        String isoCode=(String)iter.next();
        struc.setLabel(isoCode,descriptions.get(isoCode));
      }
    }
 else {
      return Status.CANCEL_STATUS;
    }
    if (struc.hasChanged()) {
      page.markDirty();
      page.refresh();
      page.getTreeViewer().expandToLevel(xSDCom,2);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public IStatus doAction(){
  try {
    IStructuredSelection selection=(TreeSelection)page.getTreeViewer().getSelection();
    XSDComponent xSDCom=null;
    if (selection.getFirstElement() instanceof Element) {
      TreePath tPath=((TreeSelection)selection).getPaths()[0];
      for (int i=0; i < tPath.getSegmentCount(); i++) {
        if (tPath.getSegment(i) instanceof XSDAnnotation)         xSDCom=(XSDAnnotation)(tPath.getSegment(i));
      }
    }
 else     xSDCom=(XSDComponent)selection.getFirstElement();
    XSDAnnotationsStructure struc=new XSDAnnotationsStructure(xSDCom);
    if (struc.getAnnotation() == null) {
      throw new RuntimeException("String_Node_Str" + xSDCom.getClass().getName());
    }
    AnnotationLanguageLabelsDialog dlg=new AnnotationLanguageLabelsDialog(struc.getLabels(),new AnnotationLabelDialogSelectionListener(page),page.getEditorSite().getShell(),"String_Node_Str");
    dlg.setBlockOnOpen(true);
    dlg.open();
    if (dlg.getReturnCode() == Window.OK) {
      struc.removeAllLabels();
      LinkedHashMap<String,String> descriptions=dlg.getDescriptionsMap();
      Set<String> isoCodes=descriptions.keySet();
      for (Iterator iter=isoCodes.iterator(); iter.hasNext(); ) {
        String isoCode=(String)iter.next();
        struc.setLabel(isoCode,descriptions.get(isoCode));
      }
    }
 else {
      return Status.CANCEL_STATUS;
    }
    if (struc.hasChanged()) {
      page.markDirty();
      page.refresh();
      page.getTreeViewer().expandToLevel(xSDCom,2);
    }
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}