Program: 148012
Project: 148012
Buggy source:
public IStatus doAction(){
  List<XSDComplexTypeDefinition> list=new ArrayList<XSDComplexTypeDefinition>();
  EList<XSDTypeDefinition> types=schema.getTypeDefinitions();
  for (  XSDTypeDefinition type : types) {
    if (type instanceof XSDComplexTypeDefinition)     list.add((XSDComplexTypeDefinition)type);
  }
  dialog=new ComplexTypeInputDialog(this,page.getSite().getShell(),schema,null,list,false);
  dialog.setBlockOnOpen(true);
  int ret=dialog.open();
  if (ret == Dialog.CANCEL) {
    return Status.CANCEL_STATUS;
  }
  XSDFactory factory=XSDSchemaBuildingTools.getXSDFactory();
  XSDModelGroup group=factory.createXSDModelGroup();
  XSDParticle subParticle=null;
  XSDElementDeclaration subElement=null;
  subElement=factory.createXSDElementDeclaration();
  subElement.setName("String_Node_Str");
  subElement.setTypeDefinition(schema.resolveSimpleTypeDefinition(schema.getSchemaForSchemaNamespace(),"String_Node_Str"));
  subParticle=factory.createXSDParticle();
  subParticle.unsetMaxOccurs();
  subParticle.unsetMinOccurs();
  subParticle.setContent(subElement);
  subParticle.updateElement();
  if (isChoice)   group.setCompositor(XSDCompositor.CHOICE_LITERAL);
 else   if (isAll)   group.setCompositor(XSDCompositor.ALL_LITERAL);
 else   group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
  group.getContents().add(0,subParticle);
  group.updateElement();
  XSDComplexTypeDefinition complexType=factory.createXSDComplexTypeDefinition();
  XSDTypeDefinition superType=null;
  for (  XSDTypeDefinition type : list) {
    if (type.getName().equals(superTypeName)) {
      superType=type;
      break;
    }
  }
  complexType.setName(typeName);
  if (superType != null) {
    complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
    complexType.setBaseTypeDefinition(superType);
  }
  if (isAbstract)   complexType.setAbstract(isAbstract);
 else   complexType.unsetAbstract();
  schema.getContents().add(complexType);
  complexType.updateElement();
  XSDParticle groupParticle=factory.createXSDParticle();
  groupParticle.unsetMaxOccurs();
  groupParticle.unsetMinOccurs();
  groupParticle.setContent(group);
  groupParticle.updateElement();
  complexType.setContent(groupParticle);
  complexType.updateElement();
  page.refresh();
  page.markDirty();
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public IStatus doAction(){
  List<XSDComplexTypeDefinition> list=new ArrayList<XSDComplexTypeDefinition>();
  EList<XSDTypeDefinition> types=schema.getTypeDefinitions();
  for (  XSDTypeDefinition type : types) {
    if (type instanceof XSDComplexTypeDefinition)     list.add((XSDComplexTypeDefinition)type);
  }
  dialog=new ComplexTypeInputDialog(this,page.getSite().getShell(),schema,null,list,false);
  dialog.setBlockOnOpen(true);
  int ret=dialog.open();
  if (ret == Dialog.CANCEL) {
    return Status.CANCEL_STATUS;
  }
  XSDFactory factory=XSDSchemaBuildingTools.getXSDFactory();
  XSDModelGroup group=factory.createXSDModelGroup();
  XSDParticle subParticle=null;
  XSDElementDeclaration subElement=null;
  subElement=factory.createXSDElementDeclaration();
  subElement.setName("String_Node_Str");
  subElement.setTypeDefinition(schema.resolveSimpleTypeDefinition(schema.getSchemaForSchemaNamespace(),"String_Node_Str"));
  subParticle=factory.createXSDParticle();
  subParticle.unsetMaxOccurs();
  subParticle.unsetMinOccurs();
  subParticle.setContent(subElement);
  subParticle.updateElement();
  if (isChoice)   group.setCompositor(XSDCompositor.CHOICE_LITERAL);
 else   if (isAll)   group.setCompositor(XSDCompositor.ALL_LITERAL);
 else   group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
  group.getContents().add(0,subParticle);
  group.updateElement();
  XSDComplexTypeDefinition complexType=factory.createXSDComplexTypeDefinition();
  XSDTypeDefinition superType=null;
  for (  XSDTypeDefinition type : list) {
    if (type.getName().equals(superTypeName)) {
      superType=type;
      break;
    }
  }
  complexType.setName(typeName);
  if (superType != null) {
    if (!checkParentType(superType,group)) {
      return Status.CANCEL_STATUS;
    }
    complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
    complexType.setBaseTypeDefinition(superType);
  }
  if (isAbstract)   complexType.setAbstract(isAbstract);
 else   complexType.unsetAbstract();
  schema.getContents().add(complexType);
  complexType.updateElement();
  XSDParticle groupParticle=factory.createXSDParticle();
  groupParticle.unsetMaxOccurs();
  groupParticle.unsetMinOccurs();
  groupParticle.setContent(group);
  groupParticle.updateElement();
  complexType.setContent(groupParticle);
  complexType.updateElement();
  page.refresh();
  page.markDirty();
  return Status.OK_STATUS;
}