コード例 #1
0
        private void ContextChanged()
        {
            ITabbedDocument doc     = PluginBase.MainForm.CurrentDocument;
            bool            isValid = false;

            if (doc.IsEditable)
            {
                ScintillaNet.ScintillaControl sci = ASContext.CurSciControl;
                if (currentDoc == doc.FileName && sci != null)
                {
                    int line = sci.LineFromPosition(currentPos);
                    ASContext.SetCurrentLine(line);
                }
                else
                {
                    ASComplete.CurrentResolvedContext = null;  // force update
                }
                isValid = ASContext.Context.IsFileValid;
                if (isValid)
                {
                    ASComplete.ResolveContext(sci);
                }
            }
            else
            {
                ASComplete.ResolveContext(null);
            }

            bool enableItems = isValid && !doc.IsUntitled;

            pluginUI.OutlineTree.Enabled = ASContext.Context.CurrentModel != null;
            SetItemsEnabled(enableItems, ASContext.Context.CanBuild);
        }