|
27 | 27 | import org.eclipse.core.runtime.OperationCanceledException; |
28 | 28 | import org.eclipse.core.runtime.Status; |
29 | 29 | import org.eclipse.core.runtime.jobs.Job; |
30 | | -import org.eclipse.core.runtime.preferences.InstanceScope; |
| 30 | +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
31 | 31 | import org.eclipse.jdt.annotation.Nullable; |
32 | 32 | import org.eclipse.jface.text.BadLocationException; |
33 | 33 | import org.eclipse.jface.text.IDocument; |
|
71 | 71 | public final class LSPInlineRenameLinkedMode { |
72 | 72 |
|
73 | 73 | private static final String INLINE_RENAME_PREFERENCE = "org.eclipse.lsp4e.inlineRename"; //$NON-NLS-1$ |
| 74 | + private static final boolean INLINE_RENAME_ACTIVE_DEFAULT = true; |
| 75 | + |
| 76 | + public static final class PreferenceInitializer extends AbstractPreferenceInitializer { |
| 77 | + @Override |
| 78 | + public void initializeDefaultPreferences() { |
| 79 | + final var store = LanguageServerPlugin.getDefault().getPreferenceStore(); |
| 80 | + store.setDefault(INLINE_RENAME_PREFERENCE, INLINE_RENAME_ACTIVE_DEFAULT); |
| 81 | + } |
| 82 | + } |
74 | 83 |
|
75 | 84 | static boolean start(final IDocument document, final ITextViewer viewer, final int offset, final Shell shell) { |
76 | 85 | if (!isInlineRenameEnabled()) { |
@@ -121,8 +130,7 @@ protected IStatus run(final IProgressMonitor monitor) { |
121 | 130 | } |
122 | 131 |
|
123 | 132 | private static boolean isInlineRenameEnabled() { |
124 | | - final var prefs = InstanceScope.INSTANCE.getNode(LanguageServerPlugin.PLUGIN_ID); |
125 | | - return prefs.getBoolean(INLINE_RENAME_PREFERENCE, true); |
| 133 | + return LanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(INLINE_RENAME_PREFERENCE); |
126 | 134 | } |
127 | 135 |
|
128 | 136 | private static @Nullable RefactoringStatus runPrepareRename(final LSPRenameProcessor processor) { |
|
0 commit comments