/// <summary> /// Initializes the plugin /// </summary> public void Initialize() { this.InitBasics(); this.LoadSettings(); this.AddEventHandlers(); XMLComplete.Init(); }
/// <summary> /// Handles the incoming events /// </summary> public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority) { switch (e.Type) { case EventType.FileSwitch: case EventType.SyntaxChange: XMLComplete.CurrentFile = PluginBase.MainForm.CurrentDocument.FileName; break; case EventType.Completion: if (XMLComplete.Active) { e.Handled = true; } return; case EventType.Keys: e.Handled = XMLComplete.OnShortCut(((KeyEvent)e).Value); break; case EventType.Command: DataEvent de = (DataEvent)e; if (XMLComplete.Active && !settingObject.DisableZenCoding && de.Action == "SnippetManager.Expand") { Hashtable data = (Hashtable)de.Data; if (ZenCoding.expandSnippet(data)) { de.Handled = true; } } break; } }
/// <summary> /// Locates the parent tag of the tag provided /// </summary> public static XMLContextTag GetParentTag(ScintillaNet.ScintillaControl sci, XMLContextTag tag) { int pos = tag.Position + 1; if (pos <= 0) { pos = sci.CurrentPos; } XMLContextTag parent; Stack <string> stack = new Stack <string>(); do { parent = XMLComplete.GetXMLContextTag(sci, pos); pos = parent.Position; if (parent.Name != null && parent.Tag != null) { if (parent.Closing) { stack.Push(parent.Name); } else if (!parent.Closed && (stack.Count == 0 || stack.Pop() != parent.Name)) { break; } } }while (pos > 0); return(parent); }
/** * Initializes the plugin */ public void Initialize() { mainForm = this.pluginHost.MainForm; pluginPanel = null; // listen to keys XMLComplete.Init(mainForm); UITools.OnCharAdded += new UITools.CharAddedHandler(XMLComplete.OnChar); }
/** * Handles the incoming events * Receives only events in EventMask */ public void HandleEvent(object sender, NotifyEvent e) { switch (e.Type) { case EventType.FileSwitch: case EventType.LanguageChange: XMLComplete.CurrentFile = mainForm.CurFile; break; case EventType.Shortcut: e.Handled = XMLComplete.OnShortCut(((KeyEvent)e).Value); break; case EventType.SettingUpdate: XMLComplete.UpdateSettings(); break; } }