private HashMap<String, HashMap<String, IVariable>> getModuleDescriptors(
     IVariable[] variables, NesCVariableNameParser varPars) {
   HashMap<String, HashMap<String, IVariable>> res =
       new HashMap<String, HashMap<String, IVariable>>();
   for (IVariable var : variables) {
     try {
       if (varPars.isNesCVariable(var.getName())) {
         String name = var.getName();
         String desc = varPars.getModuleName(name);
         String varName = varPars.getVariableName(name);
         if (desc != null) {
           HashMap<String, IVariable> modVars = res.get(desc);
           if (modVars == null) {
             modVars = new HashMap<String, IVariable>();
             res.put(desc, modVars);
           }
           modVars.put(varName, var);
         }
       }
     } catch (DebugException e) {
       TinyOSDebugPlugin.getDefault().log("Exception while extracting module descriptors.", e);
     }
   }
   return res;
 }
    private void addVariable(IVariable var, NesCVariableNameParser varPars, TreeParent parent) {
      try {
        IValue val = var.getValue();
        String cVarName = var.getName();
        String name = varPars.getVariableName(cVarName);
        TreeNode node = parent.hasChild(name);
        if (val.hasVariables()) {
          // var consists of multiple inner variables... (like for example a struct)
          if (node == null) {
            node = new TreeParent(name);
            node.setData(var);
            parent.addChild(node);
          }
          for (IVariable innerVar : val.getVariables()) {
            addVariable(innerVar, varPars, (TreeParent) node);
          }
        } else {
          if (node == null) {
            node = new TreeParent(name); // Leaf
            node.setData(var);
            parent.addChild(node);
          }
        }

      } catch (DebugException e) {
        TinyOSDebugPlugin.getDefault().log("Exception while adding variable to tree.", e);
      }
    }