Exemplo n.º 1
0
 /// <summary>
 /// Initializes the plugin
 /// </summary>
 public void Initialize()
 {
     this.InitBasics();
     this.LoadSettings();
     this.AddEventHandlers();
     XMLComplete.Init();
 }
Exemplo n.º 2
0
        /// <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;
            }
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        /**
         * 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);
        }
Exemplo n.º 5
0
        /**
         * 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;
            }
        }