コード例 #1
0
        void ValueNodeTextBox_LabelChanged(object sender, LabelEventArgs e)
        {
            NodeTextBox box = sender as NodeTextBox;

            if (box.Parent.CurrentNode == null)
            {
                return;
            }
            VariableNode node = box.Parent.CurrentNode.Tag as VariableNode;

            node.IsEditing = false;
            try
            {
                var         debugManager   = PluginMain.debugManager;
                var         flashInterface = debugManager.FlashInterface;
                IASTBuilder b   = new ASTBuilder(false);
                ValueExp    exp = b.parse(new java.io.StringReader(node.GetVariablePath()));
                var         ctx = new ExpressionContext(flashInterface.Session, flashInterface.GetFrames()[debugManager.CurrentFrame]);
                var         obj = exp.evaluate(ctx);
                node.Variable = (Variable)obj;
                if (!watchMode)
                {
                    PanelsHelper.watchUI.UpdateElements();
                }
                if (ValueChanged != null)
                {
                    ValueChanged(this, EventArgs.Empty);
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ShowError(TextHelper.GetString("Error.Reevaluate"), ex);
            }
        }
コード例 #2
0
ファイル: ImmediateUI.cs プロジェクト: xeronith/flashdevelop
 private string processExpr(string expr)
 {
     IASTBuilder builder = new ASTBuilder(true);
     ValueExp exp = builder.parse(new java.io.StringReader(expr));
     var ctx = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, PluginMain.debugManager.FlashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame]);
     var obj = exp.evaluate(ctx);
     if (obj is Variable) return ctx.FormatValue(((Variable)obj).getValue());
     if (obj is Value) return ctx.FormatValue((Value)obj);
     return obj.toString();
 }
コード例 #3
0
        private void Manager_OnMouseHover(ScintillaControl sci, Int32 position)
        {
            DebuggerManager debugManager   = PluginMain.debugManager;
            FlashInterface  flashInterface = debugManager.FlashInterface;

            if (!PluginBase.MainForm.EditorMenu.Visible && flashInterface != null &&
                flashInterface.isDebuggerStarted && flashInterface.isDebuggerSuspended)
            {
                if (debugManager.CurrentLocation != null &&
                    debugManager.CurrentLocation.File != null)
                {
                    String localPath = debugManager.GetLocalPath(debugManager.CurrentLocation.File);

                    if (localPath == null || localPath != PluginBase.MainForm.CurrentDocument.FileName)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }

                Point     dataTipPoint = Control.MousePosition;
                Rectangle rect         = new Rectangle(m_ToolTip.Location, m_ToolTip.Size);

                if (m_ToolTip.Visible && rect.Contains(dataTipPoint))
                {
                    return;
                }

                position = sci.WordEndPosition(position, true);
                String leftword = GetWordAtPosition(sci, position);
                if (leftword != String.Empty)
                {
                    try
                    {
                        ASTBuilder builder = new ASTBuilder(true);

                        ValueExp          exp     = builder.parse(new System.IO.StringReader(leftword));
                        ExpressionContext context = new ExpressionContext(flashInterface.Session);

                        context.Depth = debugManager.CurrentFrame;

                        Object obj = exp.evaluate(context);

                        Show(dataTipPoint, (Variable)obj);
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
        }
コード例 #4
0
        private string processExpr(string expr)
        {
            IASTBuilder builder = new ASTBuilder(true);
            ValueExp    exp     = builder.parse(new java.io.StringReader(expr));
            var         ctx     = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, PluginMain.debugManager.FlashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame]);
            var         obj     = exp.evaluate(ctx);

            if (obj is Variable)
            {
                return(ctx.FormatValue(((Variable)obj).getValue()));
            }
            if (obj is Value)
            {
                return(ctx.FormatValue((Value)obj));
            }
            return(obj.toString());
        }
コード例 #5
0
ファイル: WatchUI.cs プロジェクト: wise0704/FlashDevelop
        private DataNode GetExpressionNode(string item)
        {
            DataNode node;

            try
            {
                if (!PluginMain.debugManager.FlashInterface.isDebuggerStarted || !PluginMain.debugManager.FlashInterface.isDebuggerSuspended)
                {
                    return(new ErrorNode(item, new Exception("")));
                }

                IASTBuilder builder = new ASTBuilder(false);
                ValueExp    exp     = builder.parse(new java.io.StringReader(item));
                var         ctx     = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, PluginMain.debugManager.FlashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame]);
                var         obj     = exp.evaluate(ctx);
                if (obj is Variable)
                {
                    node = new VariableNode((Variable)obj)
                    {
                        HideClassId       = PluginMain.settingObject.HideClassIds,
                        HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                    };
                }
                else if (obj is Value)
                {
                    node = new ValueNode(item, (Value)obj)
                    {
                        HideClassId       = PluginMain.settingObject.HideClassIds,
                        HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                    };
                }
                else
                {
                    node = new ScalarNode(item, obj.toString());
                }
                node.Tag = item;
            }
            catch (Exception ex)
            {
                node = new ErrorNode(item, ex);
            }
            node.Text = item;
            return(node);
        }
コード例 #6
0
ファイル: WatchUI.cs プロジェクト: heon21st/flashdevelop
		public void UpdateElements()
		{
			treeControl.Tree.BeginUpdate();
			treeControl.Nodes.Clear();
			foreach (String item in watches)
			{
				DataNode node = new DataNode(item); // todo, introduce new Node types.
				try
				{
                    IASTBuilder builder = new ASTBuilder(false);
                    ValueExp exp = builder.parse(new java.io.StringReader(item));
                    var ctx = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, PluginMain.debugManager.FlashInterface.Session.getFrames()[PluginMain.debugManager.CurrentFrame]);
                    var obj = exp.evaluate(ctx);
                    node = new DataNode((Variable)obj);
				}
				catch { }
				node.Text = item;
				treeControl.AddNode(node);
			}
			treeControl.Tree.EndUpdate();
			treeControl.Enabled = true;
		}
コード例 #7
0
 public void UpdateElements()
 {
     treeControl.Tree.BeginUpdate();
     treeControl.Nodes.Clear();
     foreach (String item in watches)
     {
         DataNode node = new DataNode(item);                 // todo, introduce new Node types.
         try
         {
             IASTBuilder builder = new ASTBuilder(false);
             ValueExp    exp     = builder.parse(new java.io.StringReader(item));
             var         ctx     = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, PluginMain.debugManager.FlashInterface.Session.getFrames()[PluginMain.debugManager.CurrentFrame]);
             var         obj     = exp.evaluate(ctx);
             node = new DataNode((Variable)obj);
         }
         catch { }
         node.Text = item;
         treeControl.AddNode(node);
     }
     treeControl.Tree.EndUpdate();
     treeControl.Enabled = true;
 }
コード例 #8
0
 public void UpdateElements()
 {
     treeControl.Tree.BeginUpdate();
     treeControl.Nodes.Clear();
     foreach (String item in watches)
     {
         DataNode node = new DataNode(item);                 // todo, introduce new Node types.
         try
         {
             ASTBuilder        builder = new ASTBuilder(true);
             ValueExp          exp     = builder.parse(new System.IO.StringReader(item));
             ExpressionContext context = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session);
             context.Depth = PluginMain.debugManager.CurrentFrame;
             Object obj = exp.evaluate(context);
             node = new DataNode((Variable)obj);
         }
         catch { }
         node.Text = item;
         treeControl.AddNode(node);
     }
     treeControl.Tree.EndUpdate();
     treeControl.Enabled = true;
 }
コード例 #9
0
        public void ListChildItems(ValueNode node)
        {
            if (node != null && node.Nodes.Count == 0 && node.PlayerValue != null)
            {
                FlashInterface      flashInterface = PluginMain.debugManager.FlashInterface;
                List <VariableNode> nodes          = new List <VariableNode>();
                List <VariableNode> inherited      = new List <VariableNode>();
                List <VariableNode> statics        = new List <VariableNode>();
                int tmpLimit = node.ChildrenShowLimit;
                foreach (Variable member in node.PlayerValue.getMembers(flashInterface.Session))
                {
                    VariableNode memberNode = new VariableNode(member)
                    {
                        HideClassId       = PluginMain.settingObject.HideClassIds,
                        HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                    };
                    if (member.isAttributeSet(VariableAttribute_.IS_STATIC))
                    {
                        statics.Add(memberNode);
                    }
                    else if (member.getLevel() > 0)
                    {
                        inherited.Add(memberNode);
                    }
                    else
                    {
                        nodes.Add(memberNode);
                    }
                }
                // inherited vars
                if (inherited.Count > 0)
                {
                    if (PluginMain.settingObject.CombineInherited)
                    {
                        // list inherited alongside main class members
                        foreach (DataNode item in inherited)
                        {
                            node.Nodes.Add(item);
                        }
                    }
                    else
                    {
                        // list inherited in a [inherited] group
                        ValueNode inheritedNode = new ValueNode("[inherited]");
                        inherited.Sort();
                        foreach (DataNode item in inherited)
                        {
                            inheritedNode.Nodes.Add(item);
                        }
                        node.Nodes.Add(inheritedNode);
                    }
                }
                // static vars
                if (!PluginMain.settingObject.HideStaticMembers && statics.Count > 0)
                {
                    DataNode staticNode = new ValueNode("[static]");
                    statics.Sort();
                    foreach (DataNode item in statics)
                    {
                        staticNode.Nodes.Add(item);
                    }
                    node.Nodes.Add(staticNode);
                }
                // test children
                foreach (String ch in node.PlayerValue.getClassHierarchy(false))
                {
                    if (ch.Equals("flash.display::DisplayObjectContainer"))
                    {
                        double   numChildren  = ((java.lang.Double)node.PlayerValue.getMemberNamed(flashInterface.Session, "numChildren").getValue().getValueAsObject()).doubleValue();
                        DataNode childrenNode = new ValueNode("[children]");
                        for (int i = 0; i < numChildren; i++)
                        {
                            try
                            {
                                IASTBuilder b   = new ASTBuilder(false);
                                string      cmd = node.GetVariablePath() + ".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 VariableNode((Variable)obj)
                                {
                                    HideClassId       = PluginMain.settingObject.HideClassIds,
                                    HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                                };
                                childNode.Text = "child_" + i;
                                childrenNode.Nodes.Add(childNode);
                            }
                            catch (Exception) { }
                        }
                        node.Nodes.Add(childrenNode);
                    }
                    else if (ch.Equals("flash.events::EventDispatcher"))
                    {
                        Variable list = node.PlayerValue.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();
                // add child items
                _tree.BeginUpdate();
                foreach (DataNode item in nodes)
                {
                    if (0 == tmpLimit--)
                    {
                        break;
                    }
                    node.Nodes.Add(item);
                }
                if (tmpLimit == -1)
                {
                    DataNode moreNode = new ContinuedDataNode();
                    node.Nodes.Add(moreNode);
                }
                _tree.EndUpdate();
            }
        }
コード例 #10
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();
                }
            }
        }
コード例 #11
0
        public void ListChildItems(ValueNode node)
        {
            if (node != null && node.Nodes.Count == 0 && node.PlayerValue != null)
            {
                FlashInterface flashInterface = PluginMain.debugManager.FlashInterface;
                List<VariableNode> nodes = new List<VariableNode>();
                List<VariableNode> inherited = new List<VariableNode>();
                List<VariableNode> statics = new List<VariableNode>();
                int tmpLimit = node.ChildrenShowLimit;
                foreach (Variable member in node.PlayerValue.getMembers(flashInterface.Session))
                {
                    VariableNode memberNode = new VariableNode(member)
                    {
                        HideClassId = PluginMain.settingObject.HideClassIds,
                        HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                    };
                    if (member.isAttributeSet(VariableAttribute_.IS_STATIC))
                    {
                        statics.Add(memberNode);
                    }
                    else if (member.getLevel() > 0)
                    {
                        inherited.Add(memberNode);
                    }
                    else nodes.Add(memberNode);
                }
                // inherited vars
                if (inherited.Count > 0)
                {
                    if (PluginMain.settingObject.CombineInherited)
                    {
                        // list inherited alongside main class members
                        foreach (DataNode item in inherited)
                        {
                            node.Nodes.Add(item);
                        }

                    }
                    else
                    {
                        // list inherited in a [inherited] group
                        ValueNode inheritedNode = new ValueNode("[inherited]");
                        inherited.Sort();
                        foreach (DataNode item in inherited)
                        {
                            inheritedNode.Nodes.Add(item);
                        }
                        node.Nodes.Add(inheritedNode);

                    }
                }
                // static vars
                if (!PluginMain.settingObject.HideStaticMembers && statics.Count > 0)
                {
                    DataNode staticNode = new ValueNode("[static]");
                    statics.Sort();
                    foreach (DataNode item in statics)
                    {
                        staticNode.Nodes.Add(item);
                    }
                    node.Nodes.Add(staticNode);
                }
                // test children
                foreach (String ch in node.PlayerValue.getClassHierarchy(false))
                {
                    if (ch.Equals("flash.display::DisplayObjectContainer"))
                    {
                        double numChildren = ((java.lang.Double)node.PlayerValue.getMemberNamed(flashInterface.Session, "numChildren").getValue().getValueAsObject()).doubleValue();
                        DataNode childrenNode = new ValueNode("[children]");
                        for (int i = 0; i < numChildren; i++)
                        {
                            try
                            {
                                IASTBuilder b = new ASTBuilder(false);
                                string cmd = node.GetVariablePath() + ".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 VariableNode((Variable) obj)
                                {
                                    HideClassId = PluginMain.settingObject.HideClassIds,
                                    HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                                };
                                childNode.Text = "child_" + i;
                                childrenNode.Nodes.Add(childNode);
                            }
                            catch (Exception) { }
                        }
                        node.Nodes.Add(childrenNode);
                    }
                    else if (ch.Equals("flash.events::EventDispatcher"))
                    {
                        Variable list = node.PlayerValue.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();
                // add child items
                _tree.BeginUpdate();
                foreach (DataNode item in nodes)
                {
                    if (0 == tmpLimit--) break;
                    node.Nodes.Add(item);
                }
                if (tmpLimit == -1)
                {
                    DataNode moreNode = new ContinuedDataNode();
                    node.Nodes.Add(moreNode);
                }
                _tree.EndUpdate();
            }
        }
コード例 #12
0
 void ValueNodeTextBox_LabelChanged(object sender, LabelEventArgs e)
 {
     NodeTextBox box = sender as NodeTextBox;
     if (box.Parent.CurrentNode == null) return;
     VariableNode node = box.Parent.CurrentNode.Tag as VariableNode;
     node.IsEditing = false;
     try
     {
         var debugManager = PluginMain.debugManager;
         var flashInterface = debugManager.FlashInterface;
         IASTBuilder b = new ASTBuilder(false);
         ValueExp exp = b.parse(new java.io.StringReader(node.GetVariablePath()));
         var ctx = new ExpressionContext(flashInterface.Session, flashInterface.GetFrames()[debugManager.CurrentFrame]);
         var obj = exp.evaluate(ctx);
         node.Variable = (Variable)obj;
         if (!watchMode) PanelsHelper.watchUI.UpdateElements();
         if (ValueChanged != null) ValueChanged(this, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(TextHelper.GetString("Error.Reevaluate"), ex);
     }
 }
コード例 #13
0
 public virtual ValueExp parse(String s)
 {
     return(m_builder.parse(new StringReader(s)));
 }
コード例 #14
0
ファイル: LiveDataTip.cs プロジェクト: zpLin/flashdevelop
 private void Manager_OnMouseHover(ScintillaControl sci, Int32 position)
 {
     DebuggerManager debugManager = PluginMain.debugManager;
     FlashInterface flashInterface = debugManager.FlashInterface;
     if (!PluginBase.MainForm.EditorMenu.Visible && flashInterface != null && flashInterface.isDebuggerStarted && flashInterface.isDebuggerSuspended)
     {
         if (debugManager.CurrentLocation != null && debugManager.CurrentLocation.getFile() != null)
         {
             String localPath = debugManager.GetLocalPath(debugManager.CurrentLocation.getFile());
             if (localPath == null || localPath != PluginBase.MainForm.CurrentDocument.FileName)
             {
                 return;
             }
         }
         else return;
         Point dataTipPoint = Control.MousePosition;
         Rectangle rect = new Rectangle(m_ToolTip.Location, m_ToolTip.Size);
         if (m_ToolTip.Visible && rect.Contains(dataTipPoint))
         {
             return;
         }
         position = sci.WordEndPosition(position, true);
         String leftword = GetWordAtPosition(sci, position);
         if (leftword != String.Empty)
         {
             try
             {
                 IASTBuilder b = new ASTBuilder(false);
                 ValueExp exp = b.parse(new java.io.StringReader(leftword));
                 var ctx = new ExpressionContext(flashInterface.Session, flashInterface.GetFrames()[debugManager.CurrentFrame]);
                 var obj = exp.evaluate(ctx);
                 if (obj as Variable != null)
                 {
                     Show(dataTipPoint, (Variable)obj, leftword);
                 }
             }
             catch (Exception){}
         }
     }
 }
コード例 #15
0
ファイル: WatchUI.cs プロジェクト: JoeRobich/flashdevelop
        private DataNode GetExpressionNode(string item)
        {
            DataNode node;
            try
            {
                if (!PluginMain.debugManager.FlashInterface.isDebuggerStarted || !PluginMain.debugManager.FlashInterface.isDebuggerSuspended )
                {
                    return new ErrorNode(item, new Exception(""));
                }

                IASTBuilder builder = new ASTBuilder(false);
                ValueExp exp = builder.parse(new java.io.StringReader(item));
                var ctx = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, PluginMain.debugManager.FlashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame]);
                var obj = exp.evaluate(ctx);
                if (obj is Variable)
                {
                    node = new VariableNode((Variable)obj)
                    {
                        HideClassId = PluginMain.settingObject.HideClassIds,
                        HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                    };
                }
                else if (obj is Value)
                {
                    node = new ValueNode(item, (Value)obj)
                    {
                        HideClassId = PluginMain.settingObject.HideClassIds,
                        HideFullClasspath = PluginMain.settingObject.HideFullClasspaths
                    };
                }
                else node = new ScalarNode(item, obj.toString());
                node.Tag = item;
            }
            catch (Exception ex)
            {
                node = new ErrorNode(item, ex);
            }
            node.Text = item;
            return node;
        }
コード例 #16
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.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("getChildAt(" + i + ")", (flash.tools.debugger.concrete.DValue)obj);
                                    }
                                    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();
                }
            }
        }