コード例 #1
0
 /// <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();
 }
コード例 #2
0
      /// <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);
      }
コード例 #3
0
ファイル: BplPropertyPath.cs プロジェクト: borkaborka/gmit
 /// <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;
 }
コード例 #4
0
ファイル: BplProxy.cs プロジェクト: borkaborka/gmit
 /// <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;
 }
コード例 #5
0
ファイル: BplVisualizerForm.cs プロジェクト: borkaborka/gmit
      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;
      }
コード例 #6
0
ファイル: BplVisualizerForm.cs プロジェクト: borkaborka/gmit
      /// <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();
      }
コード例 #7
0
ファイル: BplVisualizerForm.cs プロジェクト: borkaborka/gmit
 private void _onAfterHierarchyViewSelect(object sender, TreeViewEventArgs e) {
    Selection = HierarchyView.SelectedNode as BplProxy;
 }
コード例 #8
0
ファイル: BplVisualizerForm.cs プロジェクト: borkaborka/gmit
 private void HomeButton_Click(object sender, EventArgs e) {
    HierarchyView.Select();
    Selection = Debugger.SourceProxy;
 }
コード例 #9
0
ファイル: BplVisualizerForm.cs プロジェクト: borkaborka/gmit
 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();
 }
コード例 #10
0
ファイル: BplVisualizerForm.cs プロジェクト: borkaborka/gmit
 private void _recordHistory(BplProxy oldSelection) {
    if (!_suspendHistory && oldSelection != null) {
       _history.Push(oldSelection);
       _future.Clear();
    }
 }
コード例 #11
0
ファイル: BplVisualizerForm.cs プロジェクト: borkaborka/gmit
 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);
    }
 }
コード例 #12
0
ファイル: BplPrecedentsQuery.cs プロジェクト: borkaborka/gmit
 /// <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);
 }
コード例 #13
0
ファイル: BplRootProxyQuery.cs プロジェクト: borkaborka/gmit
 /// <summary/>
 public override void Evaluate(object source) {
    var root = BplDebuggeeObjectSource.RootOf(source);
    Result = BplProxy.Create(root);
 }