Program: 128679
Project: 128679
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;
  }
  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()) {
          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);
            ShowAddedContextdialog showDialog=new ShowAddedContextdialog(addedVarsMap,true);
            if (showDialog.open() == Window.OK) {
              addContextVarForJob(process,contextItem,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;
  }
  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();
            }
          }
        }
      }
    }
  }
}