public override void Initialize(IApp app) { base.Initialize(app); Compilers.ForEach(b => { if (b.Type.GetInterface(typeof(IBackgroundCompiler).Name) == null) { throw new ElideException("Compiler '{0}' doesn't implement IBackgroundCompiler interface.", b.Type); } var bc = TypeCreator.New <IBackgroundCompiler>(b.Type); var inf = (EditorInfo)app.GetService <IEditorService>().GetInfo("editors", b.EditorKey); var ins = inf.Instance as ICodeEditor; if (ins == null) { throw new ElideException("Compiler '{0}' can be only registered for the code editor.", b.Type); } var sci = ins.Control as ScintillaControl; var wrap = new BackgroundCompiler(app, sci, bc, this); CompilerInstances.Add(b.EditorKey, wrap); }); app.GetService <IDaemonService>().RegisterDaemon(this); app.GetService <IDocumentService>().DocumentAdded += (_, e) => DocumentOpened(e.Document); }
public override void Initialize(IApp app) { base.Initialize(app); Compilers.ForEach(b => { if (b.Type.GetInterface(typeof(IBackgroundCompiler).Name) == null) throw new ElideException("Compiler '{0}' doesn't implement IBackgroundCompiler interface.", b.Type); var bc = TypeCreator.New<IBackgroundCompiler>(b.Type); var inf = (EditorInfo)app.GetService<IEditorService>().GetInfo("editors", b.EditorKey); var ins = inf.Instance as ICodeEditor; if (ins == null) throw new ElideException("Compiler '{0}' can be only registered for the code editor.", b.Type); var sci = ins.Control as ScintillaControl; var wrap = new BackgroundCompiler(app, sci, bc, this); CompilerInstances.Add(b.EditorKey, wrap); }); app.GetService<IDaemonService>().RegisterDaemon(this); app.GetService<IDocumentService>().DocumentAdded += (_,e) => DocumentOpened(e.Document); }