Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4753


Ignore:
Timestamp:
11/09/10 11:09:37 (14 years ago)
Author:
epitzer
Message:

Show expected parameter values and include type information in tool tip (#47)

Location:
branches/HeuristicLab.DebugEngine
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DebugEngine/DebugEngine.cs

    r4747 r4753  
    6262      OperationCollection coll = next as OperationCollection;
    6363      while (coll != null) {
     64        Log.LogMessage("Expanding OperationCollection");
    6465        for (int i = coll.Count - 1; i >= 0; i--) {
    6566          ExecutionStack.Push(coll[i]);
     
    7071      IAtomicOperation operation = next as IAtomicOperation;
    7172      if (operation != null) {
     73        Log.LogMessage("Preparing IAtomicOperation");
    7274        try {
    7375          currentOperator = operation.Operator;
     
    7779            Pause();
    7880          }
     81          Log.LogMessage("Executing IAtomicOperation");
    7982          ExecutionStack.Push(operation.Operator.Execute((IExecutionContext)operation));
    8083        } catch (Exception ex) {
     
    8386        }
    8487      } else {
     88        Log.LogMessage("Nothing to do");
    8589        CurrentOperation = null;
    8690      }
     
    99103      OnStarted();
    100104      var lastUpdateTime = DateTime.Now;
    101       if (ExecutionStack.Count > 0)
     105      if (ExecutionStack.Count > 0) {
     106        while (ExecutionStack.Count > 0 && ExecutionStack.Peek() == null)
     107          ExecutionStack.Pop();
    102108        ProcessNextOperation();
     109      }
    103110      ExecutionTime += DateTime.Now - lastUpdateTime;
    104111      OnPaused();
  • branches/HeuristicLab.DebugEngine/DebugEngineView.Designer.cs

    r4747 r4753  
    141141      this.executionStackTreeView.Location = new System.Drawing.Point(3, 16);
    142142      this.executionStackTreeView.Name = "executionStackTreeView";
     143      this.executionStackTreeView.ShowNodeToolTips = true;
    143144      this.executionStackTreeView.Size = new System.Drawing.Size(252, 143);
    144145      this.executionStackTreeView.TabIndex = 2;
     
    170171      this.scopeTreeView.Location = new System.Drawing.Point(3, 16);
    171172      this.scopeTreeView.Name = "scopeTreeView";
     173      this.scopeTreeView.ShowNodeToolTips = true;
    172174      this.scopeTreeView.Size = new System.Drawing.Size(247, 143);
    173175      this.scopeTreeView.TabIndex = 0;
  • branches/HeuristicLab.DebugEngine/DebugEngineView.cs

    r4747 r4753  
    2727using HeuristicLab.Core.Views;
    2828using HeuristicLab.MainForm;
     29using HeuristicLab.Persistence.Auxiliary;
    2930namespace HeuristicLab.DebugEngine {
    3031  /// <summary>
     
    116117        Invoke(new Action(UpdateView));
    117118      } else {
     119        executionStackTreeView.BeginUpdate();
    118120        executionStackTreeView.Nodes.Clear();
    119121        AddOperations(executionStackTreeView.Nodes, Content.ExecutionStack.ToArray());
    120122        executionStackTreeView.ExpandAll();
    121 
     123        if (executionStackTreeView.Nodes.Count > 0)
     124          executionStackTreeView.TopNode = executionStackTreeView.Nodes[0];
     125        executionStackTreeView.EndUpdate();
     126
     127
     128        scopeTreeView.BeginUpdate();
    122129        scopeTreeView.Nodes.Clear();
    123130        if (Content.CurrentOperation != null) {
     
    125132        }
    126133        scopeTreeView.ExpandAll();
    127       }
     134        if (scopeTreeView.Nodes.Count > 0)
     135          scopeTreeView.TopNode = scopeTreeView.Nodes[0];
     136        scopeTreeView.EndUpdate();
     137      }
     138    }
     139
     140    private string TypeName(object obj) {
     141      if (obj == null)
     142        return "null";
     143      return TypeNameParser.Parse(obj.GetType().ToString()).GetTypeNameInCode(true);
    128144    }
    129145
     
    134150          TreeNode node = nodes.Add(atom.Operator.Name);
    135151          node.Tag = atom;
     152          node.ToolTipText = TypeName(atom);
    136153          if (atom.Operator.Breakpoint)
    137154            node.ForeColor = Color.Red;
    138155          foreach (var param in atom.Operator.Parameters) {
    139             IItem value = null;
    140             try {
    141               value = param.ActualValue;
    142             } catch (Exception) { }
    143             TreeNode paramNode = node.Nodes.Add(string.Format("Param {0}={1}", param.Name, value));
     156            string typeName = "null";
     157            TreeNode paramNode = node.Nodes.Add(string.Format("Param {0} = {1}", param.Name, GetApproximateValue(param, ref typeName)));
    144158            paramNode.Tag = param;
     159            paramNode.ToolTipText = string.Format("{0} = {1}", TypeName(param), typeName);
    145160          }
    146161        } else if (op is OperationCollection) {
     
    148163          TreeNode node = executionStackTreeView.Nodes.Add(string.Format("{0} Operations", ops.Count));
    149164          node.Tag = op;
     165          node.ToolTipText = TypeName(ops);
    150166          AddOperations(node.Nodes, ops);
    151167        }
    152168      }
     169    }
     170
     171    private string GetApproximateValue(IParameter param, ref string typeName) {
     172      string value = "<none>";
     173      try {
     174        IExecutionContext context = Content.CurrentOperation as IExecutionContext;
     175        IExecutionContext oldContext = param.ExecutionContext;
     176        if (context != null) {
     177          param.ExecutionContext = context;
     178        }
     179        value = param.ActualValue.ToString();
     180        typeName = TypeName(param.ActualValue);
     181        if (context != oldContext) {
     182          param.ExecutionContext = oldContext;
     183          value = string.Format("~ {0}", value);
     184        }
     185      } catch (Exception) { }
     186      return value;
    153187    }
    154188
     
    158192        TreeNode varNode = node.Nodes.Add(string.Format("{0}={1}", var.Name, var.Value.ToString()));
    159193        varNode.Tag = var.Value;
     194        varNode.ToolTipText = TypeName(var.Value);
    160195      }
    161196      foreach (var subScope in scope.SubScopes) {
  • branches/HeuristicLab.DebugEngine/DebugEngineView.resx

    r4746 r4753  
    122122    <value>
    123123        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
    124         YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALDAAA
    125         CwwBP0AiyAAAAXxJREFUOE9j+P//PwM6Tuh5woZNHJsYhmaQIqABpkDMQowhWA0onPX8f/zkt/bohoDE
     124        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCwAA
     125        CwsBbQSEtwAAAXxJREFUOE9j+P//PwM6Tuh5woZNHJsYhmaQIqABpkDMQowhWA0onPX8f/zkt/bohoDE
    126126        G+Y9/xXb8fANzHCsBuTOfPY/ofve/7gJr72QvQMSX3Xk/f/w9gdA/RCvYzUgY8rT//P2//4f1HDzL9CA
    127127        bJghIPGF+z78D264ht8AoIb/s/f9+t+59e9/t9LL/4H8PJAhIPFpW97/96++gN+AyK5H/6ds+/W/ZOnf
     
    135135    <value>
    136136        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
    137         YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALDwAA
    138         Cw8BkvkDpQAAAkNJREFUOE+d0l1IU2EYB/AZXSR0GV10bRclXWRdRB8kk5TIMV3iFgWC1FhgZbNlBNY2
     137        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALDgAA
     138        Cw4BQL7hQQAAAkNJREFUOE+d0l1IU2EYB/AZXSR0GV10bRclXWRdRB8kk5TIMV3iFgWC1FhgZbNlBNY2
    139139        KqEwzbkMwpVzKyoWeswuXNOWy8yZ8zPXyMlcbbbvj+NZ24x/74JC7BjSgQfOxfv+zv95zpMFgKN60LW+
    140140        KH9X0ez8At/1xb8tGqc3B4KRjRuysz/lbM1rquBtpzirPRmg941Nrm6nxrpMQwmj9SOMU07cowZwsUkP
Note: See TracChangeset for help on using the changeset viewer.