/** * Sets the default value of the preference with the given name * in the given preference store. * * @param store the preference store * @param name the name of the preference * @param value the new default value of the preference */ public static void setDefault(IPreferenceStore store, String name, FontData[] value) { store.setDefault(name, getStoredRepresentation(value)); }
/** * Sets the default value of the preference with the given name * in the given preference store. * * @param store the preference store * @param name the name of the preference * @param value the new default value of the preference */ public static void setDefault(IPreferenceStore store, String name, FontData[] value) { store.setDefault(name, getStoredRepresentation(value)); }
/** * Sets the default value of the preference with the given name * in the given preference store. * * @param store the preference store * @param name the name of the preference * @param value the new default value of the preference */ public static void setDefault(IPreferenceStore store, String name, FontData[] value) { store.setDefault(name, getStoredRepresentation(value)); }
private boolean performFontOk() { for (Map.Entry<FontDefinition, FontData[]> entry : fontPreferencesToSet.entrySet()) { String key = createPreferenceKey(entry.getKey()); String fdString = PreferenceConverter.getStoredRepresentation(entry.getValue()); String storeString = getPreferenceStore().getString(key); if (!fdString.equals(storeString)) getPreferenceStore().setValue(key, fdString); } fontValuesToSet.clear(); fontPreferencesToSet.clear(); return true; }
/** * Sets the current value of the preference with the given name * in the given preference store. This method does not update * the font registry or fire a property change event. * * @param store the preference store * @param name the name of the preference * @param value the new current value of the preference * * @see PreferenceConverter#setValue(IPreferenceStore, String, FontData[]) */ public static void putValue(IPreferenceStore store, String name, FontData[] value) { FontData[] oldValue = getFontDataArray(store, name); // see if the font has changed if (!Arrays.equals(oldValue, value)) { store.putValue(name, getStoredRepresentation(value)); } }
/** * Sets the current value of the preference with the given name * in the given preference store. This method does not update * the font registry or fire a property change event. * * @param store the preference store * @param name the name of the preference * @param value the new current value of the preference * * @see PreferenceConverter#setValue(IPreferenceStore, String, FontData[]) */ public static void putValue(IPreferenceStore store, String name, FontData[] value) { FontData[] oldValue = getFontDataArray(store, name); // see if the font has changed if (!Arrays.equals(oldValue, value)) { store.putValue(name, getStoredRepresentation(value)); } }
/** * Sets the current value of the preference with the given name * in the given preference store. This method does not update * the font registry or fire a property change event. * * @param store the preference store * @param name the name of the preference * @param value the new current value of the preference * * @see PreferenceConverter#setValue(IPreferenceStore, String, FontData[]) */ public static void putValue(IPreferenceStore store, String name, FontData[] value) { FontData[] oldValue = getFontDataArray(store, name); // see if the font has changed if (!Arrays.equals(oldValue, value)) { store.putValue(name, getStoredRepresentation(value)); } }
/** * Sets the current value of the preference with the given name * in the given preference store. This method also sets the corresponding * key in the JFace font registry to the value and fires a * property change event to listeners on the preference store. * * <p> * Note that this API does not update any other settings that may * be dependant upon it. Only the value in the preference store * and in the font registry is updated. * </p> * @param store the preference store * @param name the name of the preference * @param value the new current value of the preference * * @see #putValue(IPreferenceStore, String, FontData[]) */ public static void setValue(IPreferenceStore store, String name, FontData[] value) { FontData[] oldValue = getFontDataArray(store, name); // see if the font has changed if (!Arrays.equals(oldValue, value)) { store.putValue(name, getStoredRepresentation(value)); JFaceResources.getFontRegistry().put(name, value); store.firePropertyChangeEvent(name, oldValue, value); } }
/** * Sets the current value of the preference with the given name * in the given preference store. This method also sets the corresponding * key in the JFace font registry to the value and fires a * property change event to listeners on the preference store. * * <p> * Note that this API does not update any other settings that may * be dependant upon it. Only the value in the preference store * and in the font registry is updated. * </p> * @param store the preference store * @param name the name of the preference * @param value the new current value of the preference * * @see #putValue(IPreferenceStore, String, FontData[]) */ public static void setValue(IPreferenceStore store, String name, FontData[] value) { FontData[] oldValue = getFontDataArray(store, name); // see if the font has changed if (!Arrays.equals(oldValue, value)) { store.putValue(name, getStoredRepresentation(value)); JFaceResources.getFontRegistry().put(name, value); store.firePropertyChangeEvent(name, oldValue, value); } }
/** * Sets the current value of the preference with the given name * in the given preference store. This method also sets the corresponding * key in the JFace font registry to the value and fires a * property change event to listeners on the preference store. * * <p> * Note that this API does not update any other settings that may * be dependant upon it. Only the value in the preference store * and in the font registry is updated. * </p> * @param store the preference store * @param name the name of the preference * @param value the new current value of the preference * * @see #putValue(IPreferenceStore, String, FontData[]) */ public static void setValue(IPreferenceStore store, String name, FontData[] value) { FontData[] oldValue = getFontDataArray(store, name); // see if the font has changed if (!Arrays.equals(oldValue, value)) { store.putValue(name, getStoredRepresentation(value)); JFaceResources.getFontRegistry().put(name, value); store.firePropertyChangeEvent(name, oldValue, value); } }
public static Font fontFromFontData(FontData[] fontDataArray) { if (fontDataArray != null && fontDataArray.length > 0) { String fontData = PreferenceConverter.getStoredRepresentation(fontDataArray); if (!JFaceResources.getFontRegistry().hasValueFor(fontData)) { FontData[] fData = PreferenceConverter.basicGetFontData(fontData); JFaceResources.getFontRegistry().put(fontData, fData); } Font font = JFaceResources.getFontRegistry().get(fontData); return font; } return null; }
@Override public void runWithException() { FontDefinition[] fontDefinitions = WorkbenchPlugin.getDefault().getThemeRegistry() .getFonts(); ThemeElementHelper.populateRegistry(getThemeManager().getCurrentTheme(), fontDefinitions, PrefUtil.getInternalPreferenceStore()); final IPropertyChangeListener themeToPreferencesFontSynchronizer = event -> { if (event.getNewValue() instanceof FontData[]) { FontData[] fontData = (FontData[]) event.getNewValue(); PrefUtil.getInternalPreferenceStore().setValue(event.getProperty(), PreferenceConverter.getStoredRepresentation(fontData)); } }; getThemeManager().getCurrentTheme().getFontRegistry().addListener(themeToPreferencesFontSynchronizer); getThemeManager().addPropertyChangeListener(event -> { if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty())) { Object oldValue = event.getOldValue(); if (oldValue != null && oldValue instanceof ITheme) { ((ITheme) oldValue).removePropertyChangeListener(themeToPreferencesFontSynchronizer); } Object newValue = event.getNewValue(); if (newValue != null && newValue instanceof ITheme) { ((ITheme) newValue).addPropertyChangeListener(themeToPreferencesFontSynchronizer); } } }); } });