Ejemplo n.º 1
0
        IEnumerable <SearchResult> FindAll(IProgressMonitor monitor, FileProvider provider, string pattern, string replacePattern, FilterOptions filter)
        {
            if (string.IsNullOrEmpty(pattern))
            {
                return(Enumerable.Empty <SearchResult> ());
            }
            string content;

            try {
                TextReader reader = provider.Open();
                if (reader == null)
                {
                    return(Enumerable.Empty <SearchResult> ());
                }
                content = reader.ReadToEnd();
                reader.Close();
            } catch (Exception e) {
                LoggingService.LogError("Error while reading file", e);
                return(Enumerable.Empty <SearchResult> ());
            }
            if (filter.RegexSearch)
            {
                return(RegexSearch(monitor, provider, content, replacePattern, filter));
            }
            return(Search(provider, content, pattern, replacePattern, filter));
        }
Ejemplo n.º 2
0
        IEnumerable <SearchResult> FindAll(IProgressMonitor monitor, FileProvider provider, string pattern, string replacePattern, FilterOptions filter)
        {
            if (string.IsNullOrEmpty(pattern))
            {
                return(new SearchResult[0]);
            }
            string content;

            try {
                TextReader reader = provider.Open();
                content = reader.ReadToEnd();
                reader.Close();
            } catch (Exception) {
                return(new SearchResult[0]);
            }
            if (filter.RegexSearch)
            {
                return(RegexSearch(monitor, provider, content, pattern, replacePattern, filter));
            }
            return(Search(provider, content, pattern, replacePattern, filter));
        }
Ejemplo n.º 3
0
		public void GoToDeclaration ()
		{
			if (item is CompoundType) {
				CompoundType compoundType = (CompoundType)item;
				monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true);
				using (monitor) {
					foreach (IType part in compoundType.Parts) {
						FileProvider provider = new FileProvider (part.CompilationUnit.FileName);
						Mono.TextEditor.Document doc = new Mono.TextEditor.Document ();
						System.IO.TextReader textReader = provider.Open ();
						doc.Text = textReader.ReadToEnd ();
						textReader.Close ();
						int position = doc.LocationToOffset (part.Location.Line, part.Location.Column);
						while (position + part.Name.Length < doc.Length) {
							if (doc.GetTextAt (position, part.Name.Length) == part.Name)
								break;
							position++;
						}
						monitor.ReportResult (new MonoDevelop.Ide.FindInFiles.SearchResult (provider, position, part.Name.Length));
					}
					
				}
				
				return;
			}
			IdeApp.ProjectOperations.JumpToDeclaration (item);
		}
		IEnumerable<SearchResult> FindAll (IProgressMonitor monitor, FileProvider provider, string pattern, string replacePattern, FilterOptions filter)
		{
			if (string.IsNullOrEmpty (pattern))
				return new SearchResult[0];
			string content;
			try {
				TextReader reader = provider.Open ();
				content = reader.ReadToEnd ();
				reader.Close ();
			} catch (Exception) {
				return new SearchResult[0];
			}
			if (filter.RegexSearch)
				return RegexSearch (monitor, provider, content, pattern, replacePattern, filter);
			return Search (provider, content, pattern, replacePattern, filter);
		}
Ejemplo n.º 5
0
		IEnumerable<SearchResult> FindAll (IProgressMonitor monitor, FileProvider provider, string pattern, string replacePattern, FilterOptions filter)
		{
			if (string.IsNullOrEmpty (pattern))
				return Enumerable.Empty<SearchResult> ();
			string content;
			try {
				TextReader reader = provider.Open ();
				if (reader == null)
					return Enumerable.Empty<SearchResult> ();
				content = reader.ReadToEnd ();
				reader.Close ();
			} catch (Exception e) {
				LoggingService.LogError ("Error while reading file", e);
				return Enumerable.Empty<SearchResult> ();
			}
			if (filter.RegexSearch)
				return RegexSearch (monitor, provider, content, replacePattern, filter);
			return Search (provider, content, pattern, replacePattern, filter);
		}