/// <summary/>
 public override void Evaluate(object source) {
    var parent = (BplObject)Proxy.RetrieveSource(source);
    var result = new List<BplProxy>();
    foreach (var container in parent.Class.Containers.OrderBy(c => c.Name)) {
       if (container.IsCollection) {
          var bplCollection = container.GetValue(parent) as IBplCollection;
          if (bplCollection != null && bplCollection.Count > 0) {
             var containerProxy = BplProxy.Create(bplCollection, Proxy, container.Name);
             var childProxies = new BplProxy[bplCollection.Count];
             for (var i = 0; i < bplCollection.Count; i++) {
                childProxies[i] = BplProxy.Create(bplCollection[i], containerProxy, i);
             }
             containerProxy.Load(childProxies);
             result.Add(containerProxy);
          }
       } else {
          var childObject = container.GetValue(parent);
          if (childObject != null) {
             var childProxy = BplProxy.Create(childObject, Proxy, container.Name);
             result.Add(childProxy);
          }
       }
    }
    Result = result.ToArray();
 }
      /// <summary/>
      protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) {
         ObjectProvider = objectProvider;
         RootProxy = BplRootProxyQuery.Invoke(this).Result;
         var sourcePath = BplSourcePathQuery.Invoke(this).Result;
         SourceProxy = sourcePath.RetrieveProxy(this);

         var form = new BplVisualizerForm(this);
         windowService.ShowDialog(form);
      }
Exemple #3
0
 /// <summary>Creates a new <see cref="BplPropertyPath"/> instance relative to the given parent proxy.</summary>
 public BplPropertyPath(BplProxy parent, object key) {
    if (parent == null) {
       _path = new object[1];
    } else {
       var parentPath = parent.PropertyPath._path;
       _path = new object[parentPath.Length + 1];
       parentPath.CopyTo(_path, 0);
    }
    _path[_path.Length - 1] = key;
 }
Exemple #4
0
 /// <summary>Creates a new <see cref="BplProxy"/> instance relative to the given parent proxy.</summary>
 public static BplProxy Create(object source, BplProxy parent, object key) {
    var proxy = _create(source);
    proxy.Key = key;
    proxy.PropertyPath = new BplPropertyPath(parent, key);
    if (parent.IsA<BplContainerProxy>()) {
       var child = (BplObjectProxy)proxy;
       child.Text = "{0} : {1}".Substitute(key, child.NameProperty.Nvl(child.BplClass));
    } else {
       proxy.Text = key.ToString();
    }
    return proxy;
 }
Exemple #5
0
      private void _onLoad(object sender, EventArgs e) {
         HierarchyView.ImageList = new ImageList();
         Action<string> addImage = name => HierarchyView.ImageList.Images.Add(name, new Bitmap(typeof(BplDebuggerVisualizer), (@"Resources." + name + ".png")));
         addImage("Empty");
         addImage("BplContext");
         addImage("BplEntity");
         addImage("BplStructure");
         addImage("BplContainer");

         HierarchyView.Nodes.Add(Debugger.RootProxy);
         HierarchyView.BeforeExpand += _onBeforeHierarchyViewExpand;
         HierarchyView.BeforeSelect += _onBeforeHierarchyViewSelect;
         HierarchyView.AfterSelect += _onAfterHierarchyViewSelect;
         Debugger.RootProxy.Expand();

         PropertiesView.CellValueChanged += _onPropertiesViewCellValueChanged;
         PropertiesView.CellEnter += _onPropertiesViewCellEnter;
         PropertiesView.CellLeave += _onPropertiesViewCellLeave;
         DependentsView.CellContentClick += _onReferenceViewCellContentClick;
         PrecedentsView.CellContentClick += _onReferenceViewCellContentClick;

         Selection = Debugger.SourceProxy;
         KeyDown += _onKeyDown;
      }
Exemple #6
0
      /// <summary>Invoked when the <see cref="Selection"/> is changed.</summary>
      protected virtual void OnSelectionChanged(BplProxy oldSelection, BplProxy newSelection) {
         PropertiesView.EndEdit();
         for (var current = _selection.Parent; current != null; current = current.Parent) {
            current.Expand();
         }
         HierarchyView.SelectedNode = Selection;

         if (oldSelection != null) {
            oldSelection.BackColor = Color.FromKnownColor(oldSelection == Debugger.SourceProxy ? KnownColor.InactiveCaption : KnownColor.Window);
            oldSelection.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
         }
         if (newSelection != null) {
            newSelection.BackColor = Color.FromKnownColor(KnownColor.Highlight);
            newSelection.ForeColor = Color.FromKnownColor(KnownColor.HighlightText);
         }

         _recordHistory(oldSelection);
         _updateButtons();
         _updateStatusBar();
         _updatePropertiesView();
         _updateTriggersView();
         _updateDependentsView();
         _updatePrecedentsView();
      }
Exemple #7
0
 private void _onAfterHierarchyViewSelect(object sender, TreeViewEventArgs e) {
    Selection = HierarchyView.SelectedNode as BplProxy;
 }
Exemple #8
0
 private void HomeButton_Click(object sender, EventArgs e) {
    HierarchyView.Select();
    Selection = Debugger.SourceProxy;
 }
Exemple #9
0
 private void ForwardButton_Click(object sender, EventArgs e) {
    if (_future.Count > 0) {
       HierarchyView.Select();
       _suspendHistory = true;
       _history.Push(Selection);
       Selection = _future.Pop();
       _suspendHistory = false;
    }
    _updateButtons();
 }
Exemple #10
0
 private void _recordHistory(BplProxy oldSelection) {
    if (!_suspendHistory && oldSelection != null) {
       _history.Push(oldSelection);
       _future.Clear();
    }
 }
Exemple #11
0
 private void _onReferenceViewCellContentClick(object sender, DataGridViewCellEventArgs e) {
    if (e.ColumnIndex != 1 || e.RowIndex < 0) return;
    var pathString = ((DataGridView)sender).Rows[e.RowIndex].Cells[1].Tag as string;
    if (pathString.IsEmpty()) return;
    var path = BplPropertyPath.Parse(pathString);
    var target = path.RetrieveProxy(Debugger);
    if (target != null) {
       Selection = target;
    } else {
       MessageBox.Show("Reference '{0}' was not found or is out of context.".Substitute(pathString), "BPL Debugger", MessageBoxButtons.OK, MessageBoxIcon.Warning);
    }
 }
Exemple #12
0
 /// <summary>Invokes the query on the debugger side and returns a copy of the original query with the results filled in.</summary>
 public static BplPrecedentsQuery Invoke(BplDebuggerVisualizer debugger, BplProxy proxy) {
    var query = new BplPrecedentsQuery { Proxy = proxy };
    return query.Invoke<BplPrecedentsQuery>(debugger);
 }
Exemple #13
0
 /// <summary/>
 public override void Evaluate(object source) {
    var root = BplDebuggeeObjectSource.RootOf(source);
    Result = BplProxy.Create(root);
 }