예제 #1
0
파일: EditFilter.cs 프로젝트: krus/PTVS
        /// <summary>
        /// Moves the caret to the specified location, staying in the current text view 
        /// if possible.
        /// 
        /// https://pytools.codeplex.com/workitem/1649
        /// </summary>
        private void GotoLocation(LocationInfo location) {
            Debug.Assert(location != null);
            Debug.Assert(location.Line > 0);
            Debug.Assert(location.Column > 0);

            if (CommonUtils.IsSamePath(location.FilePath, _textView.GetFilePath())) {
                var viewAdapter = GetViewAdapter();
                viewAdapter.SetCaretPos(location.Line - 1, location.Column - 1);
                viewAdapter.CenterLines(location.Line - 1, 1);
            } else {
                location.GotoSource(_serviceProvider);
            }
        }
예제 #2
0
        /// <summary>
        /// Moves the caret to the specified location, staying in the current text view 
        /// if possible.
        /// 
        /// https://pytools.codeplex.com/workitem/1649
        /// </summary>
        private void GotoLocation(LocationInfo location) {
            Debug.Assert(location != null);
            Debug.Assert(location.Line > 0);
            Debug.Assert(location.Column > 0);

            if (CommonUtils.IsSamePath(location.FilePath, _textView.GetFilePath())) {
                var adapterFactory = _serviceProvider.GetComponentModel().GetService<IVsEditorAdaptersFactoryService>();
                var viewAdapter = adapterFactory.GetViewAdapter(_textView);
                viewAdapter.SetCaretPos(location.Line - 1, location.Column - 1);
                viewAdapter.CenterLines(location.Line - 1, 1);
            } else {
                location.GotoSource();
            }
        }
예제 #3
0
 /// <summary>
 /// Moves the caret to the specified location, staying in the current text view
 /// if possible.
 ///
 /// https://pytools.codeplex.com/workitem/1649
 /// </summary>
 private void GotoLocation(LocationInfo location)
 {
     if (CommonUtils.IsSamePath(location.FilePath, _textView.GetFilePath()))
     {
         var adapterFactory = VSGeneroPackage.ComponentModel.GetService <IVsEditorAdaptersFactoryService>();
         var viewAdapter    = adapterFactory.GetViewAdapter(_textView);
         viewAdapter.SetCaretPos(location.Line - 1, location.Column - 1);
         viewAdapter.CenterLines(location.Line - 1, 1);
     }
     else
     {
         location.GotoSource();
     }
 }
예제 #4
0
 /// <summary>
 /// Moves the caret to the specified location, staying in the current text view
 /// if possible.
 ///
 /// https://pytools.codeplex.com/workitem/1649
 /// </summary>
 private void GotoLocation(LocationInfo location)
 {
     if (CommonUtils.IsSamePath(location.FilePath, _textView.GetFilePath()))
     {
         var adapterFactory = VSGeneroPackage.ComponentModel.GetService <IVsEditorAdaptersFactoryService>();
         var viewAdapter    = adapterFactory.GetViewAdapter(_textView);
         var lineNum        = location.Line - 1;
         if (lineNum <= 0)
         {
             lineNum = _textView.TextBuffer.CurrentSnapshot.GetLineNumberFromPosition(location.Index);
         }
         var character = location.Column - 1;  // start index
         if (character < 0)
         {
             character = 0;
         }
         viewAdapter.SetCaretPos(lineNum, character);
         viewAdapter.CenterLines(lineNum, 1);
     }
     else
     {
         location.GotoSource(_serviceProvider, _textView.GetLanguageVersion(_programFileProvider));
     }
 }
예제 #5
0
 public override void GotoSource(VSOBJGOTOSRCTYPE SrcType)
 {
     _locationInfo.GotoSource();
 }
예제 #6
0
파일: EditFilter.cs 프로젝트: krus/PTVS
 public override void GotoSource(VSOBJGOTOSRCTYPE SrcType) {
     _locationInfo.GotoSource(_serviceProvider);
 }