@@ -129,13 +129,15 @@ public void shellDeactivated(ShellEvent e) {
129129 */
130130 private class InputModifyListener implements ModifyListener {
131131
132- private Runnable modificationHandler ;
132+ private final Runnable logicUpdateHandler ;
133+ private final Runnable uiUpdateHandler ;
133134
134135 // XXX: Workaround for Combo bug on Linux (see bug 404202 and bug 410603)
135136 private boolean fIgnoreNextEvent ;
136137
137- private InputModifyListener (Runnable modificationHandler ) {
138- this .modificationHandler = modificationHandler ;
138+ private InputModifyListener (Runnable logicUpdateHandler , Runnable uiUpdateHandler ) {
139+ this .logicUpdateHandler = logicUpdateHandler ;
140+ this .uiUpdateHandler = uiUpdateHandler ;
139141 }
140142
141143 private void ignoreNextEvent () {
@@ -144,13 +146,15 @@ private void ignoreNextEvent() {
144146
145147 @ Override
146148 public void modifyText (ModifyEvent e ) {
147- modificationHandler .run ();
149+ // Data in logic needs to updated immediately (i.e., find or replace string)
150+ logicUpdateHandler .run ();
148151 // XXX: Workaround for Combo bug on Linux (see bug 404202 and bug 410603)
152+ // UI must only be updated after second event on Linux
149153 if (fIgnoreNextEvent ) {
150154 fIgnoreNextEvent = false ;
151155 return ;
152156 }
153- modificationHandler .run ();
157+ uiUpdateHandler .run ();
154158 }
155159 }
156160
@@ -644,8 +648,7 @@ private Composite createInputPanel(Composite parent) {
644648 ITextEditorActionDefinitionIds .CONTENT_ASSIST_PROPOSALS , new char [0 ], true );
645649 setGridData (fFindField , SWT .FILL , true , SWT .CENTER , false );
646650 addDecorationMargin (fFindField );
647- fFindModifyListener = new InputModifyListener (() -> {
648- updateFindString ();
651+ fFindModifyListener = new InputModifyListener (this ::updateFindString , () -> {
649652 updateButtonState (!findReplaceLogic .isActive (SearchOptions .INCREMENTAL ));
650653 decorate ();
651654 });
@@ -663,12 +666,7 @@ private Composite createInputPanel(Composite parent) {
663666 ITextEditorActionDefinitionIds .CONTENT_ASSIST_PROPOSALS , new char [0 ], true );
664667 setGridData (fReplaceField , SWT .FILL , true , SWT .CENTER , false );
665668 addDecorationMargin (fReplaceField );
666- fReplaceModifyListener = new InputModifyListener (() -> {
667- if (okToUse (fReplaceField )) {
668- findReplaceLogic .setReplaceString (fReplaceField .getText ());
669- }
670- updateButtonState ();
671- });
669+ fReplaceModifyListener = new InputModifyListener (this ::updateReplaceString , this ::updateButtonState );
672670 fReplaceField .addModifyListener (fReplaceModifyListener );
673671
674672 return panel ;
@@ -680,6 +678,12 @@ private void updateFindString() {
680678 }
681679 }
682680
681+ private void updateReplaceString () {
682+ if (okToUse (fReplaceField )) {
683+ findReplaceLogic .setReplaceString (fReplaceField .getText ());
684+ }
685+ }
686+
683687 /**
684688 * Creates the functional options part of the options defining section of the
685689 * find replace dialog.
0 commit comments