Esempio n. 1
0
        /// <summary>
        /// Update the code assist UI status. Determines if code assist should
        /// be made available to the current document and calls the DocumentActivated
        /// method of the code assist provider.
        /// </summary>
        public void UpdateCodeAssistStatus()
        {
            _codeAssist.Enabled = false;

            QuickSharp.Core.Document document =
                _mainForm.ActiveDocument;

            if (document == null ||
                !(document is ScintillaEditForm))
            {
                return;
            }

            DocumentType documentType =
                new DocumentType(document.FileName);

            if (_codeAssistManager.CodeAssistAvailable(documentType))
            {
                _codeAssist.Enabled = true;
                ICodeAssistProvider provider =
                    _codeAssistManager.GetProvider(documentType);

                if (provider != null)
                {
                    provider.DocumentActivated(document as ScintillaEditForm);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Determine if code assist is available for a document type.
        /// </summary>
        /// <param name="documentType">The document type.</param>
        /// <returns>True if code assist is available.</returns>
        public bool CodeAssistAvailable(DocumentType documentType)
        {
            if (!_codeAssistProviders.ContainsKey(documentType.ToString()))
            {
                return(false);
            }

            ICodeAssistProvider provider =
                _codeAssistProviders[documentType.ToString()];

            return(provider.IsAvailable);
        }
Esempio n. 3
0
        /// <summary>
        /// Get the list of lookup items for the current document.
        /// </summary>
        /// <param name="document">The current document.</param>
        /// <returns>A list of lookup items.</returns>
        public LookupList GetLookupList(ScintillaEditForm document)
        {
            if (document == null)
            {
                return(null);
            }

            DocumentType documentType = new DocumentType(document.FileName);

            if (documentType == null ||
                String.IsNullOrEmpty(documentType.ToString()))
            {
                return(null);
            }

            ICodeAssistProvider provider = GetProvider(documentType);

            if (provider == null)
            {
                return(null);
            }

            return(provider.GetLookupList(document));
        }
Esempio n. 4
0
 /// <summary>
 /// Register a code assist provider.
 /// </summary>
 /// <param name="provider">A provider instance.</param>
 public void RegisterProvider(ICodeAssistProvider provider)
 {
     _codeAssistProviders[provider.DocumentType.ToString()] = provider;
 }