Browse Source

Don't save the text "whole solution" as directory name, save the correct DocumentIteratorType when searching in a directory.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@733 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
5cccbf6f15
  1. 27
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplacePanel.cs
  2. 2
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/SearchOptions.cs
  3. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources

27
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplacePanel.cs

@ -87,14 +87,20 @@ namespace SearchAndReplace
SearchOptions.ReplacePattern = Get<ComboBox>("replace").Text; SearchOptions.ReplacePattern = Get<ComboBox>("replace").Text;
} }
SearchOptions.LookIn = Get<ComboBox>("lookIn").Text; if (Get<ComboBox>("lookIn").DropDownStyle == ComboBoxStyle.DropDown) {
SearchOptions.LookIn = Get<ComboBox>("lookIn").Text;
}
SearchOptions.LookInFiletypes = Get<ComboBox>("fileTypes").Text; SearchOptions.LookInFiletypes = Get<ComboBox>("fileTypes").Text;
SearchOptions.MatchCase = Get<CheckBox>("matchCase").Checked; SearchOptions.MatchCase = Get<CheckBox>("matchCase").Checked;
SearchOptions.MatchWholeWord = Get<CheckBox>("matchWholeWord").Checked; SearchOptions.MatchWholeWord = Get<CheckBox>("matchWholeWord").Checked;
SearchOptions.IncludeSubdirectories = Get<CheckBox>("includeSubFolder").Checked; SearchOptions.IncludeSubdirectories = Get<CheckBox>("includeSubFolder").Checked;
SearchOptions.SearchStrategyType = (SearchStrategyType)Get<ComboBox>("use").SelectedIndex; SearchOptions.SearchStrategyType = (SearchStrategyType)Get<ComboBox>("use").SelectedIndex;
SearchOptions.DocumentIteratorType = (DocumentIteratorType)Get<ComboBox>("lookIn").SelectedIndex; if (Get<ComboBox>("lookIn").DropDownStyle == ComboBoxStyle.DropDown) {
SearchOptions.DocumentIteratorType = DocumentIteratorType.Directory;
} else {
SearchOptions.DocumentIteratorType = (DocumentIteratorType)Get<ComboBox>("lookIn").SelectedIndex;
}
} }
void SetOptions() void SetOptions()
@ -117,13 +123,18 @@ namespace SearchAndReplace
} }
Get<ComboBox>("lookIn").Text = SearchOptions.LookIn; Get<ComboBox>("lookIn").Text = SearchOptions.LookIn;
Get<ComboBox>("lookIn").Items.Add("current document"); string[] lookInTexts = {
Get<ComboBox>("lookIn").Items.Add("current selection"); // must be in the same order as the DocumentIteratorType enum
Get<ComboBox>("lookIn").Items.Add("all open documents"); "${res:Dialog.NewProject.SearchReplace.LookIn.CurrentDocument}",
Get<ComboBox>("lookIn").Items.Add("whole project"); "${res:Dialog.NewProject.SearchReplace.LookIn.CurrentSelection}",
Get<ComboBox>("lookIn").Items.Add("whole solution"); "${res:Dialog.NewProject.SearchReplace.LookIn.AllOpenDocuments}",
"${res:Dialog.NewProject.SearchReplace.LookIn.WholeProject}",
"${res:Dialog.NewProject.SearchReplace.LookIn.WholeSolution}"
};
foreach (string lookInText in lookInTexts) {
Get<ComboBox>("lookIn").Items.Add(StringParser.Parse(lookInText));
}
Get<ComboBox>("lookIn").Items.Add(SearchOptions.LookIn); Get<ComboBox>("lookIn").Items.Add(SearchOptions.LookIn);
Get<ComboBox>("lookIn").DropDownStyle = ComboBoxStyle.DropDownList;
Get<ComboBox>("lookIn").SelectedIndexChanged += new EventHandler(LookInSelectedIndexChanged); Get<ComboBox>("lookIn").SelectedIndexChanged += new EventHandler(LookInSelectedIndexChanged);
Get<ComboBox>("lookIn").SelectedIndex = (int)SearchOptions.DocumentIteratorType; Get<ComboBox>("lookIn").SelectedIndex = (int)SearchOptions.DocumentIteratorType;

2
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/SearchOptions.cs

@ -155,6 +155,8 @@ namespace SearchAndReplace
return properties.Get("DocumentIteratorType", DocumentIteratorType.CurrentDocument); return properties.Get("DocumentIteratorType", DocumentIteratorType.CurrentDocument);
} }
set { set {
if (!Enum.IsDefined(typeof(DocumentIteratorType), value))
throw new ArgumentException("invalid enum value");
properties.Set("DocumentIteratorType", value); properties.Set("DocumentIteratorType", value);
} }
} }

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.
Loading…
Cancel
Save