コード例 #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
ファイル: EditFilter.cs プロジェクト: tbscer/nodejstools
        /// <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
ファイル: EditFilter.cs プロジェクト: sarvex/nodejstools
 public override void GotoSource(VSOBJGOTOSRCTYPE SrcType)
 {
     _locationInfo.GotoSource();
 }
コード例 #6
0
ファイル: EditFilter.cs プロジェクト: krus/PTVS
 public override void GotoSource(VSOBJGOTOSRCTYPE SrcType) {
     _locationInfo.GotoSource(_serviceProvider);
 }