List of usage examples for org.eclipse.jface.preference PreferenceConverter putValue
public static void putValue(IPreferenceStore store, String name, FontData[] value)
From source file:org.eclipse.wst.jsdt.internal.ui.JavaScriptPlugin.java
License:Open Source License
/** * Installs backwards compatibility for the preference store. *//* www . ja va 2 s .c o m*/ private void ensurePreferenceStoreBackwardsCompatibility() { IPreferenceStore store = getPreferenceStore(); // must add here to guarantee that it is the first in the listener list fMembersOrderPreferenceCache = new MembersOrderPreferenceCache(); fMembersOrderPreferenceCache.install(store); /* * Installs backwards compatibility: propagate the Java editor font from a * pre-2.1 plug-in to the Platform UI's preference store to preserve * the Java editor font from a pre-2.1 workspace. This is done only * once. */ String fontPropagatedKey = "fontPropagated"; //$NON-NLS-1$ if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) { if (!store.getBoolean(fontPropagatedKey)) PreferenceConverter.setValue(getDeprecatedWorkbenchPreferenceStore(), PreferenceConstants.EDITOR_TEXT_FONT, PreferenceConverter.getFontDataArray(store, JFaceResources.TEXT_FONT)); } store.setValue(fontPropagatedKey, true); /* * Backwards compatibility: set the Java editor font in this plug-in's * preference store to let older versions access it. Since 2.1 the * Java editor font is managed by the workbench font preference page. */ PreferenceConverter.putValue(store, JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); fFontPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (PreferenceConstants.EDITOR_TEXT_FONT.equals(event.getProperty())) PreferenceConverter.putValue(getPreferenceStore(), JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); } }; JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); /* * Backwards compatibility: propagate the Java editor tab width from a * pre-3.0 plug-in to the new preference key. This is done only once. */ final String oldTabWidthKey = DEPRECATED_EDITOR_TAB_WIDTH; final String newTabWidthKey = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH; String tabWidthPropagatedKey = "tabWidthPropagated"; //$NON-NLS-1$ if (store.contains(oldTabWidthKey) && !store.isDefault(oldTabWidthKey)) { if (!store.getBoolean(tabWidthPropagatedKey)) store.setValue(newTabWidthKey, store.getInt(oldTabWidthKey)); } store.setValue(tabWidthPropagatedKey, true); /* * Backwards compatibility: set the Java editor tab width in this plug-in's * preference store with the old key to let older versions access it. * Since 3.0 the tab width is managed by the extended text editor and * uses a new key. */ store.putValue(oldTabWidthKey, store.getString(newTabWidthKey)); fPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (newTabWidthKey.equals(event.getProperty())) { IPreferenceStore prefStore = getPreferenceStore(); prefStore.putValue(oldTabWidthKey, prefStore.getString(newTabWidthKey)); } } }; store.addPropertyChangeListener(fPropertyChangeListener); /* * Backward compatibility for the refactoring preference key. */ // store.setValue( // PreferenceConstants.REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD, // RefactoringCore.getConditionCheckingFailedSeverity()); // The commented call above triggers the eager loading of the LTK core plug-in // Since the condition checking failed severity is guaranteed to be of RefactoringStatus.SEVERITY_WARNING, // we directly insert the inlined value of this constant store.setToDefault(DEPRECATED_REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD); if (!store.getBoolean(JavaDocLocations.PREF_JAVADOCLOCATIONS_MIGRATED)) { JavaDocLocations.migrateToClasspathAttributes(); } FormatterProfileStore.checkCurrentOptionsVersion(); /* * Backward compatibility: migrate "alphabetic ordering" preference to point the sorter * preference to the alphabetic sorter. */ String proposalOrderMigrated = "proposalOrderMigrated"; //$NON-NLS-1$ if (store.contains(DEPRECATED_CODEASSIST_ORDER_PROPOSALS)) { if (!store.getBoolean(proposalOrderMigrated)) { boolean alphabetic = store.getBoolean(DEPRECATED_CODEASSIST_ORDER_PROPOSALS); if (alphabetic) store.setValue(PreferenceConstants.CODEASSIST_SORTER, "org.eclipse.wst.jsdt.ui.AlphabeticSorter"); //$NON-NLS-1$ } } store.setValue(proposalOrderMigrated, true); }
From source file:org.summer.sdt.internal.ui.JavaPlugin.java
License:Open Source License
/** * Installs backwards compatibility for the preference store. *//* w w w. j a v a 2 s . c om*/ private void ensurePreferenceStoreBackwardsCompatibility() { IPreferenceStore store = getPreferenceStore(); // must add here to guarantee that it is the first in the listener list fMembersOrderPreferenceCache = new MembersOrderPreferenceCache(); fMembersOrderPreferenceCache.install(store); /* * Installs backwards compatibility: propagate the Java editor font from a * pre-2.1 plug-in to the Platform UI's preference store to preserve * the Java editor font from a pre-2.1 workspace. This is done only * once. */ String fontPropagatedKey = "fontPropagated"; //$NON-NLS-1$ if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) { if (!store.getBoolean(fontPropagatedKey)) PreferenceConverter.setValue(getDeprecatedWorkbenchPreferenceStore(), PreferenceConstants.EDITOR_TEXT_FONT, PreferenceConverter.getFontDataArray(store, JFaceResources.TEXT_FONT)); } store.setValue(fontPropagatedKey, true); /* * Backwards compatibility: set the Java editor font in this plug-in's * preference store to let older versions access it. Since 2.1 the * Java editor font is managed by the workbench font preference page. */ PreferenceConverter.putValue(store, JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); fFontPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (PreferenceConstants.EDITOR_TEXT_FONT.equals(event.getProperty())) PreferenceConverter.putValue(getPreferenceStore(), JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); } }; JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); /* * Backwards compatibility: propagate the Java editor tab width from a * pre-3.0 plug-in to the new preference key. This is done only once. */ final String oldTabWidthKey = DEPRECATED_EDITOR_TAB_WIDTH; final String newTabWidthKey = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH; String tabWidthPropagatedKey = "tabWidthPropagated"; //$NON-NLS-1$ if (store.contains(oldTabWidthKey) && !store.isDefault(oldTabWidthKey)) { if (!store.getBoolean(tabWidthPropagatedKey)) store.setValue(newTabWidthKey, store.getInt(oldTabWidthKey)); } store.setValue(tabWidthPropagatedKey, true); /* * Backwards compatibility: set the Java editor tab width in this plug-in's * preference store with the old key to let older versions access it. * Since 3.0 the tab width is managed by the extended text editor and * uses a new key. */ store.putValue(oldTabWidthKey, store.getString(newTabWidthKey)); fPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (newTabWidthKey.equals(event.getProperty())) { IPreferenceStore prefStore = getPreferenceStore(); prefStore.putValue(oldTabWidthKey, prefStore.getString(newTabWidthKey)); } } }; store.addPropertyChangeListener(fPropertyChangeListener); /* * Backward compatibility for the refactoring preference key. */ // store.setValue( // PreferenceConstants.REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD, // RefactoringCore.getConditionCheckingFailedSeverity()); // The commented call above triggers the eager loading of the LTK core plug-in // Since the condition checking failed severity is guaranteed to be of RefactoringStatus.SEVERITY_WARNING, // we directly insert the inlined value of this constant store.setToDefault(DEPRECATED_REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD); if (!store.getBoolean(JavaDocLocations.PREF_JAVADOCLOCATIONS_MIGRATED)) { JavaDocLocations.migrateToClasspathAttributes(); } FormatterProfileStore.checkCurrentOptionsVersion(); /* * Backward compatibility: migrate "alphabetic ordering" preference to point the sorter * preference to the alphabetic sorter. */ String proposalOrderMigrated = "proposalOrderMigrated"; //$NON-NLS-1$ if (store.contains(DEPRECATED_CODEASSIST_ORDER_PROPOSALS)) { if (!store.getBoolean(proposalOrderMigrated)) { boolean alphabetic = store.getBoolean(DEPRECATED_CODEASSIST_ORDER_PROPOSALS); if (alphabetic) store.setValue(PreferenceConstants.CODEASSIST_SORTER, "org.summer.sdt.ui.AlphabeticSorter"); //$NON-NLS-1$ } } store.setValue(proposalOrderMigrated, true); }
From source file:patch.org.eclipse.jdt.internal.ui.JavaPlugin.java
License:Open Source License
/** * Installs backwards compatibility for the preference store. *//*from w w w.ja v a2 s. c o m*/ private void ensurePreferenceStoreBackwardsCompatibility() { IPreferenceStore store = getPreferenceStore(); // must add here to guarantee that it is the first in the listener list fMembersOrderPreferenceCache = new MembersOrderPreferenceCache(); fMembersOrderPreferenceCache.install(store); /* * Installs backwards compatibility: propagate the Java editor font from a * pre-2.1 plug-in to the Platform UI's preference store to preserve * the Java editor font from a pre-2.1 workspace. This is done only * once. */ String fontPropagatedKey = "fontPropagated"; //$NON-NLS-1$ if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) { if (!store.getBoolean(fontPropagatedKey)) PreferenceConverter.setValue(getDeprecatedWorkbenchPreferenceStore(), PreferenceConstants.EDITOR_TEXT_FONT, PreferenceConverter.getFontDataArray(store, JFaceResources.TEXT_FONT)); } store.setValue(fontPropagatedKey, true); /* * Backwards compatibility: set the Java editor font in this plug-in's * preference store to let older versions access it. Since 2.1 the * Java editor font is managed by the workbench font preference page. */ PreferenceConverter.putValue(store, JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); fFontPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (PreferenceConstants.EDITOR_TEXT_FONT.equals(event.getProperty())) PreferenceConverter.putValue(getPreferenceStore(), JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); } }; JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); /* * Backwards compatibility: propagate the Java editor tab width from a * pre-3.0 plug-in to the new preference key. This is done only once. */ final String oldTabWidthKey = DEPRECATED_EDITOR_TAB_WIDTH; final String newTabWidthKey = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH; String tabWidthPropagatedKey = "tabWidthPropagated"; //$NON-NLS-1$ if (store.contains(oldTabWidthKey) && !store.isDefault(oldTabWidthKey)) { if (!store.getBoolean(tabWidthPropagatedKey)) store.setValue(newTabWidthKey, store.getInt(oldTabWidthKey)); } store.setValue(tabWidthPropagatedKey, true); /* * Backwards compatibility: set the Java editor tab width in this plug-in's * preference store with the old key to let older versions access it. * Since 3.0 the tab width is managed by the extended text editor and * uses a new key. */ store.putValue(oldTabWidthKey, store.getString(newTabWidthKey)); fPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (newTabWidthKey.equals(event.getProperty())) { IPreferenceStore prefStore = getPreferenceStore(); prefStore.putValue(oldTabWidthKey, prefStore.getString(newTabWidthKey)); } } }; store.addPropertyChangeListener(fPropertyChangeListener); /* * Backward compatibility for the refactoring preference key. */ // store.setValue( // PreferenceConstants.REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD, // RefactoringCore.getConditionCheckingFailedSeverity()); // The commented call above triggers the eager loading of the LTK core plug-in // Since the condition checking failed severity is guaranteed to be of RefactoringStatus.SEVERITY_WARNING, // we directly insert the inlined value of this constant store.setToDefault(DEPRECATED_REFACTOR_ERROR_PAGE_SEVERITY_THRESHOLD); if (!store.getBoolean(JavaDocLocations.PREF_JAVADOCLOCATIONS_MIGRATED)) { JavaDocLocations.migrateToClasspathAttributes(); } FormatterProfileStore.checkCurrentOptionsVersion(); /* * Backward compatibility: migrate "alphabetic ordering" preference to point the sorter * preference to the alphabetic sorter. */ String proposalOrderMigrated = "proposalOrderMigrated"; //$NON-NLS-1$ if (store.contains(DEPRECATED_CODEASSIST_ORDER_PROPOSALS)) { if (!store.getBoolean(proposalOrderMigrated)) { boolean alphabetic = store.getBoolean(DEPRECATED_CODEASSIST_ORDER_PROPOSALS); if (alphabetic) store.setValue(PreferenceConstants.CODEASSIST_SORTER, "org.eclipse.jdt.ui.AlphabeticSorter"); //$NON-NLS-1$ } } store.setValue(proposalOrderMigrated, true); }