示例#1
0
        private void XMLRefSearch_SearchReferences(Object Sender, DevExpress.CodeRush.Core.SearchEventArgs ea)
        {
            // Store Value of initial XmlAttribute
            TextDocument activeDoc = CodeRush.Documents.ActiveTextDocument;
            string StartValue = ((XmlAttribute)activeDoc.GetNodeAt(CodeRush.Caret.Line, CodeRush.Caret.Offset)).Value;

            // Iterate LanguageElements in solution
            SolutionElement activeSolution = CodeRush.Source.ActiveSolution;
            foreach (ProjectElement project in activeSolution.AllProjects)
            {
                foreach (SourceFile sourceFile in project.AllFiles)
                {
                    SourceFile activeFile = CodeRush.Source.ActiveSourceFile;
                    ElementEnumerable Enumerator = new ElementEnumerable(sourceFile, new XMLAttributeFilter(StartValue, _Attributes), true);
                    foreach (XmlAttribute CurrentAttribute in Enumerator)
                    {
                        ea.AddRange(new FileSourceRange(CurrentAttribute.FileNode, CurrentAttribute.ValueRange));
                    }
                }
            }
        }