/// <summary> /// Handles the incoming events /// </summary> public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority) { if (debugManager == null) { return; } switch (e.Type) { case EventType.FileOpen: TextEvent evnt = (TextEvent)e; ScintillaHelper.AddSciEvent(evnt.Value); breakPointManager.SetBreakPointsToEditor(evnt.Value); break; case EventType.UIStarted: menusHelper.AddToolStripItems(); menusHelper.UpdateMenuState(this, DebuggerState.Initializing); debugManager.RestoreOldLayout(); break; case EventType.UIClosing: if (debugManager.FlashInterface.isDebuggerStarted) { debugManager.FlashInterface.Detach(); } break; case EventType.ApplySettings: menusHelper.UpdateMenuState(this); break; case EventType.FileSwitch: menusHelper.UpdateMenuState(this); break; case EventType.Command: PluginCore.DataEvent buildevnt = (PluginCore.DataEvent)e; if (buildevnt.Action == "AS3Context.StartDebugger") { if (settingObject.StartDebuggerOnTestMovie) { if (debugManager.Start(buildevnt.Data != null)) { buildevnt.Handled = true; } } return; } if (!buildevnt.Action.StartsWith("ProjectManager")) { return; } if (buildevnt.Action == ProjectManager.ProjectManagerEvents.Project) { IProject project = PluginBase.CurrentProject; if (project != null && project.EnableInteractiveDebugger) { disableDebugger = false; PanelsHelper.breakPointUI.Clear(); if (breakPointManager.Project != null && breakPointManager.Project != project) { breakPointManager.Save(); } breakPointManager.Project = project; breakPointManager.Load(); breakPointManager.SetBreakPointsToEditor(PluginBase.MainForm.Documents); } else { disableDebugger = true; if (breakPointManager.Project != null) { breakPointManager.Save(); } PanelsHelper.breakPointUI.Clear(); } } else if (disableDebugger) { return; } if (buildevnt.Action == ProjectManager.ProjectManagerCommands.HotBuild || buildevnt.Action == ProjectManager.ProjectManagerCommands.BuildProject) { if (debugManager.FlashInterface.isDebuggerStarted) { if (debugManager.FlashInterface.isDebuggerSuspended) { debugManager.Continue_Click(null, null); } debugManager.Stop_Click(null, null); } } if (buildevnt.Action == ProjectManager.ProjectManagerEvents.TestProject) { if (debugManager.FlashInterface.isDebuggerStarted) { if (debugManager.FlashInterface.isDebuggerSuspended) { debugManager.Continue_Click(null, null); e.Handled = true; return; } } } if (buildevnt.Action == ProjectManager.ProjectManagerEvents.TestProject) { menusHelper.UpdateMenuState(this, DebuggerState.Initializing); } break; } }
/// <summary> /// Handles the incoming events /// </summary> public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority) { if (debugManager == null) { return; } switch (e.Type) { case EventType.FileOpen: TextEvent evnt = (TextEvent)e; ScintillaHelper.AddSciEvent(evnt.Value); breakPointManager.SetBreakPointsToEditor(evnt.Value); break; case EventType.UIStarted: menusHelper.AddToolStripItems(); menusHelper.UpdateMenuState(this, DebuggerState.Initializing); break; case EventType.UIClosing: if (debugManager.FlashInterface.isDebuggerStarted) { debugManager.FlashInterface.Detach(); } break; case EventType.ApplySettings: menusHelper.UpdateMenuState(this); break; case EventType.ProcessEnd: TextEvent textevnt = (TextEvent)e; if (buildCmpFlg && textevnt.Value != "Done(0)") { buildCmpFlg = false; menusHelper.UpdateMenuState(this, DebuggerState.Initializing); } break; case EventType.Command: PluginCore.DataEvent buildevnt = (PluginCore.DataEvent)e; if (buildevnt.Action == "AS3Context.StartDebugger") { if (settingObject.StartDebuggerOnTestMovie) { if (debugManager.Start(false)) { buildevnt.Handled = true; } } return; } if (!buildevnt.Action.StartsWith("ProjectManager")) { return; } if (buildevnt.Action == ProjectManager.ProjectManagerEvents.Project) { IProject project = PluginBase.CurrentProject; if (project != null && project is AS3Project) { disableDebugger = false; PanelsHelper.breakPointUI.Clear(); if (breakPointManager.Project != null && breakPointManager.Project != project) { breakPointManager.Save(); } breakPointManager.Project = project; breakPointManager.Load(); breakPointManager.SetBreakPointsToEditor(PluginBase.MainForm.Documents); } else { disableDebugger = true; if (breakPointManager.Project != null) { breakPointManager.Save(); } PanelsHelper.breakPointUI.Clear(); } } else if (disableDebugger) { return; } if (debugBuildStart && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildFailed) { debugBuildStart = false; buildCmpFlg = false; menusHelper.UpdateMenuState(this, DebuggerState.Initializing); } else if (buildevnt.Action == ProjectManager.ProjectManagerEvents.TestProject) { if (debugManager.FlashInterface.isDebuggerStarted) { if (debugManager.FlashInterface.isDebuggerSuspended) { debugManager.Continue_Click(null, null); } e.Handled = true; return; } debugBuildStart = false; buildCmpFlg = false; menusHelper.UpdateMenuState(this, DebuggerState.Initializing); } else if (debugBuildStart && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildProject && buildevnt.Data.ToString() == "Debug") { buildCmpFlg = true; } else if (buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildFailed) { menusHelper.OnBuildFailed(); debugBuildStart = false; buildCmpFlg = false; } else if (buildCmpFlg && buildevnt.Action == ProjectManager.ProjectManagerEvents.BuildComplete) { if (buildCmpFlg) { debugManager.Start(debugManager.currentProject.OutputPathAbsolute); } else { menusHelper.OnBuildComplete(); } debugBuildStart = false; buildCmpFlg = false; menusHelper.UpdateMenuState(this, DebuggerState.Stopped); } break; } }