コード例 #1
0
        public IPeekResultPresentation TryCreatePeekResultPresentation(IPeekResult result)
        {
            var review = result as InlineCommentPeekResult;

            return(review != null ?
                   new InlineCommentPeekResultPresentation(review.ViewModel) :
                   null);
        }
コード例 #2
0
        public IPeekResultPresentation TryCreatePeekResultPresentation(IPeekResult result)
        {
            F1PeekResult f1Result = result as F1PeekResult;

            if (f1Result != null)
            {
                return(new F1PeekResultPresentation(f1Result));
            }

            return(null);
        }
コード例 #3
0
 public void FindResults(string relationshipName, IPeekResultCollection resultCollection, System.Threading.CancellationToken cancellationToken, IFindPeekResultsCallback callback)
 {
     if (relationshipName == PredefinedPeekRelationships.Definitions.Name)
     {
         foreach (var location in _locations)
         {
             IPeekResult result = CreatePeekResult(location);
             if (result != null)
             {
                 resultCollection.Add(result);
             }
         }
     }
 }
コード例 #4
0
        private IPeekResult CreatePeekResult(LocationInfo location)
        {
            IPeekResult result = null;
            var         path   = location.FilePath;

            if (!string.IsNullOrWhiteSpace(path))
            {
                var fi          = new FileInfo(path);
                var displayInfo = new PeekResultDisplayInfo(BuildLabel(location), path, BuildTitle(location), path);
                // TODO: the location stuff doesn't work 100% correctly. This needs to be fixed
                string contentType = null;
                var    extension   = Path.GetExtension(path);
                if (extension != null)
                {
                    switch (extension.ToLower())
                    {
                    case ".4gl":
                        contentType = VSGeneroConstants.ContentType4GL;
                        break;

                    case ".inc":
                        contentType = VSGeneroConstants.ContentTypeINC;
                        break;

                    case ".per":
                        contentType = VSGeneroConstants.ContentTypePER;
                        break;
                    }
                }
                if (contentType != null)
                {
                    ITextDocument textDoc = null;
                    int           line    = location.Line - 1;
                    if (line < 0)
                    {
                        textDoc = this._factory.TextDocumentFactoryService.CreateAndLoadTextDocument(path, this._factory.ContentTypeRegistryService.GetContentType(contentType));
                        line    = textDoc.TextBuffer.CurrentSnapshot.GetLineNumberFromPosition(location.Index);
                    }
                    int character = location.Column - 1;  // start index
                    if (character < 0)
                    {
                        character = 0;
                    }
                    //EditorExtensions.EditorExtensions.GetLineAndColumnOfFile(path, location.Position, out line, out character);
                    int  endLine      = line + 10; // end line
                    int  endIndex     = 0;         // end index
                    int  positionLine = 0;         // id line
                    int  positionChar = 0;         // id index
                    bool isReadOnly   = fi.IsReadOnly;

                    // TODO: determine the stuff above.

                    result           = this._factory.PeekResultFactory.Create(displayInfo, path, line, character, endLine, endIndex, positionLine, positionChar, isReadOnly);
                    result.Disposed += (x, y) =>
                    {
                        if (textDoc != null)
                        {
                            textDoc.Dispose();
                        }
                    };
                }
            }
            else if (!string.IsNullOrWhiteSpace(location.DefinitionURL))
            {
#if DEV14_OR_LATER
                return(new UrlPeekResult(location.GetUrlString(_languageVersion)));
#endif
            }
            return(result);
        }
コード例 #5
0
 public bool TryOpen(IPeekResult otherResult) => false;
コード例 #6
0
 public bool TryOpen(IPeekResult otherResult)
 {
     // Cannot open other results
     return false;
 }
コード例 #7
0
ファイル: RotPeekResult.cs プロジェクト: ggrov/tacny
        public RotPeekResultPresentation(IPeekResult result)
        {
            var rotResult = result as RotPeekResult;

            _expandedTactic = rotResult?.ExpandedTactic ?? "Failed to Expand Tactic";
        }
コード例 #8
0
ファイル: RotPeekResult.cs プロジェクト: ggrov/tacny
        public bool TryOpen(IPeekResult otherResult)
        {
            var other = otherResult as RotPeekResult;

            return(_expandedTactic == other?.ExpandedTactic);
        }
コード例 #9
0
ファイル: RotPeekResult.cs プロジェクト: ggrov/tacny
 public IPeekResultPresentation TryCreatePeekResultPresentation(IPeekResult result)
 {
     return(new RotPeekResultPresentation(result));
 }
コード例 #10
0
 public bool TryOpen(IPeekResult otherResult)
 {
     // Cannot open other results
     return(false);
 }
コード例 #11
0
ファイル: RotPeekResult.cs プロジェクト: ggrov/tacny
 public bool TryOpen(IPeekResult otherResult)
 {
   var other = otherResult as RotPeekResult;
   return _expandedTactic==other?.ExpandedTactic;
 } 
コード例 #12
0
ファイル: RotPeekResult.cs プロジェクト: ggrov/tacny
 public RotPeekResultPresentation(IPeekResult result)
 {
   var rotResult = result as RotPeekResult;
   _expandedTactic = rotResult?.ExpandedTactic ?? "Failed to Expand Tactic";
 }
コード例 #13
0
ファイル: RotPeekResult.cs プロジェクト: ggrov/tacny
 public IPeekResultPresentation TryCreatePeekResultPresentation(IPeekResult result) {
   return new RotPeekResultPresentation(result);
 }