Browse Source

WordCountDialog: add 'whole solution' option and make 'whole project' count only the current project.

newNRvisualizers
Daniel Grunwald 14 years ago
parent
commit
9c4a2c4db9
  1. 39
      src/Main/Base/Project/Src/Gui/Dialogs/WordCountDialog.cs

39
src/Main/Base/Project/Src/Gui/Dialogs/WordCountDialog.cs

@ -123,15 +123,21 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
case 2: {// whole project case 2: {// whole project
if (ProjectService.CurrentProject == null) {
MessageService.ShowError("${res:Dialog.WordCountDialog.MustBeInProtectedModeWarning}");
break;
}
total = new Report(StringParser.Parse("${res:Dialog.WordCountDialog.TotalText}"), 0, 0, 0);
CountProject(ProjectService.CurrentProject, ref total);
break;
}
case 3: { // whole solution
if (ProjectService.OpenSolution == null) { if (ProjectService.OpenSolution == null) {
MessageService.ShowError("${res:Dialog.WordCountDialog.MustBeInProtectedModeWarning}"); MessageService.ShowError("${res:Dialog.WordCountDialog.MustBeInProtectedModeWarning}");
break; break;
} }
total = new Report(StringParser.Parse("${res:Dialog.WordCountDialog.TotalText}"), 0, 0, 0); total = new Report(StringParser.Parse("${res:Dialog.WordCountDialog.TotalText}"), 0, 0, 0);
CountSolution(ProjectService.OpenSolution, ref total); CountSolution(ProjectService.OpenSolution, ref total);
// ((ListView)ControlDictionary["resultListView"]).Items.Add(new ListViewItem(""));
// ((ListView)ControlDictionary["resultListView"]).Items.Add(all.ToListItem());
break; break;
} }
} }
@ -141,14 +147,18 @@ namespace ICSharpCode.SharpDevelop.Gui
void CountSolution(Solution solution, ref Report all) void CountSolution(Solution solution, ref Report all)
{ {
foreach (IProject project in solution.Projects) { foreach (IProject project in solution.Projects) {
foreach (ProjectItem item in project.Items) { CountProject(project, ref all);
if (item.ItemType == ItemType.Compile) { }
Report r = GetReport(item.FileName); }
if (r != null) {
all += r; void CountProject(IProject project, ref Report all)
items.Add(r); {
// ((ListView)ControlDictionary["resultListView"]).Items.Add(r.ToListItem()); foreach (ProjectItem item in project.Items) {
} if (item.ItemType == ItemType.Compile) {
Report r = GetReport(item.FileName);
if (r != null) {
all += r;
items.Add(r);
} }
} }
} }
@ -230,9 +240,10 @@ namespace ICSharpCode.SharpDevelop.Gui
Icon = IconService.GetIcon("Icons.16x16.FindIcon"); Icon = IconService.GetIcon("Icons.16x16.FindIcon");
((ComboBox)ControlDictionary["locationComboBox"]).Items.Add(StringParser.Parse("${res:Global.Location.currentfile}")); ((ComboBox)ControlDictionary["locationComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.NewProject.SearchReplace.LookIn.CurrentDocument536D2AC6-E704-40BD-9790-0EB02ED6D8A9}"));
((ComboBox)ControlDictionary["locationComboBox"]).Items.Add(StringParser.Parse("${res:Global.Location.allopenfiles}")); ((ComboBox)ControlDictionary["locationComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.NewProject.SearchReplace.LookIn.AllOpenDocuments}"));
((ComboBox)ControlDictionary["locationComboBox"]).Items.Add(StringParser.Parse("${res:Global.Location.wholeproject}")); ((ComboBox)ControlDictionary["locationComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.NewProject.SearchReplace.LookIn.WholeProject}"));
((ComboBox)ControlDictionary["locationComboBox"]).Items.Add(StringParser.Parse("${res:Dialog.NewProject.SearchReplace.LookIn.WholeSolution}"));
((ComboBox)ControlDictionary["locationComboBox"]).SelectedIndex = 0; ((ComboBox)ControlDictionary["locationComboBox"]).SelectedIndex = 0;
} }
} }

Loading…
Cancel
Save