Program: 138304
Project: 138304
Buggy source:
@Override protected void copy(boolean leftToRight){
  ModelElement modelElement=null;
  IFile resourceFile=null;
  if (selectedOjbect instanceof IFile) {
    modelElement=PrvResourceFileHelper.getInstance().findProvider((IFile)selectedOjbect);
  }
 else   if (selectedOjbect instanceof IRepositoryViewObject) {
    ModelElement me=PropertyHelper.retrieveElement(((IRepositoryViewObject)selectedOjbect).getProperty().getItem());
    if (me instanceof Connection) {
      modelElement=me;
    }
  }
 else {
    Package ctatlogSwtich=SwitchHelpers.PACKAGE_SWITCH.doSwitch((EObject)((AbstractDatabaseFolderNode)selectedOjbect).getParent());
    if (ctatlogSwtich != null) {
      resourceFile=PrvResourceFileHelper.getInstance().findCorrespondingFile(ConnectionHelper.getTdDataProvider(ctatlogSwtich));
      modelElement=ConnectionHelper.getTdDataProvider(ctatlogSwtich);
    }
    ColumnSet columnSet=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch((EObject)((AbstractDatabaseFolderNode)selectedOjbect).getParent());
    if (columnSet != null) {
      resourceFile=PrvResourceFileHelper.getInstance().findCorrespondingFile(ConnectionHelper.getDataProvider(columnSet));
      modelElement=ConnectionHelper.getDataProvider(columnSet);
    }
  }
  if (modelElement != null && resourceFile != null) {
    String titleMessage=DefaultMessagesImpl.getString("String_Node_Str");
    int showDialog=DeleteModelElementConfirmDialog.showElementImpactDialog(null,new ModelElement[]{modelElement},titleMessage,titleMessage);
    if (showDialog == Window.OK) {
      EObjectHelper.removeDependencys(new IResource[]{resourceFile});
    }
 else {
      return;
    }
  }
  int diffItemsCount=((ModelCompareInput)getInput()).getDiffAsList().size();
  try {
    super.copy(leftToRight);
    ModelCompareInput modelCompareInput=(ModelCompareInput)getInput();
    if (!leftToRight && modelCompareInput.getDiffAsList().size() == 0) {
      Resource leftResource=modelCompareInput.getLeftResource();
      XmiResourceManager resourceManager=ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager();
      resourceManager.saveResource(leftResource);
      final MatchModel match=(MatchModel)modelCompareInput.getMatch();
      match.getUnmatchedElements().clear();
      final ComparisonResourceSnapshot snap=DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
      snap.setDiff((DiffModel)((ModelCompareInput)getInput()).getDiff());
      snap.setMatch((MatchModel)((ModelCompareInput)getInput()).getMatch());
      configuration.setProperty(EMFCompareConstants.PROPERTY_CONTENT_INPUT_CHANGED,snap);
    }
    if (!leftToRight && diffItemsCount > 0) {
      new ReloadDatabaseAction(selectedOjbect,null).run();
    }
  }
 catch (  Throwable e) {
    log.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override protected void copy(boolean leftToRight){
  ModelElement modelElement=null;
  IFile resourceFile=null;
  if (selectedOjbect instanceof IFile) {
    modelElement=PrvResourceFileHelper.getInstance().findProvider((IFile)selectedOjbect);
  }
 else   if (selectedOjbect instanceof IRepositoryViewObject) {
    ModelElement me=PropertyHelper.retrieveElement(((IRepositoryViewObject)selectedOjbect).getProperty().getItem());
    if (me instanceof Connection) {
      modelElement=me;
    }
  }
 else {
    Package ctatlogSwtich=SwitchHelpers.PACKAGE_SWITCH.doSwitch((EObject)((AbstractDatabaseFolderNode)selectedOjbect).getParent());
    if (ctatlogSwtich != null) {
      resourceFile=PrvResourceFileHelper.getInstance().findCorrespondingFile(ConnectionHelper.getTdDataProvider(ctatlogSwtich));
      modelElement=ConnectionHelper.getTdDataProvider(ctatlogSwtich);
    }
    ColumnSet columnSet=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch((EObject)((AbstractDatabaseFolderNode)selectedOjbect).getParent());
    if (columnSet != null) {
      resourceFile=PrvResourceFileHelper.getInstance().findCorrespondingFile(ConnectionHelper.getDataProvider(columnSet));
      modelElement=ConnectionHelper.getDataProvider(columnSet);
    }
  }
  if (modelElement != null && resourceFile != null) {
    String titleMessage=DefaultMessagesImpl.getString("String_Node_Str");
    int showDialog=DeleteModelElementConfirmDialog.showElementImpactDialog(null,new ModelElement[]{modelElement},titleMessage,titleMessage);
    if (showDialog == Window.OK) {
      EObjectHelper.removeDependencys(new IResource[]{resourceFile});
    }
 else {
      return;
    }
  }
  int diffItemsCount=((ModelCompareInput)getInput()).getDiffAsList().size();
  try {
    super.copy(leftToRight);
    ModelCompareInput modelCompareInput=(ModelCompareInput)getInput();
    if (!leftToRight && modelCompareInput.getDiffAsList().size() == 0) {
      Resource leftResource=modelCompareInput.getLeftResource();
      XmiResourceManager resourceManager=ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager();
      resourceManager.saveResource(leftResource);
      final MatchModel match=(MatchModel)modelCompareInput.getMatch();
      match.getUnmatchedElements().clear();
      final ComparisonResourceSnapshot snap=DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
      snap.setDiff((DiffModel)((ModelCompareInput)getInput()).getDiff());
      snap.setMatch((MatchModel)((ModelCompareInput)getInput()).getMatch());
      configuration.setProperty(EMFCompareConstants.PROPERTY_CONTENT_INPUT_CHANGED,snap);
    }
    if (!leftToRight && diffItemsCount > 0) {
      if (selectedOjbect instanceof RepositoryViewObject) {
        new ReloadDatabaseAction(((RepositoryViewObject)selectedOjbect).getRepositoryNode(),null).run();
      }
    }
  }
 catch (  Throwable e) {
    log.error(e.getMessage(),e);
  }
}