Browse Source

Fixed SD2-416: Multi-instance Search and Replace dialog

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@386 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
97f2383785
  1. 5
      src/Main/Base/Project/Src/TextEditor/Commands/SearchCommands.cs
  2. 16
      src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs
  3. 29
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Commands/SearchMainMenuCommands.cs
  4. 18
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplaceDialog.cs
  5. 1
      src/Tools/UpdateAssemblyInfo/Main.cs

5
src/Main/Base/Project/Src/TextEditor/Commands/SearchCommands.cs

@ -30,10 +30,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
{ {
public override void Run() public override void Run()
{ {
if (!GotoDialog.IsVisible) { GotoDialog.ShowSingleInstance();
GotoDialog gnd = new GotoDialog();
gnd.Show(WorkbenchSingleton.MainForm);
}
} }
} }

16
src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

@ -27,7 +27,17 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
public class GotoDialog : BaseSharpDevelopForm public class GotoDialog : BaseSharpDevelopForm
{ {
public static bool IsVisible = false; static GotoDialog Instance = null;
public static void ShowSingleInstance()
{
if (Instance == null) {
Instance = new GotoDialog();
Instance.Show(WorkbenchSingleton.MainForm);
} else {
Instance.Focus();
}
}
ListView listView; ListView listView;
TextBox textBox; TextBox textBox;
@ -122,7 +132,7 @@ namespace ICSharpCode.SharpDevelop.Gui
protected override void OnClosed(EventArgs e) protected override void OnClosed(EventArgs e)
{ {
IsVisible = false; Instance = null;
base.OnClosed(e); base.OnClosed(e);
} }
@ -320,7 +330,6 @@ namespace ICSharpCode.SharpDevelop.Gui
void CancelButtonClick(object sender, EventArgs e) void CancelButtonClick(object sender, EventArgs e)
{ {
IsVisible = false;
Close(); Close();
} }
@ -368,7 +377,6 @@ namespace ICSharpCode.SharpDevelop.Gui
throw new NotImplementedException("Unknown tag: " + tag); throw new NotImplementedException("Unknown tag: " + tag);
} }
} finally { } finally {
IsVisible = false;
Close(); Close();
} }
} }

29
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Commands/SearchMainMenuCommands.cs

@ -46,17 +46,7 @@ namespace SearchAndReplace
public override void Run() public override void Run()
{ {
SetSearchPattern(); SetSearchPattern();
SearchAndReplaceDialog.ShowSingleInstance(SearchAndReplaceMode.Search);
SearchAndReplaceDialog searchAndReplaceDialog = new SearchAndReplaceDialog(SearchAndReplaceMode.Search);
searchAndReplaceDialog.Show();
// if (SearchReplaceManager.ReplaceDialog != null) {
// SearchReplaceManager.ReplaceDialog.SetSearchPattern(SearchReplaceManager.SearchOptions.SearchPattern);
// } else {
// ReplaceDialog rd = new ReplaceDialog(false);
// rd.Owner = (Form)WorkbenchSingleton.Workbench;
// rd.Show();
// }
} }
} }
@ -64,12 +54,7 @@ namespace SearchAndReplace
{ {
public override void Run() public override void Run()
{ {
try {
SearchReplaceManager.FindNext(); SearchReplaceManager.FindNext();
} catch (Exception e) {
MessageService.ShowError(e);
}
} }
} }
@ -78,17 +63,7 @@ namespace SearchAndReplace
public override void Run() public override void Run()
{ {
Find.SetSearchPattern(); Find.SetSearchPattern();
SearchAndReplaceDialog searchAndReplaceDialog = new SearchAndReplaceDialog(SearchAndReplaceMode.Replace); SearchAndReplaceDialog.ShowSingleInstance(SearchAndReplaceMode.Replace);
searchAndReplaceDialog.Show();
//
//
// if (SearchReplaceManager.ReplaceDialog != null) {
// SearchReplaceManager.ReplaceDialog.SetSearchPattern(SearchReplaceManager.SearchOptions.SearchPattern);
// } else {
// ReplaceDialog rd = new ReplaceDialog(true);
// rd.Owner = (Form)WorkbenchSingleton.Workbench;
// rd.Show();
// }
} }
} }
} }

18
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplaceDialog.cs

@ -24,6 +24,23 @@ namespace SearchAndReplace
public static string SearchPattern = ""; public static string SearchPattern = "";
public static string ReplacePattern = ""; public static string ReplacePattern = "";
static SearchAndReplaceDialog Instance;
public static void ShowSingleInstance(SearchAndReplaceMode searchAndReplaceMode)
{
if (Instance == null) {
Instance = new SearchAndReplaceDialog(searchAndReplaceMode);
Instance.Show(WorkbenchSingleton.MainForm);
} else {
if (searchAndReplaceMode == SearchAndReplaceMode.Search) {
Instance.searchButton.PerformClick();
} else {
Instance.replaceButton.PerformClick();
}
Instance.Focus();
}
}
ToolStripButton searchButton = new ToolStripButton(); ToolStripButton searchButton = new ToolStripButton();
ToolStripButton replaceButton = new ToolStripButton(); ToolStripButton replaceButton = new ToolStripButton();
@ -78,6 +95,7 @@ namespace SearchAndReplace
{ {
base.OnClosing(e); base.OnClosing(e);
PropertyService.Set("ICSharpCode.SharpDevelop.Gui.SearchAndReplaceDialog.Location", this.Location); PropertyService.Set("ICSharpCode.SharpDevelop.Gui.SearchAndReplaceDialog.Location", this.Location);
Instance = null;
} }
protected override void OnKeyDown(KeyEventArgs e) protected override void OnKeyDown(KeyEventArgs e)

1
src/Tools/UpdateAssemblyInfo/Main.cs

@ -114,6 +114,7 @@ namespace UpdateAssemblyInfo
string[] dontTouchList = new string[] { string[] dontTouchList = new string[] {
"Main/StartUp/Project/", // Startup is special case "Main/StartUp/Project/", // Startup is special case
"Libraries/log4net/", "Libraries/log4net/",
"Libraries/NUnit.Framework/",
"Libraries/DockPanel_Src/", "Libraries/DockPanel_Src/",
"AddIns/Misc/Debugger/TreeListView/Project/", "AddIns/Misc/Debugger/TreeListView/Project/",
}; };

Loading…
Cancel
Save