Esempio n. 1
0
 public override void PreprocessMouseLeftButtonDown(MouseButtonEventArgs e)
 {
     if ((e.ClickCount == 1 && ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)) ||
         e.ClickCount == 2)
     {
         var url = GetHotUrl(_wpfTextView, e);
         if (!string.IsNullOrEmpty(url))
         {
             _shell.Services.Process().Start(url);
             return;
         }
         if (!_wpfTextView.Caret.InVirtualSpace)
         {
             // If this is a Ctrl+Click or double-click then post the select word command.
             var point = _wpfTextView.MapDownToR(_wpfTextView.Caret.Position.BufferPosition);
             if (point.HasValue)
             {
                 var command = new SelectWordCommand(_wpfTextView, point.Value.Snapshot.TextBuffer);
                 var o       = new object();
                 var result  = command.Invoke();
                 if (result.Result == CommandResult.Executed.Result)
                 {
                     e.Handled = true;
                     return;
                 }
             }
         }
     }
     base.PreprocessMouseLeftButtonDown(e);
 }
Esempio n. 2
0
 public override void PreprocessMouseLeftButtonDown(MouseButtonEventArgs e)
 {
     if ((e.ClickCount == 1 && ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)) ||
         e.ClickCount == 2)
     {
         // Check if token is URL. If it is, don't try and select and instead
         // let core editor deal with it since it may open URL on Ctrl+Click.
         if (!IsOverHotUrl(_wpfTextView, e))
         {
             // If this is a Ctrl+Click or double-click then post the select word command.
             var command = new SelectWordCommand(_wpfTextView, _wpfTextView.TextBuffer);
             var o       = new object();
             var result  = command.Invoke(typeof(VSConstants.VSStd2KCmdID).GUID, (int)VSConstants.VSStd2KCmdID.SELECTCURRENTWORD, null, ref o);
             if (result.Result == CommandResult.Executed.Result)
             {
                 e.Handled = true;
                 return;
             }
         }
     }
     base.PreprocessMouseLeftButtonDown(e);
 }
Esempio n. 3
0
 public override void PreprocessMouseLeftButtonDown(MouseButtonEventArgs e)
 {
     if ((e.ClickCount == 1 && ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)) ||
         e.ClickCount == 2)
     {
         var url = GetHotUrl(_wpfTextView, e);
         if (!string.IsNullOrEmpty(url))
         {
             _shell.Services.GetService <IProcessServices>().Start(url);
             return;
         }
         // If this is a Ctrl+Click or double-click then post the select word command.
         var command = new SelectWordCommand(_wpfTextView, _wpfTextView.TextBuffer);
         var o       = new object();
         var result  = command.Invoke(typeof(VSConstants.VSStd2KCmdID).GUID, (int)VSConstants.VSStd2KCmdID.SELECTCURRENTWORD, null, ref o);
         if (result.Result == CommandResult.Executed.Result)
         {
             e.Handled = true;
             return;
         }
     }
     base.PreprocessMouseLeftButtonDown(e);
 }