@Override
 public void undo() {
   for (int i = 0; i < contextManager.getListContext().size(); i++) {
     IContext context = contextManager.getListContext().get(i);
     List<IContextParameter> listParams = context.getContextParameterList();
     List<IContextParameter> contextParamList = mapParams.get(context.getName());
     if (contextParamList != null) {
       listParams.addAll(contextParamList);
     }
   }
   contextManager.fireContextsChangedEvent();
   helper.refreshContextView();
 }
 /**
  * Changed by Marvin Wang on Mar.6, 2012 for bug TDI-8574, for each JobContext, only has one
  * JobContextParameter with the unique combination of source and name. The original algorithm will
  * cause some JobContextParamters can not be removed.
  */
 @Override
 public void execute() {
   mapParams.clear();
   if (contextParamNames != null && contextParamNames.size() > 0) {
     Iterator<String> it = contextParamNames.iterator();
     while (it.hasNext()) {
       String contextParaName = it.next();
       removeParameterFromContext(paraSourceId, contextParaName);
     }
   }
   contextManager.fireContextsChangedEvent();
   if (needRefresh) {
     helper.refreshContextView();
   }
 }
 private void updateRelation() {
   // set updated flag.
   if (param != null) {
     IContextManager manager = modelManager.getContextManager();
     if (manager != null && manager instanceof JobContextManager) {
       JobContextManager jobContextManager = (JobContextManager) manager;
       // not added new
       if (!modelManager.isRepositoryContext()
           || modelManager.isRepositoryContext()
               && jobContextManager.isOriginalParameter(param.getName())) {
         jobContextManager.setModified(true);
         manager.fireContextsChangedEvent();
       }
     }
   }
 }
 private void updateRelation(String _oldName, String _newName) {
   // set updated flag.
   if (param != null) {
     IContextManager manager = modelManager.getContextManager();
     if (manager != null && manager instanceof JobContextManager) {
       JobContextManager jobContextManager = (JobContextManager) manager;
       // not added new
       if (!modelManager.isRepositoryContext()
           || modelManager.isRepositoryContext()
               && jobContextManager.isOriginalParameter(param.getName())) {
         jobContextManager.setModified(true);
         manager.fireContextsChangedEvent();
       }
     }
   }
   // update nodes in the job
   if (modelManager instanceof ContextComposite) {
     ((ContextComposite) modelManager).switchSettingsView(_oldName, _newName);
   }
 }