Beispiel #1
0
        void TreeExpanding(Object sender, TreeViewAdvEventArgs e)
        {
            if (e.Node.Index >= 0)
            {
                DataNode node = e.Node.Tag as DataNode;
                if (node.Nodes.Count == 0 && node.Variable != null)
                {
                    FlashInterface  flashInterface = PluginMain.debugManager.FlashInterface;
                    List <DataNode> nodes          = new List <DataNode>();
                    List <DataNode> inherited      = new List <DataNode>();
                    List <DataNode> statics        = new List <DataNode>();
                    int             tmpLimit       = node.ChildrenShowLimit;
                    foreach (Variable member in node.Variable.getValue().getMembers(flashInterface.Session))
                    {
                        DataNode memberNode = new DataNode(member);

                        if (member.isAttributeSet(VariableAttribute_.IS_STATIC))
                        {
                            statics.Add(memberNode);
                        }
                        else if (member.getLevel() > 0)
                        {
                            inherited.Add(memberNode);
                        }
                        else
                        {
                            nodes.Add(memberNode);
                        }
                    }
                    if (inherited.Count > 0)
                    {
                        DataNode inheritedNode = new DataNode("[inherited]");
                        inherited.Sort();
                        foreach (DataNode item in inherited)
                        {
                            inheritedNode.Nodes.Add(item);
                        }
                        node.Nodes.Add(inheritedNode);
                    }
                    if (statics.Count > 0)
                    {
                        DataNode staticNode = new DataNode("[static]");
                        statics.Sort();
                        foreach (DataNode item in statics)
                        {
                            staticNode.Nodes.Add(item);
                        }
                        node.Nodes.Add(staticNode);
                    }
                    //test children
                    foreach (String ch in node.Variable.getValue().getClassHierarchy(false))
                    {
                        if (ch.Equals("flash.display::DisplayObjectContainer"))
                        {
                            double   numChildren  = ((java.lang.Double)node.Variable.getValue().getMemberNamed(flashInterface.Session, "numChildren").getValue().getValueAsObject()).doubleValue();
                            DataNode childrenNode = new DataNode("[children]");
                            for (int i = 0; i < numChildren; i++)
                            {
                                try
                                {
                                    IASTBuilder b   = new ASTBuilder(false);
                                    string      cmd = GetVariablePath(node) + ".getChildAt(" + i + ")";
                                    ValueExp    exp = b.parse(new java.io.StringReader(cmd));
                                    var         ctx = new ExpressionContext(flashInterface.Session, flashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame]);
                                    var         obj = exp.evaluate(ctx);
                                    if (obj is flash.tools.debugger.concrete.DValue)
                                    {
                                        obj = new flash.tools.debugger.concrete.DVariable("getChildAt(" + i + ")", (flash.tools.debugger.concrete.DValue)obj, ((flash.tools.debugger.concrete.DValue)obj).getIsolateId());
                                    }
                                    DataNode childNode = new DataNode((Variable)obj);
                                    childNode.Text = "child_" + i;
                                    childrenNode.Nodes.Add(childNode);
                                }
                                catch (Exception) { }
                            }
                            node.Nodes.Add(childrenNode);
                        }
                        else if (ch.Equals("flash.events::EventDispatcher"))
                        {
                            Variable list = node.Variable.getValue().getMemberNamed(flashInterface.Session, "listeners");
                            var      omg  = list.getName();

                            /*
                             * double numChildren = ((java.lang.Double)node.Variable.getValue().getMemberNamed(flashInterface.Session, "numChildren").getValue().getValueAsObject()).doubleValue();
                             * DataNode childrenNode = new DataNode("[children]");
                             * for (int i = 0; i < numChildren; i++)
                             * {
                             *  try
                             *  {
                             *
                             *      IASTBuilder b = new ASTBuilder(false);
                             *      string cmd = GetVariablePath(node) + ".getChildAt(" + i + ")";
                             *      ValueExp exp = b.parse(new java.io.StringReader(cmd));
                             *      var ctx = new ExpressionContext(flashInterface.Session, flashInterface.Session.getFrames()[PluginMain.debugManager.CurrentFrame]);
                             *      var obj = exp.evaluate(ctx);
                             *      if (obj is flash.tools.debugger.concrete.DValue) obj = new flash.tools.debugger.concrete.DVariable("child_" + i, (flash.tools.debugger.concrete.DValue)obj);
                             *      DataNode childNode = new DataNode((Variable)obj);
                             *      childrenNode.Nodes.Add(childNode);
                             *  }
                             *  catch (Exception) { }
                             * }
                             * node.Nodes.Add(childrenNode);
                             * */
                        }
                    }
                    //test children
                    nodes.Sort();
                    _tree.BeginUpdate();
                    foreach (DataNode item in nodes)
                    {
                        if (0 == tmpLimit--)
                        {
                            break;
                        }
                        node.Nodes.Add(item);
                    }
                    if (tmpLimit == -1)
                    {
                        DataNode moreNode = new DataNode("...");
                        node.Nodes.Add(moreNode);
                    }
                    _tree.EndUpdate();
                }
            }
        }
Beispiel #2
0
 public string GetFullPath(DataNode node)
 {
     return(_model.GetFullPath(node));
 }
Beispiel #3
0
        public DataNode GetNode(string fullpath)
        {
            DataNode node = _model.FindNode(fullpath) as DataNode;

            return(node);
        }
Beispiel #4
0
 public DataNode AddNode(DataNode node)
 {
     _model.Root.Nodes.Add(node);
     RestoreExpanded();
     return(node);
 }
        private void CopyItemClick(Object sender, System.EventArgs e)
        {
            DataNode node = Tree.SelectedNode.Tag as DataNode;

            Clipboard.SetText(string.Format("{0} = {1}", node.Text, node.Value));
        }
 public DataNode AddNode(DataNode node)
 {
     _model.Root.Nodes.Add(node);
     return(node);
 }