@@ -129,13 +129,15 @@ public void shellDeactivated(ShellEvent e) {
129
129
*/
130
130
private class InputModifyListener implements ModifyListener {
131
131
132
- private Runnable modificationHandler ;
132
+ private final Runnable logicUpdateHandler ;
133
+ private final Runnable uiUpdateHandler ;
133
134
134
135
// XXX: Workaround for Combo bug on Linux (see bug 404202 and bug 410603)
135
136
private boolean fIgnoreNextEvent ;
136
137
137
- private InputModifyListener (Runnable modificationHandler ) {
138
- this .modificationHandler = modificationHandler ;
138
+ private InputModifyListener (Runnable logicUpdateHandler , Runnable uiUpdateHandler ) {
139
+ this .logicUpdateHandler = logicUpdateHandler ;
140
+ this .uiUpdateHandler = uiUpdateHandler ;
139
141
}
140
142
141
143
private void ignoreNextEvent () {
@@ -144,13 +146,15 @@ private void ignoreNextEvent() {
144
146
145
147
@ Override
146
148
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 ();
148
151
// XXX: Workaround for Combo bug on Linux (see bug 404202 and bug 410603)
152
+ // UI must only be updated after second event on Linux
149
153
if (fIgnoreNextEvent ) {
150
154
fIgnoreNextEvent = false ;
151
155
return ;
152
156
}
153
- modificationHandler .run ();
157
+ uiUpdateHandler .run ();
154
158
}
155
159
}
156
160
@@ -644,8 +648,7 @@ private Composite createInputPanel(Composite parent) {
644
648
ITextEditorActionDefinitionIds .CONTENT_ASSIST_PROPOSALS , new char [0 ], true );
645
649
setGridData (fFindField , SWT .FILL , true , SWT .CENTER , false );
646
650
addDecorationMargin (fFindField );
647
- fFindModifyListener = new InputModifyListener (() -> {
648
- updateFindString ();
651
+ fFindModifyListener = new InputModifyListener (this ::updateFindString , () -> {
649
652
updateButtonState (!findReplaceLogic .isActive (SearchOptions .INCREMENTAL ));
650
653
decorate ();
651
654
});
@@ -663,12 +666,7 @@ private Composite createInputPanel(Composite parent) {
663
666
ITextEditorActionDefinitionIds .CONTENT_ASSIST_PROPOSALS , new char [0 ], true );
664
667
setGridData (fReplaceField , SWT .FILL , true , SWT .CENTER , false );
665
668
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 );
672
670
fReplaceField .addModifyListener (fReplaceModifyListener );
673
671
674
672
return panel ;
@@ -680,6 +678,12 @@ private void updateFindString() {
680
678
}
681
679
}
682
680
681
+ private void updateReplaceString () {
682
+ if (okToUse (fReplaceField )) {
683
+ findReplaceLogic .setReplaceString (fReplaceField .getText ());
684
+ }
685
+ }
686
+
683
687
/**
684
688
* Creates the functional options part of the options defining section of the
685
689
* find replace dialog.
0 commit comments