1
// WholeProjectDocumentIterator.cs
3
// This file was derived from a file from #Develop.
5
// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
7
// This program is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with this program; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
using System.Collections;
25
using MonoDevelop.Projects;
26
using MonoDevelop.Core;
27
using MonoDevelop.Ide.Gui;
29
namespace MonoDevelop.Ide.Gui.Search
31
internal class WholeProjectDocumentIterator : IDocumentIterator
33
ArrayList files = new ArrayList();
36
public WholeProjectDocumentIterator()
41
public string CurrentFileName {
43
if (curIndex < 0 || curIndex >= files.Count) {
47
return files[curIndex].ToString();
51
public IDocumentInformation Current {
53
if (curIndex < 0 || curIndex >= files.Count) {
56
if (!File.Exists(files[curIndex].ToString())) {
61
string fileName = files[curIndex].ToString();
62
foreach (Document document in IdeApp.Workbench.Documents) {
63
// WINDOWS DEPENDENCY : ToUpper
64
if (document.FileName != null && document.FileName.ToUpper() == fileName.ToUpper()) {
65
IDocumentInformation doc = document.Window.ViewContent as IDocumentInformation;
66
if (doc != null) return doc;
69
return new FileDocumentInformation (fileName, 0);
73
public bool MoveForward()
75
return ++curIndex < files.Count;
78
public bool MoveBackward()
81
curIndex = files.Count - 1;
84
return --curIndex >= -1;
88
void AddFiles(Project project)
90
foreach (ProjectFile file in project.ProjectFiles) {
91
if (file.Subtype == Subtype.Code) {
97
void AddFiles(Combine combine)
99
foreach (CombineEntry entry in combine.Entries) {
100
if (entry is Project) {
101
AddFiles ((Project)entry);
102
} else if (entry is Combine) {
103
AddFiles ((Combine)entry);
111
if (IdeApp.ProjectOperations.CurrentOpenCombine != null) {
112
AddFiles (IdeApp.ProjectOperations.CurrentOpenCombine);