/// <inheritdoc /> protected override bool TryExtractResult(HtmlNode htmlNode, int currentIndex, out ISimpleSearchResult result) { result = null; try { // Get the node containing the link to the search result and extract the URI. var linkNode = htmlNode.SelectNodes(LinkNodeSelector).Single(); // Ignore irrelevant nodes (easier than a super-complicated XPath expression): if (linkNode.Attributes["data-hveid"] != null) { return(false); } // Extract the details. var uri = ExtractUrlFromLinkNode(linkNode); var title = ExtractTitleFromLinkNode(linkNode); result = new SimpleSearchResult(title, uri, currentIndex); return(true); } catch { return(false); } }
void FindDerivedClasses(object sender, EventArgs e) { MenuCommand item = (MenuCommand)sender; IClass c = (IClass)item.Tag; List <IClass> derivedClasses = RefactoringService.FindDerivedClasses(c, ParserService.AllProjectContents, false); List <SearchResult> results = new List <SearchResult>(); foreach (IClass derivedClass in derivedClasses) { if (derivedClass.CompilationUnit == null) { continue; } if (derivedClass.CompilationUnit.FileName == null) { continue; } SearchResult res = new SimpleSearchResult(derivedClass.FullyQualifiedName, new Point(derivedClass.Region.BeginColumn - 1, derivedClass.Region.BeginLine - 1)); res.ProvidedDocumentInformation = FindReferencesAndRenameHelper.GetDocumentInformation(derivedClass.CompilationUnit.FileName); results.Add(res); } SearchInFilesManager.ShowSearchResults(StringParser.Parse("${res:SharpDevelop.Refactoring.ClassesDerivingFrom}", new string[, ] { { "Name", c.Name } }), results); }
void FindOverrides(object sender, EventArgs e) { MenuCommand item = (MenuCommand)sender; IMember member = (IMember)item.Tag; List <IClass> derivedClasses = RefactoringService.FindDerivedClasses(member.DeclaringType, ParserService.AllProjectContents, false); List <SearchResult> results = new List <SearchResult>(); foreach (IClass derivedClass in derivedClasses) { if (derivedClass.CompilationUnit == null) { continue; } if (derivedClass.CompilationUnit.FileName == null) { continue; } IMember m = RefactoringService.FindSimilarMember(derivedClass, member); if (m != null && !m.Region.IsEmpty) { SearchResult res = new SimpleSearchResult(m.FullyQualifiedName, new Point(m.Region.BeginColumn - 1, m.Region.BeginLine - 1)); res.ProvidedDocumentInformation = FindReferencesAndRenameHelper.GetDocumentInformation(derivedClass.CompilationUnit.FileName); results.Add(res); } } SearchInFilesManager.ShowSearchResults(StringParser.Parse("${res:SharpDevelop.Refactoring.OverridesOf}", new string[, ] { { "Name", member.Name } }), results); }
/// <inheritdoc /> protected override bool TryExtractResult(HtmlNode htmlNode, int currentIndex, out ISimpleSearchResult result) { result = null; try { // Get the node containing the link to the search result and extract the URI. var linkNode = htmlNode.SelectNodes(LinkNodeSelector).Single(); // Extract the details. var hrefAttributeContent = WebUtility.HtmlDecode(linkNode.Attributes["href"].Value); var uri = new Uri(hrefAttributeContent); var title = WebUtility.HtmlDecode(linkNode.InnerText); result = new SimpleSearchResult(title, uri, currentIndex); return(true); } catch { return(false); } }