Program: 149050
Project: 149050
Buggy source:
public IStatus doAction(){
  List<XSDComplexTypeDefinition> empty=new ArrayList<XSDComplexTypeDefinition>();
  dialog=new ComplexTypeInputDialog(this,page.getSite().getShell(),empty);
  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.setMinOccurs(1);
  subParticle.setMaxOccurs(1);
  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();
  complexType.setName(typeName);
  schema.getContents().add(complexType);
  complexType.updateElement();
  XSDParticle groupParticle=factory.createXSDParticle();
  groupParticle.setMinOccurs(1);
  groupParticle.setMaxOccurs(1);
  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> empty=new ArrayList<XSDComplexTypeDefinition>();
  dialog=new ComplexTypeInputDialog(this,page.getSite().getShell(),empty,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.setMinOccurs(1);
  subParticle.setMaxOccurs(1);
  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();
  complexType.setName(typeName);
  schema.getContents().add(complexType);
  complexType.updateElement();
  XSDParticle groupParticle=factory.createXSDParticle();
  groupParticle.setMinOccurs(1);
  groupParticle.setMaxOccurs(1);
  groupParticle.setContent(group);
  groupParticle.updateElement();
  complexType.setContent(groupParticle);
  complexType.updateElement();
  page.refresh();
  page.markDirty();
  return Status.OK_STATUS;
}