Program: 125499
Project: 125499
Buggy source:
/** 
 * ggu Comment method "addContextForElementParameters".
 * @param process
 * @param connItem
 * @param elementParameters
 * @param category
 * @param checked
 */
private static void addContextForElementParameters(final IProcess2 process,final ConnectionItem connItem,List<? extends IElementParameter> elementParameters,final EComponentCategory category,final boolean ignoreContextMode){
  if (connItem == null || elementParameters == null || process == null) {
    return;
  }
  if (isHadoopSubItem(connItem)) {
    addContextForHadoopElementParameters(process,connItem,elementParameters,category,ignoreContextMode);
    return;
  }
  Connection connection=connItem.getConnection();
  if (connection != null && connection.isContextMode()) {
    Set<String> neededVars=retrieveContextVar(elementParameters,connection,category);
    if (neededVars != null && !neededVars.isEmpty()) {
      ContextItem contextItem=ContextUtils.getContextItemById2(connection.getContextId());
      if (contextItem != null) {
        Set<String> addedVars=checkAndAddContextVariables(contextItem,neededVars,process.getContextManager(),false);
        if (addedVars != null && !addedVars.isEmpty() && !isAddContextVar(contextItem,process.getContextManager(),neededVars)) {
          boolean added=false;
          if (ignoreContextMode) {
            addContextVarForJob(process,contextItem,addedVars);
            added=true;
          }
 else {
            Map<String,Set<String>> addedVarsMap=new HashMap<String,Set<String>>();
            addedVarsMap.put(connItem.getProperty().getId(),addedVars);
            if (showContextdialog(process,contextItem,process.getContextManager(),addedVarsMap,addedVars)) {
              added=true;
            }
          }
          if (added) {
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
              IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
              service.switchToCurContextsView();
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * ggu Comment method "addContextForElementParameters".
 * @param process
 * @param connItem
 * @param elementParameters
 * @param category
 * @param checked
 */
private static void addContextForElementParameters(final IProcess2 process,final ConnectionItem connItem,List<? extends IElementParameter> elementParameters,final EComponentCategory category,final boolean ignoreContextMode){
  if (connItem == null || elementParameters == null || process == null) {
    return;
  }
  if (isHadoopSubItem(connItem)) {
    addContextForHadoopElementParameters(process,connItem,elementParameters,category,ignoreContextMode);
    return;
  }
  Connection connection=connItem.getConnection();
  if (connection != null && connection.isContextMode()) {
    Set<String> neededVars=retrieveContextVar(elementParameters,connection,category);
    if (neededVars != null && !neededVars.isEmpty()) {
      ContextItem contextItem=ContextUtils.getContextItemById2(connection.getContextId());
      if (contextItem != null) {
        Set<String> addedVars=checkAndAddContextVariables(contextItem,neededVars,process.getContextManager(),false);
        if (addedVars != null && !addedVars.isEmpty() && !isAddContextVar(contextItem,process.getContextManager(),neededVars)) {
          AtomicBoolean added=new AtomicBoolean();
          if (ignoreContextMode) {
            addContextVarForJob(process,contextItem,addedVars);
            added.set(true);
          }
 else {
            Map<String,Set<String>> addedVarsMap=new HashMap<String,Set<String>>();
            addedVarsMap.put(connItem.getProperty().getId(),addedVars);
            PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
              @Override public void run(){
                if (showContextdialog(process,contextItem,process.getContextManager(),addedVarsMap,addedVars)) {
                  added.set(true);
                }
              }
            }
);
          }
          if (added.get()) {
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
              IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
              PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
                @Override public void run(){
                  service.switchToCurContextsView();
                }
              }
);
            }
          }
        }
      }
    }
  }
}