private void checkContextGroupSource() {
   IContextManager contextManager = getContextManager();
   if (helper == null) {
     return;
   }
   if (contextManager != null) {
     helper.initHelper(contextManager);
     Map<String, Item> items = new HashMap<String, Item>();
     boolean needRefresh = false;
     for (IContextParameter param : contextManager.getDefaultContext().getContextParameterList()) {
       if (!param.isBuiltIn()) {
         String source = param.getSource();
         Item sourceItem = items.get(source);
         if (sourceItem == null) {
           sourceItem = ContextUtils.getRepositoryContextItemById(source);
         }
         if (sourceItem == null) { // source not found
           needRefresh = true;
           param.setSource(IContextParameter.BUILT_IN);
           propagateType(contextManager, param);
         } else {
           items.put(source, sourceItem);
         }
       }
     }
     if (needRefresh) {
       setModifiedFlag(contextManager);
       modelManager.refresh();
     }
   }
 }
  /**
   * ggu Comment method "changeContextOrder".
   *
   * <p>order the context parameter
   */
  public static boolean changeContextOrder(
      TreeViewer viewer, IContextModelManager modelManager, boolean up) {
    if (viewer == null || modelManager == null) {
      return false;
    }
    final ISelection selection = viewer.getSelection();
    if (selection == null || selection.isEmpty()) {
      return false;
    }
    if (!(selection instanceof IStructuredSelection)) {
      return false;
    }
    IStructuredSelection sSection = (IStructuredSelection) selection;
    if (sSection.size() != 1) { // not support multi-selection
      return false;
    }

    Object element = sSection.getFirstElement();
    IContextParameter movedParam = null;
    if (element instanceof ContextVariableTabParentModel) {
      movedParam = ((ContextVariableTabParentModel) element).getContextParameter();
    }

    if (element instanceof ContextTableTabParentModel) {
      movedParam = ((ContextTableTabParentModel) element).getContextParameter();
    }
    if (movedParam == null) {
      return false;
    }

    OrderContextParameterCommand orderCommand =
        new OrderContextParameterCommand(modelManager.getContextManager(), movedParam, up);
    final CommandStack commandStack = modelManager.getCommandStack();
    if (commandStack != null) {
      commandStack.execute(orderCommand);
    } else {
      orderCommand.execute();
    }
    //
    modelManager.refresh();

    revertTreeSelection(viewer, movedParam);

    return orderCommand.isExecution();
  }
  /**
   * ggu Comment method "changeContextOrder".
   *
   * <p>order the context parameter
   */
  public static boolean changeContextOrder(
      ISelection selObj, IContextModelManager modelManager, boolean up) {
    if (selObj == null || selObj.isEmpty()) {
      return false;
    }
    if (!(selObj instanceof IStructuredSelection)) {
      return false;
    }
    IStructuredSelection sSection = (IStructuredSelection) selObj;
    if (sSection.size() != 1) { // not support multi-selection
      return false;
    }

    Object element = sSection.getFirstElement();
    Object model = ((ContextTreeNode) element).getTreeData();
    IContextParameter movedParam = null;

    if (model instanceof ContextTableTabParentModel) {
      movedParam = ((ContextTableTabParentModel) model).getContextParameter();
    } else if (model instanceof ContextTableTabChildModel) { // for bug TDI-32821
      movedParam = ((ContextTableTabChildModel) model).getContextParameter();
    }
    if (movedParam == null) {
      return false;
    }

    OrderContextParameterCommand orderCommand =
        new OrderContextParameterCommand(modelManager.getContextManager(), movedParam, up);
    final CommandStack commandStack = modelManager.getCommandStack();
    if (commandStack != null) {
      commandStack.execute(orderCommand);
    } else {
      orderCommand.execute();
    }

    modelManager.refresh();

    return orderCommand.isExecution();
  }