Пример #1
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){}
				}
			}
		}
Пример #2
0
        public Boolean ShouldBreak(SourceFile file, int line, Frame frame)
        {
            String localPath = PluginMain.debugManager.GetLocalPath(file);
            if (localPath == null)
            {
                return false;
            }
            if (m_TemporaryBreakPointInfo != null)
            {
                if (m_TemporaryBreakPointInfo.FileFullPath == localPath && m_TemporaryBreakPointInfo.Line == (line - 1))
                {
                    m_TemporaryBreakPointInfo.IsDeleted = true;
                    List<BreakPointInfo> bpList = new List<BreakPointInfo>();
                    bpList.Add(m_TemporaryBreakPointInfo);
                    PluginMain.debugManager.FlashInterface.UpdateBreakpoints(bpList);
                    m_TemporaryBreakPointInfo = null;
                    return true;
                }
            }
            int index = GetBreakPointIndex(localPath, line - 1);
            if (index >= 0)
            {
                BreakPointInfo bpInfo = m_BreakPointList[index];
                if (bpInfo.ParsedExpression != null)
                {
                    try
                    {
                        if (frame == null)
                        {
                            // take currently active worker and frame
                            frame = PluginMain.debugManager.FlashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame];
                        }
                        var ctx = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, frame);
                        var val = bpInfo.ParsedExpression.evaluate(ctx);
                        if (val is java.lang.Boolean)
                        {
                            return ((java.lang.Boolean)val).booleanValue();
                        }
                        if (val is Value)
                        {
                            return ECMA.toBoolean(((Value)val));
                        }
                        if (val is Variable)
                        {
                            return ECMA.toBoolean(((Variable)val).getValue());
                        }
                        throw new NotImplementedException(val.toString());
                    }
                    catch (/*Expression*/Exception e)
                    {
                        TraceManager.AddAsync("[Problem in breakpoint: "+e.ToString()+"]", 4);
                        ErrorManager.ShowError(e);
                        return true;
                    }
                }
                else return true;
            }

            return true;
        }
Пример #3
0
		// create a new context object by combinging the current one and o 
		public virtual Context createContext(Object o)
		{
			ExpressionContext c = new ExpressionContext(m_session);
			c.Context = o;
			c.createPseudoVariables(m_createIfMissing);
			c.m_namedPath.AddRange(m_namedPath);
			return c;
		}
Пример #4
0
		public Boolean ShouldBreak(SourceFile file, int line)
		{
			String localPath = PluginMain.debugManager.GetLocalPath(file);
			if (localPath == null)
			{
				return false;
			}
			if (m_TemporaryBreakPointInfo != null)
			{
				if (m_TemporaryBreakPointInfo.FileFullPath == localPath && m_TemporaryBreakPointInfo.Line == (line - 1))
				{
					m_TemporaryBreakPointInfo.IsDeleted = true;
					List<BreakPointInfo> bpList = new List<BreakPointInfo>();
					bpList.Add(m_TemporaryBreakPointInfo);
					PluginMain.debugManager.FlashInterface.UpdateBreakpoints(bpList);
					m_TemporaryBreakPointInfo = null;
					return true;
				}
			}
			int index = GetBreakPointIndex(localPath, line - 1);
			if (index >= 0)
			{
				BreakPointInfo bpInfo = m_BreakPointList[index];
				if (bpInfo.ParsedExpression != null)
				{
					ExpressionContext context = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session);
					try
					{
						object val = bpInfo.ParsedExpression.evaluate(context);
						if (val is Boolean)
						{
							return (Boolean)val;
						}
						else if (val is Int32)
						{
							return (Int32)val != 0;
						}
						else if (val is Variable)
						{
							return ((Variable)val).getValue().ValueAsObject != null;
						}
					}
					catch (ExpressionException e)
					{
                        ErrorManager.ShowError(e);
						return true;
					}
				}
				else return true;
			}

			return true;
		}