Program: 119859
Project: 119859
Buggy source:
public void widgetSelected(SelectionEvent e){
  final ProgressDialog progress=new ProgressDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      IEditorReference[] editorReferences=activePage.getEditorReferences();
      CorePlugin defaultPlugin=CorePlugin.getDefault();
      IDesignerCoreService designerCoreService=defaultPlugin.getDesignerCoreService();
      List<IProcess2> openedProcessList=designerCoreService.getOpenedProcess(RepositoryUpdateManager.getEditors());
      List<String> activeProcessId=new ArrayList<String>();
      for (      IProcess process : openedProcessList) {
        activeProcessId.add(process.getId());
      }
      final int rate=1 / openedProcessList.size() - activeProcessId.size();
      for (      INode runjobNode : tRunJobNodes) {
        String id=(String)runjobNode.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName()).getValue();
        String version=(String)runjobNode.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName()).getValue();
        if ("String_Node_Str".equals(id) || id == null) {
          MessageDialog.openWarning(getShell(),Messages.getString("String_Node_Str",runjobNode.getUniqueName()),Messages.getString("String_Node_Str",runjobNode.getUniqueName()));
          return;
        }
        if (activeProcessId.contains(id)) {
          IEditorPart activeEditorPart=activePage.getActiveEditor();
          for (          IEditorReference editorReference : editorReferences) {
            IEditorPart editorPart=editorReference.getEditor(false);
            if ((editorPart != activeEditorPart) && (editorPart instanceof MultiPageTalendEditor)) {
              IElement element=((MultiPageTalendEditor)editorPart).getProcess();
              StatsAndLogsViewHelper.applySettings(elem,element,AbstractPreferenceComposite.this);
            }
          }
        }
 else {
          try {
            SubProgressMonitor subMonitor=new SubProgressMonitor(monitor,1 * UpdatesConstants.SCALE,SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
            subMonitor.beginTask(UpdatesConstants.EMPTY,1 * rate);
            IRepositoryViewObject lastVersion=DesignerPlugin.getDefault().getProxyRepositoryFactory().getLastVersion(id);
            if (lastVersion != null) {
              Item item=lastVersion.getProperty().getItem();
              IProcess processFromItem=designerCoreService.getProcessFromItem(item);
              if (processFromItem instanceof Process) {
                Process process=(Process)processFromItem;
                StatsAndLogsViewHelper.applySettings(elem,process,AbstractPreferenceComposite.this);
                IProxyRepositoryFactory factory=defaultPlugin.getProxyRepositoryFactory();
                Property property=factory.getUptodateProperty(process.getProperty());
                process.setProperty(property);
                subMonitor.subTask(RepositoryUpdateManager.getUpdateJobInfor(process.getProperty()));
                ProcessType processType=process.saveXmlFile();
                Item item2=process.getProperty().getItem();
                if (item2 instanceof JobletProcessItem) {
                  ((JobletProcessItem)item2).setJobletProcess((JobletProcess)processType);
                }
 else {
                  ((ProcessItem)item2).setProcess(processType);
                }
                factory.save(item2);
                subMonitor.done();
              }
            }
          }
 catch (          PersistenceException e1) {
            e1.printStackTrace();
          }
catch (          IOException e2) {
            e2.printStackTrace();
          }
        }
        applySettingsToSubJob(id,version);
      }
    }
  }
;
  try {
    progress.executeProcess();
  }
 catch (  InvocationTargetException e1) {
    e1.printStackTrace();
  }
catch (  InterruptedException e1) {
    e1.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  final ProgressDialog progress=new ProgressDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()){
    @Override public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      IEditorReference[] editorReferences=activePage.getEditorReferences();
      CorePlugin defaultPlugin=CorePlugin.getDefault();
      IDesignerCoreService designerCoreService=defaultPlugin.getDesignerCoreService();
      List<IProcess2> openedProcessList=designerCoreService.getOpenedProcess(RepositoryUpdateManager.getEditors());
      List<String> activeProcessId=new ArrayList<String>();
      for (      IProcess process : openedProcessList) {
        activeProcessId.add(process.getId());
      }
      final int rate=1 / openedProcessList.size() - activeProcessId.size();
      for (      INode runjobNode : tRunJobNodes) {
        String id=(String)runjobNode.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName()).getValue();
        String version=(String)runjobNode.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName()).getValue();
        if ("String_Node_Str".equals(id) || id == null) {
          MessageDialog.openWarning(getShell(),Messages.getString("String_Node_Str",runjobNode.getUniqueName()),Messages.getString("String_Node_Str",runjobNode.getUniqueName()));
          return;
        }
        if (activeProcessId.contains(id)) {
          IEditorPart activeEditorPart=activePage.getActiveEditor();
          for (          IEditorReference editorReference : editorReferences) {
            IEditorPart editorPart=editorReference.getEditor(false);
            if ((editorPart != activeEditorPart) && (editorPart instanceof MultiPageTalendEditor)) {
              IElement element=((MultiPageTalendEditor)editorPart).getProcess();
              StatsAndLogsViewHelper.applySettings(elem,element,AbstractPreferenceComposite.this);
            }
          }
        }
 else {
          try {
            SubProgressMonitor subMonitor=new SubProgressMonitor(monitor,1 * UpdatesConstants.SCALE,SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
            subMonitor.beginTask(UpdatesConstants.EMPTY,1 * rate);
            IRepositoryViewObject lastVersion=DesignerPlugin.getDefault().getProxyRepositoryFactory().getLastVersion(id);
            if (lastVersion != null) {
              Item item=lastVersion.getProperty().getItem();
              IProcess processFromItem=designerCoreService.getProcessFromItem(item);
              if (processFromItem instanceof Process) {
                Process process=(Process)processFromItem;
                StatsAndLogsViewHelper.applySettings(elem,process,AbstractPreferenceComposite.this);
                IProxyRepositoryFactory factory=defaultPlugin.getProxyRepositoryFactory();
                Property property=factory.getUptodateProperty(process.getProperty());
                process.setProperty(property);
                subMonitor.subTask(RepositoryUpdateManager.getUpdateJobInfor(process.getProperty()));
                ProcessType processType=process.saveXmlFile();
                Item item2=process.getProperty().getItem();
                if (item2 instanceof JobletProcessItem) {
                  ((JobletProcessItem)item2).setJobletProcess((JobletProcess)processType);
                }
 else {
                  ((ProcessItem)item2).setProcess(processType);
                }
                factory.save(item2);
                subMonitor.done();
              }
            }
          }
 catch (          PersistenceException e1) {
            e1.printStackTrace();
          }
catch (          IOException e2) {
            e2.printStackTrace();
          }
        }
        applySettingsToSubJob(id,version);
      }
    }
  }
;
  try {
    progress.executeProcess();
  }
 catch (  InvocationTargetException e1) {
    e1.printStackTrace();
  }
catch (  InterruptedException e1) {
    e1.printStackTrace();
  }
}