~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchCollector.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
                        }
65
65
                }
66
66
 
67
 
                public static IEnumerable<Project> CollectProjects (Solution solution, IEnumerable<IEntity> entities)
 
67
                public static IEnumerable<Project> CollectProjects (Solution solution, IEnumerable<object> entities)
68
68
                {
69
69
                        return new SearchCollector (solution, null, entities).CollectProjects ();
70
70
                }
71
71
 
72
 
                public static IEnumerable<FileList> CollectFiles (Project project, IEnumerable<IEntity> entities)
 
72
                public static IEnumerable<FileList> CollectFiles (Project project, IEnumerable<object> entities)
73
73
                {
74
74
                        return new SearchCollector (project.ParentSolution, project, entities).CollectFiles ();
75
75
                }
76
76
 
77
 
                public static IEnumerable<FileList> CollectFiles (Solution solution, IEnumerable<IEntity> entities)
 
77
                public static IEnumerable<FileList> CollectFiles (Solution solution, IEnumerable<object> entities)
78
78
                {
79
79
                        return new SearchCollector (solution, null, entities).CollectFiles ();
80
80
                }
104
104
                Project searchProject;
105
105
                bool searchProjectAdded; // if the searchProject is added, we can stop collecting
106
106
                Solution solution;
107
 
                IEnumerable<IEntity> entities;
 
107
                IEnumerable<object> entities;
108
108
                bool projectOnly; // only collect projects
109
109
                
110
110
                IDictionary<Project, ISet<string>> collectedFiles = new Dictionary<Project, ISet<string>> ();
114
114
                ISet<Project> searchedProjects = new HashSet<Project> ();
115
115
 
116
116
                /// <param name="searchProject">the project to search. use to null to search the whole solution</param>
117
 
                SearchCollector (Solution solution, Project searchProject, IEnumerable<IEntity> entities)
 
117
                SearchCollector (Solution solution, Project searchProject, IEnumerable<object> entities)
118
118
                {
119
119
                        this.solution = solution;
120
120
                        this.searchProject = searchProject;
124
124
                IEnumerable<Project> CollectProjects ()
125
125
                {
126
126
                        projectOnly = true;
127
 
                        foreach (var entity in entities) {
 
127
                        foreach (var o in entities) {
 
128
                                var entity = o as IEntity;
 
129
                                if (entity == null)
 
130
                                        continue;
128
131
                                Collect (TypeSystemService.GetProject (entity), entity);
129
132
                        }
130
133
                        return collectedProjects;
133
136
                IEnumerable<FileList> CollectFiles ()
134
137
                {
135
138
                        projectOnly = false;
136
 
                        foreach (var entity in entities) {
 
139
                        foreach (var o in entities) {
 
140
                                if (o is INamespace) {
 
141
                                        Collect (null, null);
 
142
                                        continue;
 
143
                                }
 
144
 
 
145
 
 
146
                                var entity = o as IEntity;
 
147
                                if (entity == null)
 
148
                                        continue;
137
149
                                Collect (TypeSystemService.GetProject(entity), entity);
138
150
 
139
151
                                if (searchProjectAdded) break;
187
199
                        }
188
200
                        
189
201
                        if (sourceProject == null) {
 
202
                                if (entity == null) {
 
203
                                        foreach (var project in solution.GetAllProjects ())
 
204
                                                AddProject (project);
 
205
                                        return;
 
206
                                }
190
207
                                // entity is defined in a referenced assembly
191
208
                                var assemblyName = entity.ParentAssembly.AssemblyName;
192
209
                                if (!searchedAssemblies.Add (assemblyName))