예제 #1
0
        private bool TextAreaKeyEventHandler(char key)
        {
            if (_codeCompletionWindow != null)
            {
                // If completion window is open and wants to handle the key, don't let the text area
                // handle it
                if (_codeCompletionWindow.ProcessKeyEvent(key))
                {
                    return(true);
                }
            }

            if (key == '.')
            {
                ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(_iForm);

                _codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(
                    _iForm,                         // The parent window for the completion window
                    _editor,                        // The text editor to show the window for
                    IntellisenseForm.DummyFileName, // Filename - will be passed back to the provider
                    completionDataProvider,         // Provider to get the list of possible completions
                    key                             // Key pressed - will be passed to the provider
                    );
                if (_codeCompletionWindow != null)
                {
                    // ShowCompletionWindow can return null when the provider returns an empty list
                    _codeCompletionWindow.Closed += CloseCodeCompletionWindow;
                }
            }
            else if (key == '(')
            {
                if (_insightWindow != null && (!_insightWindow.IsDisposed))
                {
                    // provider returned an empty list, so the window never been opened
                    CloseInsightWindow(this, EventArgs.Empty);
                }

                IInsightDataProvider insightdataprovider = new MethodInsightDataProvider(_iForm);
                _insightWindow         = new InsightWindow(_iForm, _editor);
                _insightWindow.Closed += CloseInsightWindow;
                _insightWindow.AddInsightDataProvider(insightdataprovider, IntellisenseForm.DummyFileName);
                _insightWindow.ShowInsightWindow();
            }

            return(false);
        }
		/// <summary>
		/// Return true to handle the keypress, return false to let the text area handle the keypress
		/// </summary>
		bool TextAreaKeyEventHandler(char key)
		{
			if (codeCompletionWindow != null) {
				// If completion window is open and wants to handle the key, don't let the text area
				// handle it
				if (codeCompletionWindow.ProcessKeyEvent(key))
					return true;
			}

			if (key == '.') {
				ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(iForm);
				
				codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(
					iForm,					// The parent window for the completion window
					editor, 					// The text editor to show the window for
					IntellisenseForm.DummyFileName,		// Filename - will be passed back to the provider
					completionDataProvider,		// Provider to get the list of possible completions
					key							// Key pressed - will be passed to the provider
				);
				if (codeCompletionWindow != null) {
					// ShowCompletionWindow can return null when the provider returns an empty list
					codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow);
				}
			} else if ((key == '(')) {
                if (insightWindow != null && (!insightWindow.IsDisposed))
                {
                    // provider returned an empty list, so the window never been opened
                    CloseInsightWindow(this, EventArgs.Empty);
                }
                IInsightDataProvider insightdataprovider = new MethodInsightDataProvider(iForm);
                insightWindow = new InsightWindow(iForm, editor);
                insightWindow.Closed += new EventHandler(CloseInsightWindow);
                insightWindow.AddInsightDataProvider(insightdataprovider, IntellisenseForm.DummyFileName);
                insightWindow.ShowInsightWindow();
            }
			return false;
		}