public static void RemoveContextListener(ContextListener listener) { ContextFactory.GetGlobal().AddListener(listener); }
/// <summary> /// Creates a new ViewContext /// </summary> /// <param name="ctxSettings">Settings for the context</param> /// <param name="listener">Listener for events for the context</param> /// <param name="fileHandler">File handler for the context</param> /// <returns>the newly created ViewContext</returns> public static ViewContext CreateViewContext(ContextSettings ctxSettings, ContextListener listener, FileHandler fileHandler) { var context = Instance.ContextFactory.CreateViewContext( ctxSettings, listener, fileHandler); Instance.m_Contexts.Add(context); return context; }
public static void AddContextListener(ContextListener listener) { // Special workaround for the debugger string DBG = "org.mozilla.javascript.tools.debugger.Main"; if (DBG.Equals(listener.GetType().FullName)) { Type cl = listener.GetType(); Type factoryClass = Kit.ClassOrNull("org.mozilla.javascript.ContextFactory"); Type[] sig = new Type[] { factoryClass }; object[] args = new object[] { ContextFactory.GetGlobal() }; try { MethodInfo m = cl.GetMethod("attachTo", sig); m.Invoke(listener, args); } catch (Exception ex) { Exception rex = new Exception(); Kit.InitCause(rex, ex); throw rex; } return; } ContextFactory.GetGlobal().AddListener(listener); }