Program: 148719
Project: 148719
Buggy source:
public void copyElements(){
  ArrayList<XSDParticle> particles=WorkbenchClipboard.getWorkbenchClipboard().getParticles();
  IStructuredSelection selection=(IStructuredSelection)page.getTreeViewer().getSelection();
  XSDElementDeclaration element=(XSDElementDeclaration)selection.getFirstElement();
  if (element.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
    XSDComplexTypeContent content=((XSDComplexTypeDefinition)element.getTypeDefinition()).getContent();
    if (content instanceof XSDParticle) {
      XSDParticle partile=(XSDParticle)content;
      if (((XSDParticle)partile).getTerm() instanceof XSDModelGroup) {
        XSDModelGroup toGroup=((XSDModelGroup)partile.getTerm());
        for (        XSDParticle particle : particles) {
          if (isExist(toGroup,particle)) {
            boolean ifOverwrite=MessageDialog.openConfirm(this.page.getSite().getShell(),"String_Node_Str","String_Node_Str" + ((XSDElementDeclaration)particle.getTerm()).getName() + "String_Node_Str");
            if (ifOverwrite) {
              reomveElement(toGroup,particle);
            }
 else             continue;
          }
          XSDParticle newParticle=(XSDParticle)particle.cloneConcreteComponent(true,false);
          toGroup.getContents().add(newParticle);
          toGroup.updateElement();
          if (newParticle.getContent() instanceof XSDElementDeclaration) {
            if (((XSDElementDeclaration)newParticle.getContent()).getTypeDefinition() instanceof XSDComplexTypeDefinition) {
              addAnnotationForComplexType((XSDComplexTypeDefinition)((XSDElementDeclaration)particle.getContent()).getTypeDefinition(),(XSDComplexTypeDefinition)((XSDElementDeclaration)newParticle.getContent()).getTypeDefinition());
            }
            XSDAnnotationsStructure struc1=new XSDAnnotationsStructure(newParticle.getTerm());
            addAnnotion(struc1,((XSDElementDeclaration)particle.getTerm()).getAnnotation());
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void copyElements(){
  ArrayList<XSDParticle> particles=WorkbenchClipboard.getWorkbenchClipboard().getParticles();
  IStructuredSelection selection=(IStructuredSelection)page.getTreeViewer().getSelection();
  XSDElementDeclaration element=(XSDElementDeclaration)selection.getFirstElement();
  if (element.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
    XSDComplexTypeContent content=((XSDComplexTypeDefinition)element.getTypeDefinition()).getContent();
    if (content instanceof XSDParticle) {
      XSDParticle partile=(XSDParticle)content;
      if (((XSDParticle)partile).getTerm() instanceof XSDModelGroup) {
        XSDModelGroup toGroup=((XSDModelGroup)partile.getTerm());
        for (        XSDParticle particle : particles) {
          if (isExist(toGroup,particle)) {
            boolean ifOverwrite=MessageDialog.openConfirm(this.page.getSite().getShell(),"String_Node_Str","String_Node_Str" + ((XSDElementDeclaration)particle.getTerm()).getName() + "String_Node_Str");
            if (ifOverwrite) {
              reomveElement(toGroup,particle);
            }
 else             continue;
          }
          XSDParticle newParticle=(XSDParticle)particle.cloneConcreteComponent(true,false);
          if (newParticle.getContent() instanceof XSDElementDeclaration && Util.changeElementTypeToSequence(element,newParticle.getMaxOccurs()) == Status.CANCEL_STATUS)           break;
          toGroup.getContents().add(newParticle);
          toGroup.updateElement();
          if (newParticle.getContent() instanceof XSDElementDeclaration) {
            if (((XSDElementDeclaration)newParticle.getContent()).getTypeDefinition() instanceof XSDComplexTypeDefinition) {
              addAnnotationForComplexType((XSDComplexTypeDefinition)((XSDElementDeclaration)particle.getContent()).getTypeDefinition(),(XSDComplexTypeDefinition)((XSDElementDeclaration)newParticle.getContent()).getTypeDefinition());
            }
            XSDAnnotationsStructure struc1=new XSDAnnotationsStructure(newParticle.getTerm());
            addAnnotion(struc1,((XSDElementDeclaration)particle.getTerm()).getAnnotation());
          }
        }
      }
    }
  }
}