From 5d7d479e2dc28417b96deb3945f68e0029359386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Thu, 6 Dec 2018 11:39:10 +0100 Subject: [PATCH 1/2] Use the correct term QUALIFIER instead of the misleading SCOPE. --- .../python/pydev/analysis/AnalysisPreferenceInitializer.java | 4 ++-- .../com/python/pydev/analysis/mypy/MypyPrefInitializer.java | 2 +- .../python/pydev/analysis/pylint/PyLintPrefInitializer.java | 2 +- .../com/python/pydev/debug/DebugPluginPrefsInitializer.java | 2 +- .../pydev/refactoring/RefactoringPreferencesInitializer.java | 4 ++-- .../pydev/ast/codecompletion/PyCodeCompletionInitializer.java | 2 +- .../core/preferences/PyDevCorePreferencesInitializer.java | 2 +- .../python/pydev/core/preferences/PyScopedPreferences.java | 2 +- .../python/pydev/jython/ScriptingExtensionInitializer.java | 4 ++-- .../src/org/python/pydev/shared_core/SharedCorePlugin.java | 2 +- .../python/pydev/editor/preferences/PyTabPreferencesPage.java | 2 +- .../pydev/editor/preferences/PydevTypingPreferencesPage.java | 2 +- .../pydev/editor/saveactions/PydevSaveActionsPrefPage.java | 2 +- .../python/pydev/plugin/preferences/PyCodeFormatterPage.java | 2 +- .../pydev/plugin/preferences/PydevPrefsInitializer.java | 2 +- .../org/python/pydev/pyunit/preferences/PyUnitPrefsPage2.java | 2 +- .../python/pydev/ui/importsconf/ImportsPreferencesPage.java | 2 +- 17 files changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPreferenceInitializer.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPreferenceInitializer.java index 8972c8ed97..fb7e96757f 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPreferenceInitializer.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPreferenceInitializer.java @@ -16,7 +16,7 @@ public class AnalysisPreferenceInitializer extends AbstractPreferenceInitializer { - public static final String DEFAULT_SCOPE = "com.python.pydev.analysis"; + public static final String DEFAULT_QUALIFIER = "com.python.pydev.analysis"; public static final String SEVERITY_UNUSED_PARAMETER = "SEVERITY_UNUSED_PARAMETER"; public static final int DEFAULT_SEVERITY_UNUSED_PARAMETER = IMarker.SEVERITY_INFO; @@ -103,7 +103,7 @@ public class AnalysisPreferenceInitializer extends AbstractPreferenceInitializer @Override public void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_QUALIFIER); for (int i = 0; i < AnalysisPreferences.completeSeverityMap.length; i++) { Object[] s = AnalysisPreferences.completeSeverityMap[i]; diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/mypy/MypyPrefInitializer.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/mypy/MypyPrefInitializer.java index 7e7a20cf45..09df7eb359 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/mypy/MypyPrefInitializer.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/mypy/MypyPrefInitializer.java @@ -13,7 +13,7 @@ public class MypyPrefInitializer { public static void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); node.put(MypyPreferences.MYPY_FILE_LOCATION, ""); node.putBoolean(MypyPreferences.USE_MYPY, MypyPreferences.DEFAULT_USE_MYPY); diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pylint/PyLintPrefInitializer.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pylint/PyLintPrefInitializer.java index 0a23715515..0597a9a1ed 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pylint/PyLintPrefInitializer.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pylint/PyLintPrefInitializer.java @@ -16,7 +16,7 @@ public class PyLintPrefInitializer { public static void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); node.put(PyLintPreferences.PYLINT_FILE_LOCATION, ""); node.putBoolean(PyLintPreferences.USE_PYLINT, PyLintPreferences.DEFAULT_USE_PYLINT); diff --git a/plugins/com.python.pydev.debug/src/com/python/pydev/debug/DebugPluginPrefsInitializer.java b/plugins/com.python.pydev.debug/src/com/python/pydev/debug/DebugPluginPrefsInitializer.java index 0bc3088521..7467ad14d7 100644 --- a/plugins/com.python.pydev.debug/src/com/python/pydev/debug/DebugPluginPrefsInitializer.java +++ b/plugins/com.python.pydev.debug/src/com/python/pydev/debug/DebugPluginPrefsInitializer.java @@ -33,7 +33,7 @@ public class DebugPluginPrefsInitializer extends AbstractPreferenceInitializer { @Override public void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); node.putInt(PYDEV_REMOTE_DEBUGGER_PORT, DEFAULT_REMOTE_DEBUGGER_PORT); node.putInt(DEBUG_SERVER_STARTUP, DEFAULT_DEBUG_SERVER_ALWAYS_ON); diff --git a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/RefactoringPreferencesInitializer.java b/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/RefactoringPreferencesInitializer.java index 68866874e7..71490ffec7 100644 --- a/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/RefactoringPreferencesInitializer.java +++ b/plugins/com.python.pydev.refactoring/src/com/python/pydev/refactoring/RefactoringPreferencesInitializer.java @@ -13,11 +13,11 @@ import com.python.pydev.refactoring.ui.MarkOccurrencesPreferencesPage; public class RefactoringPreferencesInitializer extends AbstractPreferenceInitializer { - public static final String DEFAULT_SCOPE = "com.python.pydev.analysis.refactoring"; + public static final String DEFAULT_QUALIFIER = "com.python.pydev.analysis.refactoring"; @Override public void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_QUALIFIER); node.putBoolean(MarkOccurrencesPreferencesPage.USE_MARK_OCCURRENCES, MarkOccurrencesPreferencesPage.DEFAULT_USE_MARK_OCCURRENCES); node.putBoolean(MarkOccurrencesPreferencesPage.USE_MARK_OCCURRENCES_IN_STRINGS, diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/codecompletion/PyCodeCompletionInitializer.java b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/codecompletion/PyCodeCompletionInitializer.java index 98f279298e..22f9848115 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/codecompletion/PyCodeCompletionInitializer.java +++ b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/codecompletion/PyCodeCompletionInitializer.java @@ -19,7 +19,7 @@ public class PyCodeCompletionInitializer extends AbstractPreferenceInitializer { @Override public void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); //use? node.putBoolean(PyCodeCompletionPreferences.USE_CODECOMPLETION, diff --git a/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyDevCorePreferencesInitializer.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyDevCorePreferencesInitializer.java index 048ef52701..6c13d622fb 100644 --- a/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyDevCorePreferencesInitializer.java +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyDevCorePreferencesInitializer.java @@ -9,7 +9,7 @@ public class PyDevCorePreferencesInitializer { public static void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); //ironpython node.put(IInterpreterManager.IRONPYTHON_INTERNAL_SHELL_VM_ARGS, diff --git a/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyScopedPreferences.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyScopedPreferences.java index b17ec03d88..176fd1f8b1 100644 --- a/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyScopedPreferences.java +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyScopedPreferences.java @@ -35,7 +35,7 @@ public static String getString(String setting, IAdaptable projectAdaptable, Stri } public static IScopedPreferences get() { - return ScopedPreferences.get(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE); + return ScopedPreferences.get(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); } } diff --git a/plugins/org.python.pydev.jython/src/org/python/pydev/jython/ScriptingExtensionInitializer.java b/plugins/org.python.pydev.jython/src/org/python/pydev/jython/ScriptingExtensionInitializer.java index d4a02cf0d8..2d94f674f0 100644 --- a/plugins/org.python.pydev.jython/src/org/python/pydev/jython/ScriptingExtensionInitializer.java +++ b/plugins/org.python.pydev.jython/src/org/python/pydev/jython/ScriptingExtensionInitializer.java @@ -12,11 +12,11 @@ import org.python.pydev.jython.ui.JyScriptingPreferencesPage; public class ScriptingExtensionInitializer extends AbstractPreferenceInitializer { - public static final String DEFAULT_SCOPE = "org.python.pydev.jython"; + public static final String DEFAULT_QUALIFIER = "org.python.pydev.jython"; @Override public void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_QUALIFIER); node.putBoolean(JyScriptingPreferencesPage.SHOW_SCRIPTING_OUTPUT, JyScriptingPreferencesPage.DEFAULT_SHOW_SCRIPTING_OUTPUT); diff --git a/plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/SharedCorePlugin.java b/plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/SharedCorePlugin.java index 0848dac7e6..58ef392e0a 100644 --- a/plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/SharedCorePlugin.java +++ b/plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/SharedCorePlugin.java @@ -29,7 +29,7 @@ public class SharedCorePlugin extends Plugin { public static final String PYDEV_PLUGIN_ID = "org.python.pydev"; - public static final String DEFAULT_PYDEV_PREFERENCES_SCOPE = "org.python.pydev"; + public static final String DEFAULT_PYDEV_PREFERENCES_QUALIFIER = "org.python.pydev"; //The shared instance. private static SharedCorePlugin plugin; diff --git a/plugins/org.python.pydev/src/org/python/pydev/editor/preferences/PyTabPreferencesPage.java b/plugins/org.python.pydev/src/org/python/pydev/editor/preferences/PyTabPreferencesPage.java index 799a131543..54cbb7c324 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/editor/preferences/PyTabPreferencesPage.java +++ b/plugins/org.python.pydev/src/org/python/pydev/editor/preferences/PyTabPreferencesPage.java @@ -42,6 +42,6 @@ protected void createFieldEditors() { "Assume tab spacing when files contain tabs?", p)); addField(new BooleanFieldEditor(PyDevCoreEditorPreferences.TAB_STOP_IN_COMMENT, "Allow tab stops in comments?", p)); - addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this)); + addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER, this)); } } diff --git a/plugins/org.python.pydev/src/org/python/pydev/editor/preferences/PydevTypingPreferencesPage.java b/plugins/org.python.pydev/src/org/python/pydev/editor/preferences/PydevTypingPreferencesPage.java index c56d3c10d4..cb2fcc1102 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/editor/preferences/PydevTypingPreferencesPage.java +++ b/plugins/org.python.pydev/src/org/python/pydev/editor/preferences/PydevTypingPreferencesPage.java @@ -171,7 +171,7 @@ public void widgetSelected(SelectionEvent e) { addField(new LabelFieldEditor("__UNUSED__", "Note: smart move line up/down change applied on editor restart.", p)); - addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this)); + addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER, this)); } diff --git a/plugins/org.python.pydev/src/org/python/pydev/editor/saveactions/PydevSaveActionsPrefPage.java b/plugins/org.python.pydev/src/org/python/pydev/editor/saveactions/PydevSaveActionsPrefPage.java index 635216c36d..fe9dbf4762 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/editor/saveactions/PydevSaveActionsPrefPage.java +++ b/plugins/org.python.pydev/src/org/python/pydev/editor/saveactions/PydevSaveActionsPrefPage.java @@ -228,7 +228,7 @@ public void widgetDefaultSelected(SelectionEvent e) { addField(new LabelFieldEditor("__dummy__", "I.e.: __updated__=\"2010-01-01\" will be synched on save.", p)); - addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this)); + addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER, this)); } diff --git a/plugins/org.python.pydev/src/org/python/pydev/plugin/preferences/PyCodeFormatterPage.java b/plugins/org.python.pydev/src/org/python/pydev/plugin/preferences/PyCodeFormatterPage.java index 6773809012..f2232f2184 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/plugin/preferences/PyCodeFormatterPage.java +++ b/plugins/org.python.pydev/src/org/python/pydev/plugin/preferences/PyCodeFormatterPage.java @@ -225,7 +225,7 @@ public void widgetDefaultSelected(SelectionEvent e) { GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); labelExample.setLayoutData(layoutData); - addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this)); + addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER, this)); } private void createTabs(Composite p) { diff --git a/plugins/org.python.pydev/src/org/python/pydev/plugin/preferences/PydevPrefsInitializer.java b/plugins/org.python.pydev/src/org/python/pydev/plugin/preferences/PydevPrefsInitializer.java index cf6d1d3446..0ee6773cdd 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/plugin/preferences/PydevPrefsInitializer.java +++ b/plugins/org.python.pydev/src/org/python/pydev/plugin/preferences/PydevPrefsInitializer.java @@ -32,7 +32,7 @@ public class PydevPrefsInitializer extends AbstractPreferenceInitializer { @Override public void initializeDefaultPreferences() { - Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE); + Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); node.putInt(IWizardNewProjectNameAndLocationPage.PYDEV_NEW_PROJECT_CREATE_PREFERENCES, IWizardNewProjectNameAndLocationPage.PYDEV_NEW_PROJECT_CREATE_PROJECT_AS_SRC_FOLDER); diff --git a/plugins/org.python.pydev/src/org/python/pydev/pyunit/preferences/PyUnitPrefsPage2.java b/plugins/org.python.pydev/src/org/python/pydev/pyunit/preferences/PyUnitPrefsPage2.java index c612b05ba1..d452385909 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/pyunit/preferences/PyUnitPrefsPage2.java +++ b/plugins/org.python.pydev/src/org/python/pydev/pyunit/preferences/PyUnitPrefsPage2.java @@ -302,7 +302,7 @@ public void widgetDefaultSelected(SelectionEvent e) { layoutTestRunnerOptions(stackLayout, getTestRunner(null), contentPanel); addField( - new ScopedPreferencesFieldEditor(parentAll, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this)); + new ScopedPreferencesFieldEditor(parentAll, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER, this)); } private void add(String linkText, String flag, String tooltip, Composite p) { diff --git a/plugins/org.python.pydev/src/org/python/pydev/ui/importsconf/ImportsPreferencesPage.java b/plugins/org.python.pydev/src/org/python/pydev/ui/importsconf/ImportsPreferencesPage.java index 06e5814a94..7a5df07a06 100644 --- a/plugins/org.python.pydev/src/org/python/pydev/ui/importsconf/ImportsPreferencesPage.java +++ b/plugins/org.python.pydev/src/org/python/pydev/ui/importsconf/ImportsPreferencesPage.java @@ -156,7 +156,7 @@ public void widgetDefaultSelected(SelectionEvent e) { } })); - addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this)); + addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER, this)); } private void updateEnablement(Composite p, String importEngine) { From 08c941cc1b187860bf8bdf31d0c547a5d79fac56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Thu, 6 Dec 2018 11:51:20 +0100 Subject: [PATCH 2/2] Perform all preference default initialization using the extension point. Never call initializeDefaultPreferences() directly. --- plugins/com.python.pydev.analysis/plugin.xml | 2 ++ .../src/com/python/pydev/analysis/AnalysisPlugin.java | 6 ------ .../python/pydev/analysis/mypy/MypyPrefInitializer.java | 6 ++++-- .../pydev/analysis/pylint/PyLintPrefInitializer.java | 6 ++++-- .../src/com/python/pydev/debug/DebugPlugin.java | 1 - plugins/org.python.pydev.ast/plugin.xml | 4 ++++ .../src/org/python/pydev/ast/AstPlugin.java | 4 ---- plugins/org.python.pydev.core/build.properties | 3 ++- plugins/org.python.pydev.core/plugin.xml | 9 +++++++++ .../src/org/python/pydev/core/CorePlugin.java | 5 ----- .../preferences/PyDevCorePreferencesInitializer.java | 6 ++++-- plugins/org.python.pydev.debug/plugin.xml | 4 ++++ .../debug/core/PydevDebugPreferencesInitializer.java | 4 ---- .../python/pydev/debug/model/PyVariablesPreferences.java | 6 ++++-- 14 files changed, 37 insertions(+), 29 deletions(-) create mode 100644 plugins/org.python.pydev.core/plugin.xml diff --git a/plugins/com.python.pydev.analysis/plugin.xml b/plugins/com.python.pydev.analysis/plugin.xml index 20ec66f138..f069ba0b65 100644 --- a/plugins/com.python.pydev.analysis/plugin.xml +++ b/plugins/com.python.pydev.analysis/plugin.xml @@ -12,7 +12,9 @@ + + diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPlugin.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPlugin.java index 19ba841f23..7b3146121a 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPlugin.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/AnalysisPlugin.java @@ -34,8 +34,6 @@ import org.python.pydev.shared_core.structure.Location; import com.python.pydev.analysis.additionalinfo.ReferenceSearchesLucene; -import com.python.pydev.analysis.mypy.MypyPrefInitializer; -import com.python.pydev.analysis.pylint.PyLintPrefInitializer; /** * The main plugin class to be used in the desktop. @@ -62,10 +60,6 @@ public AnalysisPlugin() { public void start(BundleContext context) throws Exception { super.start(context); - // As it starts things in the org.python.pydev node for backward-compatibility, we must - // initialize it now. - PyLintPrefInitializer.initializeDefaultPreferences(); - MypyPrefInitializer.initializeDefaultPreferences(); stateLocation = AnalysisPlugin.getDefault().getStateLocation(); // Leaving code around to know when we get to the PyDev perspective in the active window (may be diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/mypy/MypyPrefInitializer.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/mypy/MypyPrefInitializer.java index 09df7eb359..7fa9e81dab 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/mypy/MypyPrefInitializer.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/mypy/MypyPrefInitializer.java @@ -6,13 +6,15 @@ */ package com.python.pydev.analysis.mypy; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.DefaultScope; import org.osgi.service.prefs.Preferences; import org.python.pydev.shared_core.SharedCorePlugin; -public class MypyPrefInitializer { +public class MypyPrefInitializer extends AbstractPreferenceInitializer { - public static void initializeDefaultPreferences() { + @Override + public void initializeDefaultPreferences() { Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); node.put(MypyPreferences.MYPY_FILE_LOCATION, ""); diff --git a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pylint/PyLintPrefInitializer.java b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pylint/PyLintPrefInitializer.java index 0597a9a1ed..32bea80b77 100644 --- a/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pylint/PyLintPrefInitializer.java +++ b/plugins/com.python.pydev.analysis/src/com/python/pydev/analysis/pylint/PyLintPrefInitializer.java @@ -9,13 +9,15 @@ */ package com.python.pydev.analysis.pylint; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.DefaultScope; import org.osgi.service.prefs.Preferences; import org.python.pydev.shared_core.SharedCorePlugin; -public class PyLintPrefInitializer { +public class PyLintPrefInitializer extends AbstractPreferenceInitializer { - public static void initializeDefaultPreferences() { + @Override + public void initializeDefaultPreferences() { Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); node.put(PyLintPreferences.PYLINT_FILE_LOCATION, ""); diff --git a/plugins/com.python.pydev.debug/src/com/python/pydev/debug/DebugPlugin.java b/plugins/com.python.pydev.debug/src/com/python/pydev/debug/DebugPlugin.java index 94b8895dac..7b386646ba 100644 --- a/plugins/com.python.pydev.debug/src/com/python/pydev/debug/DebugPlugin.java +++ b/plugins/com.python.pydev.debug/src/com/python/pydev/debug/DebugPlugin.java @@ -31,7 +31,6 @@ public DebugPlugin() { @Override public void start(BundleContext context) throws Exception { super.start(context); - new DebugPluginPrefsInitializer().initializeDefaultPreferences(); } /** diff --git a/plugins/org.python.pydev.ast/plugin.xml b/plugins/org.python.pydev.ast/plugin.xml index d688f675bd..f7adfed331 100644 --- a/plugins/org.python.pydev.ast/plugin.xml +++ b/plugins/org.python.pydev.ast/plugin.xml @@ -35,5 +35,9 @@ + + + diff --git a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/AstPlugin.java b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/AstPlugin.java index 6422b95b00..97eda23e1a 100644 --- a/plugins/org.python.pydev.ast/src/org/python/pydev/ast/AstPlugin.java +++ b/plugins/org.python.pydev.ast/src/org/python/pydev/ast/AstPlugin.java @@ -11,7 +11,6 @@ import org.eclipse.core.runtime.Plugin; import org.osgi.framework.BundleContext; -import org.python.pydev.ast.codecompletion.PyCodeCompletionInitializer; /** * The main plugin class to be used in the desktop. @@ -41,9 +40,6 @@ public AstPlugin() { @Override public void start(BundleContext context) throws Exception { super.start(context); - // Just called to initialize org.python.pydev.ast.codecompletion.PyCodeCompletionInitializer - // because we're actually initializing things in the "org.python.pydev" node. - new PyCodeCompletionInitializer().initializeDefaultPreferences(); } /** diff --git a/plugins/org.python.pydev.core/build.properties b/plugins/org.python.pydev.core/build.properties index f190bd3f92..0459a1e06f 100644 --- a/plugins/org.python.pydev.core/build.properties +++ b/plugins/org.python.pydev.core/build.properties @@ -4,7 +4,8 @@ bin.includes = META-INF/,\ core.jar,\ LICENSE.txt,\ pysrc/,\ - helpers/ + helpers/,\ + plugin.xml jars.compile.order = core.jar bin.excludes = pysrc/__pycache__/,\ pysrc/*$py.class,\ diff --git a/plugins/org.python.pydev.core/plugin.xml b/plugins/org.python.pydev.core/plugin.xml new file mode 100644 index 0000000000..2c2adb2ef7 --- /dev/null +++ b/plugins/org.python.pydev.core/plugin.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/plugins/org.python.pydev.core/src/org/python/pydev/core/CorePlugin.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/CorePlugin.java index a46f1cecbf..45984269d7 100644 --- a/plugins/org.python.pydev.core/src/org/python/pydev/core/CorePlugin.java +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/CorePlugin.java @@ -24,7 +24,6 @@ import org.eclipse.core.runtime.QualifiedName; import org.osgi.framework.BundleContext; import org.python.pydev.core.log.Log; -import org.python.pydev.core.preferences.PyDevCorePreferencesInitializer; import org.python.pydev.shared_core.io.FileUtils; /** @@ -55,10 +54,6 @@ public static void setBundleInfo(ICoreBundleInfo b) { public CorePlugin() { super(); - // As it starts things in the org.python.pydev node for backward-compatibility, we must - // initialize it now. - PyDevCorePreferencesInitializer.initializeDefaultPreferences(); - plugin = this; try { resourceBundle = ResourceBundle.getBundle("org.python.pydev.core.CorePluginResources"); diff --git a/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyDevCorePreferencesInitializer.java b/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyDevCorePreferencesInitializer.java index 6c13d622fb..7e81ace5d2 100644 --- a/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyDevCorePreferencesInitializer.java +++ b/plugins/org.python.pydev.core/src/org/python/pydev/core/preferences/PyDevCorePreferencesInitializer.java @@ -1,14 +1,16 @@ package org.python.pydev.core.preferences; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.DefaultScope; import org.osgi.service.prefs.Preferences; import org.python.pydev.core.IInterpreterManager; import org.python.pydev.core.formatter.PyFormatterPreferences; import org.python.pydev.shared_core.SharedCorePlugin; -public class PyDevCorePreferencesInitializer { +public class PyDevCorePreferencesInitializer extends AbstractPreferenceInitializer { - public static void initializeDefaultPreferences() { + @Override + public void initializeDefaultPreferences() { Preferences node = DefaultScope.INSTANCE.getNode(SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_QUALIFIER); //ironpython diff --git a/plugins/org.python.pydev.debug/plugin.xml b/plugins/org.python.pydev.debug/plugin.xml index 545a4e6e24..917bc36c8f 100644 --- a/plugins/org.python.pydev.debug/plugin.xml +++ b/plugins/org.python.pydev.debug/plugin.xml @@ -1430,6 +1430,10 @@ priority="50"> + + + diff --git a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/core/PydevDebugPreferencesInitializer.java b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/core/PydevDebugPreferencesInitializer.java index 914c09bf90..2d187d7290 100644 --- a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/core/PydevDebugPreferencesInitializer.java +++ b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/core/PydevDebugPreferencesInitializer.java @@ -9,7 +9,6 @@ import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.DefaultScope; import org.osgi.service.prefs.Preferences; -import org.python.pydev.debug.model.PyVariablesPreferences; import org.python.pydev.debug.pyunit.PyUnitView; public class PydevDebugPreferencesInitializer extends AbstractPreferenceInitializer { @@ -60,9 +59,6 @@ public void initializeDefaultPreferences() { //Note: the preferences for the debug which appear in the preferences page are actually in //the PydevEditorPrefs (as we use the pydev preferences store there). - - // Delegate to the variables preferences - PyVariablesPreferences.initializeDefaultPreferences(); } } diff --git a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariablesPreferences.java b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariablesPreferences.java index 14c7ce3b7c..05a1687735 100644 --- a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariablesPreferences.java +++ b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariablesPreferences.java @@ -11,12 +11,13 @@ ******************************************************************************/ package org.python.pydev.debug.model; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.IPropertyChangeListener; import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.shared_core.SharedCorePlugin; -public class PyVariablesPreferences { +public class PyVariablesPreferences extends AbstractPreferenceInitializer { public static final String DEBUG_UI_VARIABLES_SHOW_PRIVATE_REFERENCES = "DEBUG_UI_VARIABLES_SHOW_PRIVATE_REFERENCES"; public static final boolean DEBUG_UI_VARIABLES_DEFAULT_SHOW_PRIVATE_REFERENCES = true; @@ -93,7 +94,8 @@ public static void setShowFunctionAndModuleReferences(boolean value) { setHelper(PyVariablesPreferences.DEBUG_UI_VARIABLES_SHOW_FUNCTION_AND_MODULE_REFERENCES, value); } - public static void initializeDefaultPreferences() { + @Override + public void initializeDefaultPreferences() { setDefaultHelper(PyVariablesPreferences.DEBUG_UI_VARIABLES_SHOW_PRIVATE_REFERENCES, PyVariablesPreferences.DEBUG_UI_VARIABLES_DEFAULT_SHOW_PRIVATE_REFERENCES); setDefaultHelper(PyVariablesPreferences.DEBUG_UI_VARIABLES_SHOW_CAPITALIZED_REFERENCES,