void XCodeTextBox_KeyDownHandler(object sender, KeyEventArgs e) { if (Keyboard.Modifiers != ModifierKeys.Control) { return; } if (e.Key == Key.F) { FindReplaceDialog.Show(XCodeTextBox, FindReplaceDialog.SearchType.Find); e.Handled = true; } if (e.Key == Key.H) { FindReplaceDialog.Show(XCodeTextBox, FindReplaceDialog.SearchType.Replace); e.Handled = true; } if (e.Key == Key.OemPlus) { XCodeTextBox.FontSize++; e.Handled = true; } if (e.Key == Key.OemMinus) { if (XCodeTextBox.FontSize > MIN_FONT_SIZE) { XCodeTextBox.FontSize--; } e.Handled = true; } }
private async void Find(TextEditor obj) { var dialog = new FindReplaceDialog(obj); dialog.ConfigureFor(FindReplaceDialog.DialogType.Find); await _app.ShowDialog("Find & Replace", dialog, DialogButtons.None, false); }
public override void Run() { var wb = Workbench.Instance; var exp = wb.ActiveSiteExplorer; var omgr = ServiceRegistry.GetService <OpenResourceManager>(); var connMgr = ServiceRegistry.GetService <ServerConnectionManager>(); var conn = connMgr.GetConnection(exp.ConnectionName); if (exp.SelectedItems.Length > 0) { int replaced = 0; var diag = new FindReplaceDialog(); Action <string> DoRun = (string resourceId) => { //To maintain resource integrity, we don't modify any open resources. So we //ask if they want to close down first. If they say no, omit this resource from //the find/replace if (omgr.IsOpen(resourceId, conn)) { omgr.CloseEditors(conn, resourceId, false); //Still open. Must've said no if (omgr.IsOpen(resourceId, conn)) { LoggingService.Info(string.Format(Strings.SkippingResource, resourceId)); return; } } //Re-open in XML editor for user review var ed = (XmlEditor)omgr.Open(resourceId, conn, true, wb.ActiveSiteExplorer); //Do the find/replace. Dirty state would be triggered if any replacements were made //It is then up to the user to review the change and decide whether to save or not ed.FindAndReplace(diag.FindToken, diag.ReplaceToken); replaced++; }; if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (var item in exp.SelectedItems) { if (item.IsFolder) { var resources = conn.ResourceService.GetRepositoryResources(item.ResourceId); foreach (IRepositoryItem resource in resources.Items) { if (resource.ResourceType != "Folder") { DoRun(resource.ResourceId); } } } else { DoRun(item.ResourceId); } } } } }
private void Button_Click(object sender, RoutedEventArgs e) { try { FindReplaceDialog.ShowForFind(loliScriptEditor); } catch { } }
private void findToolStripMenuItem_Click(object sender, EventArgs e) { if (this.findReplaceDialog == null) { this.findReplaceDialog = new FindReplaceDialog(); this.findReplaceDialog.FormClosing += new FormClosingEventHandler(this.findReplaceDialog_FormClosing); } this.InitFindReplace(); }
internal void DoFind() { FindReplaceDialog diag = new FindReplaceDialog(); diag.EnableReplace = false; diag.FindNext += new EventHandler(diag_FindNext); diag.Closed += new EventHandler(diagFind_Closed); diag.Show(); }
void diag_ReplaceAll(object sender, EventArgs e) { FindReplaceDialog diag = sender as FindReplaceDialog; if (diag != null) { Content.Document.Text = Content.Document.Text.Replace(diag.SearchText, diag.ReplaceText); } }
private static void ExecuteFindReplace(BoneViewModel target) { var dialog = new FindReplaceDialog("Find and Replace in Hierarchy..."); bool result = dialog.ShowDialog() ?? false; if (result) { FindReplaceRecursive(target, dialog.Find, dialog.Replace); } }
private void CreateDialog(bool showReplace, bool showAll) { if (_dialog == null || _dialog.IsDisposed) { _dialog = new FindReplaceDialog(_lastSearchText, _lastReplaceText, this); _dialog.ShowingReplaceDialog = showReplace; _dialog.ShowingAllDialog = showAll; } }
void FindDialogOnFindNext(object obj, EventArgs ea) { FindReplaceDialog dlg = (FindReplaceDialog)obj; strFind = dlg.FindText; bMatchCase = dlg.MatchCase; bFindDown = dlg.FindDown; FindNext(); }
internal void DoReplace() { FindReplaceDialog diag = new FindReplaceDialog(); diag.EnableReplace = true; diag.FindNext += new EventHandler(diag_FindNext); diag.Replace += new EventHandler(diag_Replace); diag.ReplaceAll += new EventHandler(diag_ReplaceAll); diag.Closed += new EventHandler(diag_Closed); diag.Show(); }
private void CreateDialog(bool showReplace, bool showAll) { if (_dialog == null || _dialog.IsDisposed) { _dialog = new FindReplaceDialog(_lastSearchText, _lastReplaceText, _agsEditor.Preferences, this); _dialog.ShowingReplaceDialog = showReplace; _dialog.ShowingAllDialog = showAll; _dialog.CaseSensitive = _lastCaseSensitive; } }
void diagFind_Closed(object sender, EventArgs e) { FindReplaceDialog diag = sender as FindReplaceDialog; if (diag != null) { diag.FindNext -= new EventHandler(diag_FindNext); diag.Closed -= new EventHandler(diag_Closed); } }
void ReplaceDialogOnReplace(object obj, EventArgs ea) { FindReplaceDialog dlg = (FindReplaceDialog)obj; strFind = dlg.FindText; strReplace = dlg.ReplaceText; bMatchCase = dlg.MatchCase; if (string.Compare(strFind, txtbox.SelectedText, !bMatchCase) == 0) { txtbox.SelectedText = strReplace; } FindNext(); }
private void browserDesign_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { modifiedDocument = true; if (e.KeyData == (Keys.Control | Keys.F)) { modeTabs.SelectedTab = tabEditor; FindReplaceDialog dlgFind = new FindReplaceDialog(); dlgFind.Scintilla = editor; dlgFind.ShowDialog(); dlgFind.Activate(); dlgFind.Focus(); return; } }
/// <summary> /// 実行 /// </summary> /// <param name="parameter"></param> protected override void Invoke(object parameter) { // イベント引数とContextを取得する var args = parameter as InteractionRequestedEventArgs; var ctx = args.Context as Confirmation; var entity = ctx.Content as FindReplaceDialogRequestEntity; if (entity != null) { switch (entity.RequestKind) { case FindReplaceDialogRequestEntity.DialogRequest.OpenFind: FindReplaceDialog.ShowFindReplaceDialog( this.AssociatedObject, this.AssociatedObject._CenterTextEditor, this.AssociatedObject._NodeView, true); break; case FindReplaceDialogRequestEntity.DialogRequest.OpenReplace: FindReplaceDialog.ShowFindReplaceDialog( this.AssociatedObject, this.AssociatedObject._CenterTextEditor, this.AssociatedObject._NodeView, false); break; case FindReplaceDialogRequestEntity.DialogRequest.FindNext: FindReplaceDialog.Find(this.AssociatedObject, false); break; case FindReplaceDialogRequestEntity.DialogRequest.FindPrev: FindReplaceDialog.Find(this.AssociatedObject, true); break; default: break; } } }
void diag_Replace(object sender, EventArgs e) { FindReplaceDialog diag = sender as FindReplaceDialog; if (diag != null) { //first--is the currently selected text already matched? if (Content.SelectedText == diag.SearchText) { Content.SelectedText = diag.ReplaceText; diag_FindNext(sender, e); } else { diag_FindNext(sender, e); if (Content.SelectedText == diag.SearchText) { Content.SelectedText = diag.ReplaceText; } } } }
void ReplaceDialogOnReplaceAll(object obj, EventArgs ea) { FindReplaceDialog dlg = (FindReplaceDialog)obj; string str = txtbox.Text; strFind = dlg.FindText; strReplace = dlg.ReplaceText; bMatchCase = dlg.MatchCase; if (bMatchCase) { str = str.Replace(strFind, strReplace); } else { for (int i = 0; i < str.Length - strFind.Length;) { if (String.Compare(str, i, strFind, 0, strFind.Length, true) == 0) { str = str.Remove(i, strFind.Length); str = str.Insert(i, strReplace); i += strReplace.Length; } else { i += 1; } } } if (str != txtbox.Text) { txtbox.Text = str; txtbox.SelectionStart = 0; txtbox.SelectionLength = 0; txtbox.Modified = true; } }
void diag_FindNext(object sender, EventArgs e) { FindReplaceDialog diag = sender as FindReplaceDialog; if (diag != null) { int i = Content.Document.Text.IndexOf(diag.SearchText, Content.CaretOffset); if (i < 0) { i = Content.Document.Text.IndexOf(diag.SearchText); } if (i >= 0) { Content.CaretOffset = i; Content.Select(Content.CaretOffset, diag.SearchText.Length); } else { MessageBox.Show(diag.SearchText + " not found.", "Find", MessageBoxButton.OK, MessageBoxImage.Information); } } }
private void findReplaceDialog_FormClosing(object sender, FormClosingEventArgs e) { this.findReplaceDialog = null; }