コード例 #1
0
        public override void Destroy()
        {
            if (declarationviewwindow != null)
            {
                declarationviewwindow.Destroy();
                declarationviewwindow = null;
            }

            if (mutableList != null)
            {
                mutableList.Changing -= OnCompletionDataChanging;
                mutableList.Changed  -= OnCompletionDataChanged;
                mutableList           = null;
            }

            if (completionDataList != null)
            {
                if (completionDataList is IDisposable)
                {
                    ((IDisposable)completionDataList).Dispose();
                }
                completionDataList = null;
            }

            if (closedDelegate != null)
            {
                closedDelegate();
                closedDelegate = null;
            }
            base.Destroy();
        }
コード例 #2
0
        protected override void OnDestroyed()
        {
            if (declarationviewwindow != null)
            {
                declarationviewwindow.Destroy();
                declarationviewwindow = null;
            }

            if (mutableList != null)
            {
                mutableList.Changing -= OnCompletionDataChanging;
                mutableList.Changed  -= OnCompletionDataChanged;
                mutableList           = null;
            }

            if (completionDataList != null)
            {
                if (completionDataList is IDisposable)
                {
                    ((IDisposable)completionDataList).Dispose();
                }
                CloseCompletionList();
                completionDataList = null;
            }

            HideDeclarationView();

            if (declarationviewwindow != null)
            {
                declarationviewwindow.Destroy();
                declarationviewwindow = null;
            }
            ReleaseObjects();
            base.OnDestroyed();
        }
コード例 #3
0
        protected override void OnDestroyed()
        {
            if (declarationviewwindow != null)
            {
                declarationviewwindow.Destroy();
                declarationviewwindow = null;
            }

            if (mutableList != null)
            {
                mutableList.Changing -= OnCompletionDataChanging;
                mutableList.Changed  -= OnCompletionDataChanged;
                mutableList           = null;
            }

            if (completionDataList != null)
            {
                if (completionDataList is IDisposable)
                {
                    ((IDisposable)completionDataList).Dispose();
                }
                completionDataList.OnCompletionListClosed(EventArgs.Empty);
                completionDataList = null;
            }

            if (closedDelegate != null)
            {
                closedDelegate();
                closedDelegate = null;
            }

            HideDeclarationView();

            if (declarationviewwindow != null)
            {
                declarationviewwindow.Destroy();
                declarationviewwindow = null;
            }
            base.OnDestroyed();
        }
コード例 #4
0
        internal bool ShowListWindow(char firstChar, ICompletionDataList list, ICompletionWidget completionWidget, CodeCompletionContext completionContext, System.Action closedDelegate)
        {
            if (mutableList != null)
            {
                mutableList.Changing -= OnCompletionDataChanging;
                mutableList.Changed  -= OnCompletionDataChanged;
                HideFooter();
            }
            //initialWordLength = 0;
            this.completionDataList             = list;
            this.CompleteWithSpaceOrPunctuation = true;            //MonoDevelop.Core.PropertyService.Get ("CompleteWithSpaceOrPunctuation", true);

            this.CodeCompletionContext = completionContext;

            this.closedDelegate          = closedDelegate;
            mutableList                  = completionDataList as IMutableCompletionDataList;
            List.PreviewCompletionString = completionDataList.CompletionSelectionMode == CompletionSelectionMode.OwnTextField;

            if (mutableList != null)
            {
                mutableList.Changing += OnCompletionDataChanging;
                mutableList.Changed  += OnCompletionDataChanged;

                if (mutableList.IsChanging)
                {
                    OnCompletionDataChanging(null, null);
                }
            }

            this.CompletionWidget = completionWidget;

            if (FillList())
            {
// not neccessarry, because list window is not reused anymore:
//				Reset (true);
                this.AutoSelect             = list.AutoSelect;
                this.AutoCompleteEmptyMatch = list.AutoCompleteEmptyMatch;
                // makes control-space in midle of words to work
                string text = completionWidget.GetCompletionText(completionContext, false);
                DefaultCompletionString = completionDataList.DefaultCompletionString ?? "";
                if (text.Length == 0)
                {
                    UpdateWordSelection();
                    initialWordLength = 0;                    //completionWidget.SelectedLength;
                    ResetSizes();
                    ShowAll();
                    UpdateWordSelection();

                    //if there is only one matching result we take it by default
                    if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging)
                    {
                        CompleteWord();
                        CompletionWindowManager.HideWindow();
                    }
                    return(true);
                }

                initialWordLength = text.Length /*+ completionWidget.SelectedLength*/;
                PartialWord       = text;
                UpdateWordSelection();

                //if there is only one matching result we take it by default
                if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging)
                {
                    CompleteWord();
                    CompletionWindowManager.HideWindow();
                }
                else
                {
                    ResetSizes();
                    ShowAll();
                }
                return(true);
            }
            CompletionWindowManager.HideWindow();

            return(false);
        }
コード例 #5
0
        internal bool ShowListWindow(ICompletionDataList list, CodeCompletionContext completionContext)
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }

            CodeCompletionContext = completionContext;
            CompletionDataList    = list;
            ResetState();

            mutableList             = completionDataList as IMutableCompletionDataList;
            PreviewCompletionString = completionDataList.CompletionSelectionMode == CompletionSelectionMode.OwnTextField;

            if (mutableList != null)
            {
                mutableList.Changing += OnCompletionDataChanging;
                mutableList.Changed  += OnCompletionDataChanged;

                if (mutableList.IsChanging)
                {
                    OnCompletionDataChanging(null, null);
                }
            }

            if (FillList())
            {
                AutoSelect                         = list.AutoSelect;
                AutoCompleteEmptyMatch             = list.AutoCompleteEmptyMatch;
                AutoCompleteEmptyMatchOnCurlyBrace = list.AutoCompleteEmptyMatchOnCurlyBrace;
                CloseOnSquareBrackets              = list.CloseOnSquareBrackets;
                // makes control-space in midle of words to work
                string text = CompletionWidget.GetCompletionText(CodeCompletionContext);
                DefaultCompletionString = completionDataList.DefaultCompletionString ?? "";
                if (text.Length == 0)
                {
                    initialWordLength = 0;
                    //completionWidget.SelectedLength;
                    StartOffset = completionContext.TriggerOffset;
                    UpdateWordSelection();
                    ResetSizes();
                    ShowAll();
                    UpdateWordSelection();
                    UpdateDeclarationView();
                    //if there is only one matching result we take it by default
                    if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging)
                    {
                        CompleteWord();
                        CompletionWindowManager.HideWindow();
                        return(false);
                    }
                    return(true);
                }

                initialWordLength   = CompletionWidget.SelectedLength > 0 ? 0 : text.Length;
                StartOffset         = CompletionWidget.CaretOffset - initialWordLength;
                HideWhenWordDeleted = initialWordLength != 0;
                ResetSizes();
                UpdateWordSelection();
                //if there is only one matching result we take it by default
                if (completionDataList.AutoCompleteUniqueMatch && IsUniqueMatch && !IsChanging)
                {
                    CompleteWord();
                    CompletionWindowManager.HideWindow();
                    return(false);
                }
                ShowAll();
                UpdateDeclarationView();
                return(true);
            }
            CompletionWindowManager.HideWindow();
            return(false);
        }