Program: 118954
Project: 118954
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  final IProxyRepositoryFactory proxyRepositoryFactory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  Property property=repositoryObject.getProperty();
  if (nameText == null || nameText.isDisposed() || versionText == null || versionText.isDisposed() || purposeText == null || purposeText.isDisposed() || jobTypeCCombo == null || jobTypeCCombo.isDisposed() || jobFrameworkCCombo == null || jobFrameworkCCombo.isDisposed() || statusText == null || statusText.isDisposed() || descriptionText == null || descriptionText.isDisposed() || btnConfirm == null || btnConfirm.isDisposed() || property == null) {
    return;
  }
  String originalName=nameText.getText();
  String originalJobType=jobTypeCCombo.getText();
  String originalFramework=jobFrameworkCCombo.getText();
  String originalversion=versionText.getText();
  String originalPurpose=purposeText.getText();
  String originalStatus=statusText.getText();
  String originalDescription=descriptionText.getText();
  if (repositoryObject instanceof IProcess2) {
    IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
      @Override public void run(      final IProgressMonitor monitor) throws CoreException {
        DeleteActionCache.getInstance().closeOpenedEditor(repositoryObject);
      }
    }
;
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    try {
      ISchedulingRule schedulingRule=workspace.getRoot();
      workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
    }
 catch (    CoreException e1) {
      MessageBoxExceptionHandler.process(e1.getCause());
    }
  }
  String newJobName=null;
  if (!originalName.equals(StringUtils.trimToEmpty(repositoryObject.getLabel()))) {
    newJobName=originalName;
  }
  if (!originalversion.equals(StringUtils.trimToEmpty(repositoryObject.getVersion()))) {
    property.setVersion(originalversion);
  }
  if (!originalPurpose.equals(StringUtils.trimToEmpty(repositoryObject.getPurpose()))) {
    property.setPurpose(originalPurpose);
  }
  if (!originalStatus.equals(StringUtils.trimToEmpty(repositoryObject.getStatusCode()))) {
    property.setStatusCode(getStatusCode(getStatusMap(),originalStatus));
  }
  if (!originalDescription.equals(StringUtils.trimToEmpty(repositoryObject.getDescription()))) {
    property.setDescription(originalDescription);
  }
  boolean convert=true;
  if (originalJobType.equals(StringUtils.trimToEmpty(jobTypeValue))) {
    convert=false;
  }
  if (convert) {
    final Item newItem=ConvertJobsUtil.createOperation(originalName,originalJobType,originalFramework,repositoryObject);
    IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
      @Override public void run(      final IProgressMonitor monitor) throws CoreException {
        try {
          boolean isOpened=false;
          if (repositoryObject instanceof IProcess2) {
            isOpened=true;
            boolean locked=proxyRepositoryFactory.getStatus(repositoryObject) == ERepositoryStatus.LOCK_BY_USER;
            if (locked) {
              proxyRepositoryFactory.unlock(repositoryObject);
            }
          }
          proxyRepositoryFactory.deleteObjectPhysical(repositoryObject);
          proxyRepositoryFactory.saveProject(ProjectManager.getInstance().getCurrentProject());
          if (newItem != null && newItem.getProperty() != null) {
            String newId=newItem.getProperty().getId();
            newRepositoryObject=proxyRepositoryFactory.getLastVersion(ProjectManager.getInstance().getCurrentProject(),newId);
            if (!isOpened) {
              repositoryObject=newRepositoryObject;
              if (!jobTypeCCombo.isDisposed() && !jobFrameworkCCombo.isDisposed()) {
                jobTypeValue=jobTypeCCombo.getText();
                frameworkValue=jobFrameworkCCombo.getText();
              }
            }
          }
        }
 catch (        PersistenceException e1) {
          e1.printStackTrace();
        }
catch (        LoginException e) {
          e.printStackTrace();
        }
      }
    }
;
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    try {
      ISchedulingRule schedulingRule=workspace.getRoot();
      workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
    }
 catch (    CoreException e1) {
      MessageBoxExceptionHandler.process(e1.getCause());
    }
    if (newItem != null && repositoryObject instanceof IProcess2) {
      if (newRepositoryObject != null && newRepositoryObject.getProperty() != null) {
        openEditorOperation(newRepositoryObject.getProperty().getItem());
      }
    }
  }
 else {
    if (newJobName != null) {
      property.setLabel(newJobName);
      property.setDisplayName(newJobName);
    }
    if (originalFramework != null) {
      if (property.getAdditionalProperties().containsKey(ConvertJobsUtil.FRAMEWORK)) {
        property.getAdditionalProperties().removeKey(ConvertJobsUtil.FRAMEWORK);
      }
      property.getAdditionalProperties().put(ConvertJobsUtil.FRAMEWORK,originalFramework);
    }
    IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
      @Override public void run(      final IProgressMonitor monitor) throws CoreException {
        try {
          if (repositoryObject.getProperty() != null) {
            proxyRepositoryFactory.save(ProjectManager.getInstance().getCurrentProject(),repositoryObject.getProperty().getItem(),false);
          }
        }
 catch (        PersistenceException e1) {
          e1.printStackTrace();
        }
      }
    }
;
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    try {
      ISchedulingRule schedulingRule=workspace.getRoot();
      workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
    }
 catch (    CoreException e1) {
      MessageBoxExceptionHandler.process(e1.getCause());
    }
    if (repositoryObject instanceof IProcess2) {
      openEditorOperation(property.getItem());
    }
  }
  if (!btnConfirm.isDisposed()) {
    btnConfirm.setEnabled(false);
  }
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  final IProxyRepositoryFactory proxyRepositoryFactory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  Property property=repositoryObject.getProperty();
  if (nameText == null || nameText.isDisposed() || versionText == null || versionText.isDisposed() || purposeText == null || purposeText.isDisposed() || jobTypeCCombo == null || jobTypeCCombo.isDisposed() || jobFrameworkCCombo == null || jobFrameworkCCombo.isDisposed() || statusText == null || statusText.isDisposed() || descriptionText == null || descriptionText.isDisposed() || btnConfirm == null || btnConfirm.isDisposed() || property == null) {
    return;
  }
  String originalName=nameText.getText();
  String originalJobType=jobTypeCCombo.getText();
  String originalFramework=jobFrameworkCCombo.getText();
  String originalversion=versionText.getText();
  String originalPurpose=purposeText.getText();
  String originalStatus=statusText.getText();
  String originalDescription=descriptionText.getText();
  if (repositoryObject instanceof IProcess2) {
    IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
      @Override public void run(      final IProgressMonitor monitor) throws CoreException {
        DeleteActionCache.getInstance().closeOpenedEditor(repositoryObject);
      }
    }
;
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    try {
      ISchedulingRule schedulingRule=workspace.getRoot();
      workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
    }
 catch (    CoreException e1) {
      MessageBoxExceptionHandler.process(e1.getCause());
    }
  }
  String newJobName=null;
  if (!originalName.equals(StringUtils.trimToEmpty(repositoryObject.getLabel()))) {
    newJobName=originalName;
  }
  if (!originalversion.equals(StringUtils.trimToEmpty(repositoryObject.getVersion()))) {
    property.setVersion(originalversion);
  }
  if (!originalPurpose.equals(StringUtils.trimToEmpty(repositoryObject.getPurpose()))) {
    property.setPurpose(originalPurpose);
  }
  if (!originalStatus.equals(StringUtils.trimToEmpty(repositoryObject.getStatusCode()))) {
    property.setStatusCode(getStatusCode(getStatusMap(),originalStatus));
  }
  if (!originalDescription.equals(StringUtils.trimToEmpty(repositoryObject.getDescription()))) {
    property.setDescription(originalDescription);
  }
  boolean convert=true;
  if (originalJobType.equals(StringUtils.trimToEmpty(jobTypeValue))) {
    convert=false;
  }
  if (convert) {
    final Item newItem=ConvertJobsUtil.createOperation(originalName,originalJobType,originalFramework,repositoryObject);
    IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
      @Override public void run(      final IProgressMonitor monitor) throws CoreException {
        try {
          boolean isOpened=false;
          if (repositoryObject instanceof IProcess2) {
            isOpened=true;
            boolean locked=proxyRepositoryFactory.getStatus(repositoryObject) == ERepositoryStatus.LOCK_BY_USER;
            if (locked) {
              proxyRepositoryFactory.unlock(repositoryObject);
            }
          }
          proxyRepositoryFactory.deleteObjectPhysical(repositoryObject);
          proxyRepositoryFactory.saveProject(ProjectManager.getInstance().getCurrentProject());
          if (newItem != null && newItem.getProperty() != null) {
            String newId=newItem.getProperty().getId();
            newRepositoryObject=proxyRepositoryFactory.getLastVersion(ProjectManager.getInstance().getCurrentProject(),newId);
            if (!isOpened) {
              repositoryObject=newRepositoryObject;
              if (!jobTypeCCombo.isDisposed() && !jobFrameworkCCombo.isDisposed()) {
                jobTypeValue=jobTypeCCombo.getText();
                frameworkValue=jobFrameworkCCombo.getText();
              }
            }
          }
        }
 catch (        PersistenceException e1) {
          e1.printStackTrace();
        }
catch (        LoginException e) {
          e.printStackTrace();
        }
      }
    }
;
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    try {
      ISchedulingRule schedulingRule=workspace.getRoot();
      workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
    }
 catch (    CoreException e1) {
      MessageBoxExceptionHandler.process(e1.getCause());
    }
    if (newItem != null && repositoryObject instanceof IProcess2) {
      if (newRepositoryObject != null && newRepositoryObject.getProperty() != null) {
        openEditorOperation(newRepositoryObject.getProperty().getItem());
      }
    }
  }
 else {
    if (newJobName != null) {
      property.setLabel(newJobName);
      property.setDisplayName(newJobName);
    }
    if (originalFramework != null) {
      if (property.getAdditionalProperties().containsKey(ConvertJobsUtil.FRAMEWORK)) {
        property.getAdditionalProperties().removeKey(ConvertJobsUtil.FRAMEWORK);
      }
      property.getAdditionalProperties().put(ConvertJobsUtil.FRAMEWORK,originalFramework);
    }
    IWorkspaceRunnable runnable=new IWorkspaceRunnable(){
      @Override public void run(      final IProgressMonitor monitor) throws CoreException {
        try {
          if (repositoryObject.getProperty() != null) {
            proxyRepositoryFactory.save(ProjectManager.getInstance().getCurrentProject(),repositoryObject.getProperty().getItem(),false);
          }
        }
 catch (        PersistenceException e1) {
          e1.printStackTrace();
        }
      }
    }
;
    IWorkspace workspace=ResourcesPlugin.getWorkspace();
    try {
      ISchedulingRule schedulingRule=workspace.getRoot();
      workspace.run(runnable,schedulingRule,IWorkspace.AVOID_UPDATE,null);
    }
 catch (    CoreException e1) {
      MessageBoxExceptionHandler.process(e1.getCause());
    }
    if (repositoryObject instanceof IProcess2) {
      openEditorOperation(property.getItem());
    }
  }
  IViewPart jobSettingView=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
  if (jobSettingView != null && jobSettingView instanceof IJobSettingsView) {
    Map<String,Object> propertiesMap=new HashMap<String,Object>();
    propertiesMap.put(IJobSettingsView.JOBTYPE_CHANGED,repositoryObject);
    ((IJobSettingsView)jobSettingView).onPropertiesChanged(propertiesMap);
  }
  if (!btnConfirm.isDisposed()) {
    btnConfirm.setEnabled(false);
  }
}