Example usage for org.eclipse.jface.preference IPreferenceStore isDefault

List of usage examples for org.eclipse.jface.preference IPreferenceStore isDefault

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore isDefault.

Prototype

boolean isDefault(String name);

Source Link

Document

Returns whether the current value of the preference with the given name has the default value.

Usage

From source file:org.eclipse.mylyn.reviews.r4e.ui.internal.utils.UIUtils.java

License:Open Source License

/**
 * Method removeAnnotation// w ww  .ja  v  a2 s  . co  m
 * 
 * @param aStore
 *            - IPreferenceStore
 * @param aPref
 *            - AnnotationPreference
 * @return RGB
 */
public static RGB getColorFromAnnotationPreference(IPreferenceStore aStore, AnnotationPreference aPref) {
    String key = aPref.getColorPreferenceKey();
    RGB rgb = null;
    if (aStore.contains(key)) {
        if (aStore.isDefault(key)) {
            rgb = aPref.getColorPreferenceValue();
        } else {
            rgb = PreferenceConverter.getColor(aStore, key);
        }
    }
    if (rgb == null) {
        rgb = aPref.getColorPreferenceValue();
    }
    return rgb;
}

From source file:org.eclipse.team.internal.ccvs.ui.CVSUIPlugin.java

License:Open Source License

/**
 * Initializes the preferences for this plugin if necessary.
 *//*w  w  w.  j a  v a2  s . c  om*/
protected void initializeDefaultPluginPreferences() {
    IPreferenceStore store = getPreferenceStore();
    // Get the plugin preferences for CVS Core
    Preferences corePrefs = CVSProviderPlugin.getPlugin().getPluginPreferences();

    store.setDefault(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY, false);
    store.setDefault(ICVSUIConstants.PREF_SHOW_COMMENTS, true);
    store.setDefault(ICVSUIConstants.PREF_WRAP_COMMENTS, true);
    store.setDefault(ICVSUIConstants.PREF_SHOW_TAGS, true);
    store.setDefault(ICVSUIConstants.PREF_SHOW_SEARCH, false);
    store.setDefault(ICVSUIConstants.PREF_REVISION_MODE, 0);
    store.setDefault(ICVSUIConstants.PREF_GROUPBYDATE_MODE, true);
    store.setDefault(ICVSUIConstants.PREF_HISTORY_VIEW_EDITOR_LINKING, false);
    store.setDefault(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, CVSProviderPlugin.DEFAULT_PRUNE);
    store.setDefault(ICVSUIConstants.PREF_TIMEOUT, CVSProviderPlugin.DEFAULT_TIMEOUT);
    store.setDefault(ICVSUIConstants.PREF_CONSIDER_CONTENTS, true);
    store.setDefault(ICVSUIConstants.PREF_SYNCVIEW_REGEX_FILTER_PATTERN, ""); //default pattern is empty string //$NON-NLS-1$      
    store.setDefault(ICVSUIConstants.PREF_COMPRESSION_LEVEL, CVSProviderPlugin.DEFAULT_COMPRESSION_LEVEL);
    store.setDefault(ICVSUIConstants.PREF_TEXT_KSUBST, CVSProviderPlugin.DEFAULT_TEXT_KSUBST_OPTION.toMode());
    store.setDefault(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND, true);
    store.setDefault(ICVSUIConstants.PREF_REPLACE_UNMANAGED, true);
    store.setDefault(ICVSUIConstants.PREF_CVS_RSH, CVSProviderPlugin.DEFAULT_CVS_RSH);
    store.setDefault(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS, CVSProviderPlugin.DEFAULT_CVS_RSH_PARAMETERS);
    store.setDefault(ICVSUIConstants.PREF_CVS_SERVER, CVSProviderPlugin.DEFAULT_CVS_SERVER);
    store.setDefault(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY, "ext"); //$NON-NLS-1$
    store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_CHANGE_GRANULARITY, true);
    store.setDefault(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION, true);
    store.setDefault(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, CVSProviderPlugin.DEFAULT_CONFIRM_MOVE_TAG);
    store.setDefault(ICVSUIConstants.PREF_DEBUG_PROTOCOL, false);
    store.setDefault(ICVSUIConstants.PREF_WARN_REMEMBERING_MERGES, true);
    store.setDefault(ICVSUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG, false);
    store.setDefault(ICVSUIConstants.PREF_COMMIT_SET_DEFAULT_ENABLEMENT, false);
    store.setDefault(ICVSUIConstants.PREF_AUTO_REFRESH_TAGS_IN_TAG_SELECTION_DIALOG, false);
    store.setDefault(ICVSUIConstants.PREF_AUTO_SHARE_ON_IMPORT, true);
    store.setDefault(ICVSUIConstants.PREF_ENABLE_WATCH_ON_EDIT, false);
    store.setDefault(ICVSUIConstants.PREF_USE_PROJECT_NAME_ON_CHECKOUT, false);
    store.setDefault(ICVSUIConstants.PREF_COMMIT_FILES_DISPLAY_THRESHOLD, 1000);
    store.setDefault(ICVSUIConstants.PREF_COMMIT_COMMENTS_MAX_HISTORY, RepositoryManager.DEFAULT_MAX_COMMENTS);

    PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR, new RGB(0, 0, 0));
    PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR, new RGB(0, 0, 255));
    PreferenceConverter.setDefault(store, ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR, new RGB(255, 0, 0));
    store.setDefault(ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE, false);
    store.setDefault(ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT, true);
    store.setDefault(ICVSUIConstants.PREF_CONSOLE_HIGH_WATER_MARK, 500000);
    store.setDefault(ICVSUIConstants.PREF_CONSOLE_WRAP, false);
    store.setDefault(ICVSUIConstants.PREF_CONSOLE_WIDTH, 80);

    store.setDefault(ICVSUIConstants.PREF_FILETEXT_DECORATION,
            CVSDecoratorConfiguration.DEFAULT_FILETEXTFORMAT);
    store.setDefault(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION,
            CVSDecoratorConfiguration.DEFAULT_FOLDERTEXTFORMAT);
    store.setDefault(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION,
            CVSDecoratorConfiguration.DEFAULT_PROJECTTEXTFORMAT);

    store.setDefault(ICVSUIConstants.PREF_FIRST_STARTUP, true);
    store.setDefault(ICVSUIConstants.PREF_ADDED_FLAG, CVSDecoratorConfiguration.DEFAULT_ADDED_FLAG);
    store.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, CVSDecoratorConfiguration.DEFAULT_DIRTY_FLAG);
    store.setDefault(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, true);
    store.setDefault(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, true);
    store.setDefault(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, false);
    store.setDefault(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, true);
    store.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
    store.setDefault(ICVSUIConstants.PREF_USE_FONT_DECORATORS, false);
    store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, true);
    store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, true);
    store.setDefault(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, ICVSUIConstants.OPTION_PROMPT);

    store.setDefault(ICVSUIConstants.PREF_ANNOTATE_PROMPTFORBINARY, MessageDialogWithToggle.PROMPT);
    store.setDefault(ICVSUIConstants.PREF_ALLOW_EMPTY_COMMIT_COMMENTS, MessageDialogWithToggle.PROMPT);
    store.setDefault(ICVSUIConstants.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT, MessageDialogWithToggle.NEVER);
    store.setDefault(ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS, MessageDialogWithToggle.ALWAYS);
    store.setDefault(ICVSUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS, MessageDialogWithToggle.PROMPT);

    store.setDefault(ICVSUIConstants.PREF_UPDATE_HANDLING, ICVSUIConstants.PREF_UPDATE_HANDLING_TRADITIONAL);
    store.setDefault(ICVSUIConstants.PREF_UPDATE_PREVIEW, ICVSUIConstants.PREF_UPDATE_PREVIEW_IN_SYNCVIEW);

    store.setDefault(ICVSUIConstants.PREF_ENABLE_MODEL_SYNC, true);
    store.setDefault(ICVSUIConstants.PREF_OPEN_COMPARE_EDITOR_FOR_SINGLE_FILE, true);

    // Set the watch/edit preferences defaults and values
    store.setDefault(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY,
            corePrefs.getDefaultBoolean(CVSProviderPlugin.READ_ONLY));
    store.setDefault(ICVSUIConstants.PREF_EDIT_ACTION, ICVSUIConstants.PREF_EDIT_IN_BACKGROUND);
    store.setDefault(ICVSUIConstants.PREF_EDIT_PROMPT, ICVSUIConstants.PREF_EDIT_PROMPT_IF_EDITORS);
    store.setDefault(ICVSUIConstants.PREF_UPDATE_PROMPT, ICVSUIConstants.PREF_UPDATE_PROMPT_NEVER);
    // Ensure that the preference values in UI match Core
    store.setValue(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getBoolean(CVSProviderPlugin.READ_ONLY));

    // Forward the values to the CVS plugin
    CVSProviderPlugin.getPlugin()
            .setPruneEmptyDirectories(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
    CVSProviderPlugin.getPlugin().setTimeout(store.getInt(ICVSUIConstants.PREF_TIMEOUT));
    CVSProviderPlugin.getPlugin().setCvsRshCommand(store.getString(ICVSUIConstants.PREF_CVS_RSH));
    CVSProviderPlugin.getPlugin().setCvsRshParameters(store.getString(ICVSUIConstants.PREF_CVS_RSH_PARAMETERS));
    CVSProviderPlugin.getPlugin().setCvsServer(store.getString(ICVSUIConstants.PREF_CVS_SERVER));
    CVSRepositoryLocation
            .setExtConnectionMethodProxy(store.getString(ICVSUIConstants.PREF_EXT_CONNECTION_METHOD_PROXY));
    CVSProviderPlugin.getPlugin().setQuietness(
            CVSPreferencesPage.getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
    CVSProviderPlugin.getPlugin().setCompressionLevel(store.getInt(ICVSUIConstants.PREF_COMPRESSION_LEVEL));
    CVSProviderPlugin.getPlugin().setReplaceUnmanaged(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
    CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(
            KSubstOption.fromMode(store.getString(ICVSUIConstants.PREF_TEXT_KSUBST)));
    CVSProviderPlugin.getPlugin()
            .setUsePlatformLineend(store.getBoolean(ICVSUIConstants.PREF_USE_PLATFORM_LINEEND));
    CVSProviderPlugin.getPlugin()
            .setRepositoriesAreBinary(store.getBoolean(ICVSUIConstants.PREF_REPOSITORIES_ARE_BINARY));
    CVSProviderPlugin.getPlugin()
            .setDetermineVersionEnabled(store.getBoolean(ICVSUIConstants.PREF_DETERMINE_SERVER_VERSION));
    CVSProviderPlugin.getPlugin().setDebugProtocol(CVSProviderPlugin.getPlugin().isDebugProtocol()
            || store.getBoolean(ICVSUIConstants.PREF_DEBUG_PROTOCOL));
    CVSProviderPlugin.getPlugin()
            .setAutoshareOnImport(store.getBoolean(ICVSUIConstants.PREF_AUTO_SHARE_ON_IMPORT));

    // code to transfer CVS preference to Team preference
    if (store.getBoolean(ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR)) {
        store.setValue(ICVSUIConstants.PREF_SHOW_AUTHOR_IN_EDITOR, false);
        IPreferenceStore teamStore = TeamUIPlugin.getPlugin().getPreferenceStore();
        if (teamStore.isDefault(IPreferenceIds.SHOW_AUTHOR_IN_COMPARE_EDITOR))
            teamStore.setValue(IPreferenceIds.SHOW_AUTHOR_IN_COMPARE_EDITOR, true);
    }
}

From source file:org.eclipse.team.internal.ui.TeamUIPlugin.java

License:Open Source License

/**
 * Initializes the preferences for this plugin if necessary.
 *//*ww w. j  a va 2s.  c  o  m*/
protected void initializeDefaultPluginPreferences() {
    IPreferenceStore store = getPreferenceStore();
    store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, false);
    store.setDefault(IPreferenceIds.SHOW_AUTHOR_IN_COMPARE_EDITOR, false);
    store.setDefault(IPreferenceIds.MAKE_FILE_WRITTABLE_IF_CONTEXT_MISSING, false);
    store.setDefault(IPreferenceIds.REUSE_OPEN_COMPARE_EDITOR, true);
    store.setDefault(IPreferenceIds.RUN_IMPORT_IN_BACKGROUND, false);
    store.setDefault(IPreferenceIds.APPLY_PATCH_IN_SYNCHRONIZE_VIEW, false);
    store.setDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS, true);
    store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT, IPreferenceIds.COMPRESSED_LAYOUT);
    store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, TeamSynchronizingPerspective.ID);
    store.setDefault(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT,
            GlobalRefreshAction.NO_DEFAULT_PARTICPANT);
    store.setDefault(IPreferenceIds.SYNCHRONIZING_DEFAULT_PARTICIPANT_SEC_ID,
            GlobalRefreshAction.NO_DEFAULT_PARTICPANT);
    store.setDefault(IPreferenceIds.SYNCHRONIZING_COMPLETE_PERSPECTIVE, MessageDialogWithToggle.PROMPT);
    store.setDefault(IPreferenceIds.SYNCVIEW_REMOVE_FROM_VIEW_NO_PROMPT, false);
    store.setDefault(IPreferenceIds.PREF_WORKSPACE_FIRST_TIME, true);

    // Convert the old compressed folder preference to the new layout preference
    if (!store.isDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS)
            && !store.getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS)) {
        // Set the compress folder preference to the default true) \
        // so will will ignore it in the future
        store.setToDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS);
        // Set the layout to tree (which was used when compress folder was false)
        store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT, IPreferenceIds.TREE_LAYOUT);
    }
}

From source file:org.eclipse.titan.designer.properties.pages.ProjectBuildPropertyPage.java

License:Open Source License

@Override
public boolean performOk() {
    if (!checkProperties()) {
        return false;
    }/*from  w  w  w. j av  a 2  s  . c o  m*/

    if (!saveProperties()) {
        return false;
    }

    final IPreferenceStore pluginPreferenceStore = Activator.getDefault().getPreferenceStore();
    // setting temporal variables to default for sure
    if (!pluginPreferenceStore.isDefault(MakefileCreationTab.TEMPORAL_TARGET_EXECUTABLE)) {
        pluginPreferenceStore.setToDefault(MakefileCreationTab.TEMPORAL_TARGET_EXECUTABLE);
    }
    if (!pluginPreferenceStore.isDefault(MakeAttributesTab.TEMPORAL_MAKEFILE_SCRIPT)) {
        pluginPreferenceStore.setToDefault(MakeAttributesTab.TEMPORAL_MAKEFILE_SCRIPT);
    }
    if (!pluginPreferenceStore.isDefault(MakeAttributesTab.TEMPORAL_MAKEFILE_FLAGS)) {
        pluginPreferenceStore.setToDefault(MakeAttributesTab.TEMPORAL_MAKEFILE_FLAGS);
    }
    if (!pluginPreferenceStore.isDefault(MakeAttributesTab.TEMPORAL_WORKINGDIRECTORY)) {
        pluginPreferenceStore.setToDefault(MakeAttributesTab.TEMPORAL_WORKINGDIRECTORY);
    }

    configurationManager.saveActualConfiguration();
    ProjectDocumentHandlingUtility.saveDocument(projectResource);

    TITANAutomaticProjectExporter.saveAllAutomatically(projectResource);

    evaluatePropertyStore();
    return true;
}

From source file:org.eclipse.ui.internal.themes.Theme.java

License:Open Source License

/**
 * Listener that is responsible for responding to preference changes.
 * /*from  ww  w.  ja v  a2 s.  c o  m*/
 * @return the property change listener
 */
private IPropertyChangeListener getPropertyListener() {
    if (propertyListener == null) {
        propertyListener = new IPropertyChangeListener() {

            /* (non-Javadoc)
             * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
             */
            public void propertyChange(PropertyChangeEvent event) {
                String[] split = ThemeElementHelper.splitPropertyName(Theme.this, event.getProperty());
                String key = split[1];
                String theme = split[0];
                if (key.equals(IWorkbenchPreferenceConstants.CURRENT_THEME_ID)) {
                    return;
                }
                try {
                    String thisTheme = getId();

                    if (Util.equals(thisTheme, theme)) {
                        if (getFontRegistry().hasValueFor(key)) {
                            FontData[] data = PreferenceConverter
                                    .basicGetFontData((String) event.getNewValue());

                            getFontRegistry().put(key, data);
                            processDefaultsTo(key, data);
                            return;
                        } else if (getColorRegistry().hasValueFor(key)) {
                            RGB rgb = StringConverter.asRGB((String) event.getNewValue());
                            getColorRegistry().put(key, rgb);
                            processDefaultsTo(key, rgb);
                            return;
                        }
                    }
                } catch (DataFormatException e) {
                    //no-op
                }
            }

            /**
             * Process all fonts that default to the given ID.
             * 
             * @param key the font ID
             * @param fd the new FontData for defaulted fonts
             */
            private void processDefaultsTo(String key, FontData[] fd) {
                FontDefinition[] defs = WorkbenchPlugin.getDefault().getThemeRegistry().getFontsFor(getId());
                for (int i = 0; i < defs.length; i++) {
                    String defaultsTo = defs[i].getDefaultsTo();
                    if (defaultsTo != null && defaultsTo.equals(key)) {
                        IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
                        if (store.isDefault(
                                ThemeElementHelper.createPreferenceKey(Theme.this, defs[i].getId()))) {
                            getFontRegistry().put(defs[i].getId(), fd);
                            processDefaultsTo(defs[i].getId(), fd);
                        }
                    }
                }
            }

            /**
             * Process all colors that default to the given ID.
             * 
             * @param key the color ID
             * @param rgb the new RGB value for defaulted colors
             */
            private void processDefaultsTo(String key, RGB rgb) {
                ColorDefinition[] defs = WorkbenchPlugin.getDefault().getThemeRegistry().getColorsFor(getId());
                for (int i = 0; i < defs.length; i++) {
                    String defaultsTo = defs[i].getDefaultsTo();
                    if (defaultsTo != null && defaultsTo.equals(key)) {
                        IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
                        if (store.isDefault(
                                ThemeElementHelper.createPreferenceKey(Theme.this, defs[i].getId()))) {
                            getColorRegistry().put(defs[i].getId(), rgb);
                            processDefaultsTo(defs[i].getId(), rgb);
                        }
                    }
                }
            }
        };
    }
    return propertyListener;
}

From source file:org.eclipse.ui.internal.themes.ThemeElementHelper.java

License:Open Source License

/**
 * Installs the given color in the preference store and optionally the color 
 * registry./*from w  w  w  . java2 s. co m*/
 * 
 * @param definition
 *            the color definition
 * @param theme
 *            the theme defining the color
 * @param store
 *            the preference store from which to set and obtain color data
 * @param setInRegistry
 *            whether the color should be put into the registry
 */

private static void installColor(ColorDefinition definition, ITheme theme, IPreferenceStore store,
        boolean setInRegistry) {

    //TODO: store shouldn't be null, should assert instead of checking null all over

    ColorRegistry registry = theme.getColorRegistry();

    String id = definition.getId();
    String key = createPreferenceKey(theme, id);
    RGB prefColor = store != null ? PreferenceConverter.getColor(store, key) : null;
    RGB defaultColor = (definition.getValue() != null) ? definition.getValue()
            : registry.getRGB(definition.getDefaultsTo());

    if (defaultColor == null) {
        // default is null, likely because we have a bad definition - the
        // defaultsTo color doesn't exist. We still need a sensible default,
        // however.
        defaultColor = PreferenceConverter.COLOR_DEFAULT_DEFAULT;
    }

    if (prefColor == null || prefColor == PreferenceConverter.COLOR_DEFAULT_DEFAULT) {
        prefColor = defaultColor;
    }

    //if the preference value isn't the default then retain that pref value
    RGB colorToUse = !store.isDefault(key) ? prefColor : defaultColor;

    if (setInRegistry) {
        registry.put(id, colorToUse);
    }

    if (store != null) {
        PreferenceConverter.setDefault(store, key, defaultColor);
    }
}

From source file:org.eclipse.ui.texteditor.ChainedPreferenceStore.java

License:Open Source License

public boolean isDefault(String name) {
    IPreferenceStore visibleStore = getVisibleStore(name);
    if (visibleStore != null)
        return visibleStore.isDefault(name);
    return false;
}

From source file:org.eclipse.wst.jsdt.internal.ui.JavaScriptPlugin.java

License:Open Source License

/**
 * Installs backwards compatibility for the preference store.
 *//*from w  ww  . j a 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.wst.jsdt.ui.AlphabeticSorter"); //$NON-NLS-1$
        }
    }
    store.setValue(proposalOrderMigrated, true);

}

From source file:org.eclipse.wst.sse.ui.internal.openon.OpenFileHyperlinkTracker.java

License:Open Source License

/**
 * Creates a color from the information stored in the given preference
 * store. Returns <code>null</code> if there is no such information
 * available./*  w ww. jav a 2s  .c  om*/
 */
private Color createColor(IPreferenceStore store, String key, Display display) {

    RGB rgb = null;

    if (store.contains(key)) {

        if (store.isDefault(key))
            rgb = PreferenceConverter.getDefaultColor(store, key);
        else
            rgb = PreferenceConverter.getColor(store, key);
    }

    return EditorUtility.getColor(rgb);
}

From source file:org.erlide.ui.internal.compare.ErlMergeViewer.java

License:Open Source License

/**
 * Creates a color from the information stored in the given preference
 * store. Returns <code>null</code> if there is no such information
 * available.//from   w w w . j ava 2s .c o  m
 */
private static RGB createColor(final IPreferenceStore store, final String key) {
    if (!store.contains(key)) {
        return null;
    }
    if (store.isDefault(key)) {
        return PreferenceConverter.getDefaultColor(store, key);
    }
    return PreferenceConverter.getColor(store, key);
}