Skip to content

Commit 033cedf

Browse files
committed
Find/Replace overlay can't be disabled by product customization
To read values from *all* scopes one has to use IPreferencesService, not the InstanceScope! Fixes #2778
1 parent bd93b33 commit 033cedf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceAction.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
import org.eclipse.swt.widgets.Shell;
2222

2323
import org.eclipse.core.runtime.Assert;
24+
import org.eclipse.core.runtime.Platform;
2425
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
26+
import org.eclipse.core.runtime.preferences.IPreferencesService;
2527
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
2628
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
2729
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -67,14 +69,15 @@ public class FindReplaceAction extends ResourceAction implements IUpdate {
6769
private static final String FIND_REPLACE_OVERLAY_AT_BOTTOM = "findReplaceOverlayAtBottom"; //$NON-NLS-1$
6870

6971
private boolean shouldUseOverlay() {
70-
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(INSTANCE_SCOPE_NODE_NAME);
71-
boolean overlayPreference = preferences.getBoolean(USE_FIND_REPLACE_OVERLAY, true);
72+
IPreferencesService preferences = Platform.getPreferencesService();
73+
boolean overlayPreference = preferences.getBoolean(INSTANCE_SCOPE_NODE_NAME, USE_FIND_REPLACE_OVERLAY, true, null);
7274
return overlayPreference && fWorkbenchPart instanceof StatusTextEditor;
7375
}
7476

7577
private static boolean shouldPositionOverlayOnTop() {
76-
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(INSTANCE_SCOPE_NODE_NAME);
77-
return !preferences.getBoolean(FIND_REPLACE_OVERLAY_AT_BOTTOM, false);
78+
IPreferencesService preferences = Platform.getPreferencesService();
79+
boolean atBottom = preferences.getBoolean(INSTANCE_SCOPE_NODE_NAME, FIND_REPLACE_OVERLAY_AT_BOTTOM, false, null);
80+
return !atBottom;
7881
}
7982

8083
private IPreferenceChangeListener overlayDialogPreferenceListener = new IPreferenceChangeListener() {

0 commit comments

Comments
 (0)