private void SyntaxEditorOnViewSelectionChanged(object sender, EditorViewSelectionEventArgs e)
 {
     if (e.View == _editorView)
     {
         _selectionStack.Clear();
     }
 }
        public void NotifySelectionChanged(IEditorView view, EditorViewSelectionEventArgs e)
        {
            var shouldUpdateSession = HasSignatureHelpSession(view.SyntaxEditor);

            if (shouldUpdateSession)
            {
                StartOrUpdate(view);
            }
        }
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occurs when the view's selection is changed.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <see cref="EditorViewSelectionEventArgs"/> that contains data related to this event.</param>
        private void OnViewSelectionChanged(object sender, EditorViewSelectionEventArgs e)
        {
            if (view == null)
            {
                return;
            }

            // Update the current word
            this.UpdateHighlights();
        }
        /// <summary>
        /// Occurs when the editor view's selection is changed.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">A <see cref="EditorViewSelectionEventArgs"/> that contains the event data.</param>
        private void OnSyntaxEditorViewSelectionChanged(object sender, EditorViewSelectionEventArgs e)
        {
            // Quit if this event is not for the active view
            if (!e.View.IsActive)
            {
                return;
            }

            this.UpdateStatusBar();
        }
        /// <summary>
        /// Occurs when the selection changes.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">An <see cref="EditorViewSelectionEventArgs"/> that contains the event data.</param>
        private void OnViewSelectionChanged(object sender, EditorViewSelectionEventArgs e)
        {
            // Quit if this event is not for the active view
            if (!e.View.IsActive)
            {
                return;
            }

            // Update line, col, and character display
            this.UpdateStatusBarTextLocation(e.CaretPosition.DisplayLine, e.CaretDisplayCharacterColumn, e.CaretPosition.DisplayCharacter);
        }
        /// <summary>
        /// Occurs when the document's view selection has changed.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> that contains data related to this event.</param>
        private void OnSyntaxEditorViewSelectionChanged(object sender, EditorViewSelectionEventArgs e)
        {
            // Quit if this event is not for the active view
            if (!e.View.IsActive)
            {
                return;
            }

            // Update line, col, and character display
            linePanel.Text      = String.Format("Ln {0}", e.CaretPosition.DisplayLine);
            columnPanel.Text    = String.Format("Col {0}", e.CaretDisplayCharacterColumn);
            characterPanel.Text = String.Format("Ch {0}", e.CaretPosition.DisplayCharacter);
        }
        /// <summary>
        /// Occurs when the selection is changed in the specified <see cref="IEditorView"/>.
        /// </summary>
        /// <param name="view">The <see cref="IEditorView"/> that received the event.</param>
        /// <param name="e">The <c>EditorViewSelectionEventArgs</c> that contains the event data.</param>
        protected virtual void OnViewSelectionChanged(IEditorView view, EditorViewSelectionEventArgs e)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            // Look for an existing session
            var session = view.SyntaxEditor.IntelliPrompt.Sessions[IntelliPromptSessionTypes.ParameterInfo] as IParameterInfoSession;

            if ((session != null) && (session.IsOpen))
            {
                // Quit if for a different view
                if (view != session.View)
                {
                    return;
                }

                // Get the context
                var requestNewSession = false;
                var context           = new SimpleContextFactory().CreateContext(view.Selection.EndSnapshotOffset, true);
                if ((context != null) && (context.ArgumentListSnapshotOffset.HasValue))
                {
                    // If the current session is still valid...
                    if (context.ArgumentListSnapshotOffset.Value.Offset == session.SnapshotRange.StartOffset)
                    {
                        // If the current parameter was updated...
                        if (UpdateCurrentParameter(session, context))
                        {
                            // Refresh content
                            session.Refresh();
                        }
                        return;
                    }
                    else
                    {
                        // Flag to request a new session
                        requestNewSession = true;
                    }
                }

                // Close the session
                session.Close(true);

                // If a new session should be requested...
                if (requestNewSession)
                {
                    this.RequestSession(view);
                }
            }
        }
        /// <summary>
        /// Occurs when the <c>SyntaxEditor.ViewSelectionChanged</c> event occurs.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">An <see cref="EditorViewSelectionEventArgs"/> that contains the event data.</param>
        private void OnSyntaxEditorViewSelectionChanged(object sender, EditorViewSelectionEventArgs e)
        {
            // Quit if this event is not for the active view
            if (!e.View.IsActive)
            {
                return;
            }

            // Update line, col, and character display
            linePanel.Text      = String.Format("Ln {0}", e.CaretPosition.DisplayLine);
            columnPanel.Text    = String.Format("Col {0}", e.CaretDisplayCharacterColumn);
            characterPanel.Text = String.Format("Ch {0}", e.CaretPosition.DisplayCharacter);

            // If token info should be displayed in the statusbar...
            if (toggleTokenInfoMenuItem.IsChecked)
            {
                // Get a snapshot reader
                ITextSnapshotReader reader = e.View.CurrentSnapshot.GetReader(e.View.Selection.EndOffset);
                IToken token = reader.Token;
                if (token != null)
                {
                    IMergableToken mergableToken = token as IMergableToken;
                    if (mergableToken != null)
                    {
                        tokenPanel.Content = String.Format("{0} / {1} / {2}{3}",
                                                           mergableToken.Lexer.Key, mergableToken.LexicalState.Key,
                                                           token.Key, (e.View.Selection.EndOffset == token.StartOffset ? "*" : String.Empty));
                    }
                    else
                    {
                        tokenPanel.Content = String.Format("{0} / {1}{2}", e.View.SyntaxEditor.Document.Language.Key,
                                                           token.Key, (e.View.Selection.EndOffset == token.StartOffset ? "*" : String.Empty));
                    }
                    return;
                }
            }
            tokenPanel.Content = null;
        }
Exemple #9
0
 private void SyntaxEditorOnViewSelectionChanged(object sender, EditorViewSelectionEventArgs e)
 {
     OnCaretPositionChanged();
     OnSelectionChanged();
 }
 /// <summary>
 /// Notifies when the selection is changed in the specified <see cref="IEditorView"/>.
 /// </summary>
 /// <param name="view">The <see cref="IEditorView"/> that received the event.</param>
 /// <param name="e">The <c>EditorViewSelectionEventArgs</c> that contains the event data.</param>
 void IEditorViewSelectionChangeEventSink.NotifySelectionChanged(IEditorView view, EditorViewSelectionEventArgs e)
 {
     this.OnViewSelectionChanged(view, e);
 }
 private void OnCodeEditorViewSelectionChanged(object sender, EditorViewSelectionEventArgs e)
 {
     if (!e.View.IsActive)
         return;
     linePanel.Content = String.Format("Ln {0}", e.CaretPosition.DisplayLine);
     columnPanel.Content = String.Format("Col {0}", e.CaretDisplayCharacterColumn);
     characterPanel.Content = String.Format("Ch {0}", e.CaretPosition.DisplayCharacter);
 }
Exemple #12
0
 private void ViewOnSelectionChanged(object sender, EditorViewSelectionEventArgs e)
 {
     UpdateGlyph();
 }