Program: 121462
Project: 121462
Buggy source:
@Override public boolean performFinish(){
  if (mainPage.isCreateNewVersionJob()) {
    try {
      ProxyRepositoryFactory.getInstance().updateLockStatus();
    }
 catch (    PersistenceException e1) {
      ExceptionHandler.process(e1);
    }
    ERepositoryStatus repositoryStatus=ProxyRepositoryFactory.getInstance().getStatus(processObject);
    if ((repositoryStatus.equals(ERepositoryStatus.READ_ONLY)) || repositoryStatus == ERepositoryStatus.LOCK_BY_OTHER || repositoryStatus.equals(ERepositoryStatus.LOCK_BY_USER)) {
      Display.getDefault().syncExec(new Runnable(){
        @Override public void run(){
          MessageDialog.openWarning(getShell(),"String_Node_Str",Messages.getString("String_Node_Str"));
        }
      }
);
      return false;
    }
 else {
      IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
        public void run(        final IProgressMonitor monitor) throws CoreException {
          if (!alreadyEditedByUser) {
            refreshNewJob();
            try {
              ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
            }
 catch (            Exception e) {
              ExceptionHandler.process(e);
            }
          }
          try {
            Item newCreated=null;
            if (processObject.getProperty() != null && processObject.getProperty().getItem() != null) {
              newCreated=processObject.getProperty().getItem();
            }
            if (!(newCreated instanceof BusinessProcessItem)) {
              ProxyRepositoryFactory.getInstance().lock(processObject);
            }
          }
 catch (          PersistenceException e) {
            ExceptionHandler.process(e);
          }
catch (          LoginException e) {
            ExceptionHandler.process(e);
          }
        }
      }
;
      IWorkspace workspace=ResourcesPlugin.getWorkspace();
      try {
        ISchedulingRule schedulingRule=workspace.getRoot();
        workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
      }
 catch (      CoreException e) {
        MessageBoxExceptionHandler.process(e);
      }
    }
    IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
      @Override public void run(      final IProgressMonitor monitor) throws CoreException {
        boolean locked=processObject.getRepositoryStatus().equals(ERepositoryStatus.LOCK_BY_USER);
        openAnotherVersion((RepositoryNode)processObject.getRepositoryNode(),!locked);
        try {
          ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
    }
;
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    try {
      ISchedulingRule schedulingRule=workspace.getRoot();
      workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
    }
 catch (    CoreException e) {
      MessageBoxExceptionHandler.process(e);
    }
  }
 else {
    StructuredSelection selection=(StructuredSelection)mainPage.getSelection();
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    boolean lastVersion=node.getObject().getVersion().equals(processObject.getVersion());
    if (lastVersion) {
      lockObject(processObject);
    }
    ERepositoryStatus status=node.getObject().getRepositoryStatus();
    boolean isLocked=false;
    if (status == ERepositoryStatus.LOCK_BY_USER) {
      isLocked=true;
    }
    restoreVersion();
    openAnotherVersion(node,!lastVersion || !isLocked);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (mainPage.isCreateNewVersionJob()) {
    try {
      ProxyRepositoryFactory.getInstance().updateLockStatus();
    }
 catch (    PersistenceException e1) {
      ExceptionHandler.process(e1);
    }
    ERepositoryStatus repositoryStatus=ProxyRepositoryFactory.getInstance().getStatus(processObject);
    if ((repositoryStatus.equals(ERepositoryStatus.READ_ONLY)) || repositoryStatus == ERepositoryStatus.LOCK_BY_OTHER || repositoryStatus.equals(ERepositoryStatus.LOCK_BY_USER)) {
      Display.getDefault().syncExec(new Runnable(){
        @Override public void run(){
          MessageDialog.openWarning(getShell(),"String_Node_Str",Messages.getString("String_Node_Str"));
        }
      }
);
      return false;
    }
 else {
      IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
        public void run(        final IProgressMonitor monitor) throws CoreException {
          try {
            Item newCreated=null;
            if (processObject.getProperty() != null && processObject.getProperty().getItem() != null) {
              newCreated=processObject.getProperty().getItem();
            }
            if (!(newCreated instanceof BusinessProcessItem)) {
              ProxyRepositoryFactory.getInstance().lock(processObject);
            }
          }
 catch (          PersistenceException e) {
            ExceptionHandler.process(e);
          }
catch (          LoginException e) {
            ExceptionHandler.process(e);
          }
        }
      }
;
      IWorkspace workspace=ResourcesPlugin.getWorkspace();
      try {
        ISchedulingRule schedulingRule=workspace.getRoot();
        workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
      }
 catch (      CoreException e) {
        MessageBoxExceptionHandler.process(e);
      }
    }
    IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
      @Override public void run(      final IProgressMonitor monitor) throws CoreException {
        if (!alreadyEditedByUser) {
          refreshNewJob();
          try {
            ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
          }
 catch (          Exception e) {
            ExceptionHandler.process(e);
          }
        }
        boolean locked=processObject.getRepositoryStatus().equals(ERepositoryStatus.LOCK_BY_USER);
        openAnotherVersion((RepositoryNode)processObject.getRepositoryNode(),!locked);
        try {
          ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
    }
;
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    try {
      ISchedulingRule schedulingRule=workspace.getRoot();
      workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
    }
 catch (    CoreException e) {
      MessageBoxExceptionHandler.process(e);
    }
  }
 else {
    StructuredSelection selection=(StructuredSelection)mainPage.getSelection();
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    boolean lastVersion=node.getObject().getVersion().equals(processObject.getVersion());
    if (lastVersion) {
      lockObject(processObject);
    }
    ERepositoryStatus status=node.getObject().getRepositoryStatus();
    boolean isLocked=false;
    if (status == ERepositoryStatus.LOCK_BY_USER) {
      isLocked=true;
    }
    restoreVersion();
    openAnotherVersion(node,!lastVersion || !isLocked);
  }
  return true;
}