/// <summary> /// Handles the incoming events /// </summary> public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority) { ITabbedDocument document = PluginBase.MainForm.CurrentDocument; if (document == null || !document.IsEditable) return; switch (e.Type) { case EventType.Keys: { Keys keys = (e as KeyEvent).Value; if (this.IsSupported(document) && keys == (Keys.Control | Keys.Space)) { if (completion != null) { completion.OnComplete(document.SciControl, document.SciControl.CurrentPos); e.Handled = true; } } break; } case EventType.FileSwitch: case EventType.SyntaxChange: case EventType.ApplySettings: { if (document.IsEditable && this.IsSupported(document)) { string ext = Path.GetExtension(document.FileName).ToLower(); features = enabledLanguages.ContainsKey(ext) ? enabledLanguages[ext] : null; if (completion == null) completion = new Completion(config, settingObject); completion.OnFileChanged(features); if (features != null && features.Syntax != null) { ScintillaControl sci = document.SciControl; sci.SetProperty(features.Syntax, features != null ? "1" : "0"); sci.Colourise(0, -1); } } break; } case EventType.Completion: { if (features != null) e.Handled = true; return; } case EventType.FileSave: { if (document != null && document.IsEditable && this.IsSupported(document)) { updateFile = document.FileName; updateFeatures = features; updater.Start(); } break; } } }
/// <summary> /// Handles the incoming events /// </summary> public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority) { ITabbedDocument document = PluginBase.MainForm.CurrentDocument; if (document == null || !document.IsEditable) { return; } switch (e.Type) { case EventType.Keys: { Keys keys = (e as KeyEvent).Value; if (this.IsSupported(document) && keys == (Keys.Control | Keys.Space)) { if (completion != null) { completion.OnComplete(document.SciControl, document.SciControl.CurrentPos); e.Handled = true; } } break; } case EventType.FileSwitch: case EventType.SyntaxChange: case EventType.ApplySettings: { if (this.IsSupported(document)) { string ext = Path.GetExtension(document.FileName).ToLower(); features = enabledLanguages.ContainsKey(ext) ? enabledLanguages[ext] : null; if (completion == null) { completion = new Completion(config, settingObject); } completion.OnFileChanged(features); if (features != null && features.Syntax != null) { ScintillaControl sci = document.SciControl; sci.SetProperty(features.Syntax, "1"); sci.Colourise(0, -1); } } break; } case EventType.Completion: { if (features != null) { e.Handled = true; } return; } case EventType.FileSave: { if (this.IsSupported(document)) { updateFile = document.FileName; updateFeatures = features; updater.Start(); } break; } } }