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

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

Introduction

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

Prototype

void firePropertyChangeEvent(String name, Object oldValue, Object newValue);

Source Link

Document

Fires a property change event corresponding to a change to the current value of the preference with the given name.

Usage

From source file:ca.mcgill.cs.swevo.qualyzer.editors.RTFEditor.java

License:Open Source License

/**
 * Propagates a change in the font preference to the editor preference store.
 *//*from w  w w .  j av  a2  s . co m*/
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (e == null || e.getProperty().equals(IQualyzerPreferenceConstants.FONT)) {
        IPreferenceStore pref = getPreferenceStore();
        FontData oldFont = PreferenceConverter.getFontData(pref, JFaceResources.TEXT_FONT);
        FontData font = PreferenceConverter.getFontData(QualyzerActivator.getDefault().getPreferenceStore(),
                IQualyzerPreferenceConstants.FONT);
        PreferenceConverter.setValue(pref, JFaceResources.TEXT_FONT, font);
        pref.firePropertyChangeEvent(JFaceResources.TEXT_FONT, oldFont, font);
    } else {
        super.propertyChange(e);
    }
}

From source file:com.aptana.ide.core.ui.ColorPair.java

License:Open Source License

/**
 * Sets the current value of the preference with the given name in the given preference store.
 * // www.java 2s .c  o m
 * @param store
 *            the preference store
 * @param name
 *            the name of the preference
 * @param value
 *            the new current value of the preference
 */
public static void setValue(IPreferenceStore store, String name, ColorPair value) {
    ColorPair oldValue = getColorPair(store, name);
    if (oldValue == null || !oldValue.equals(value)) {
        store.putValue(name, ColorPair.asString(value));
        store.firePropertyChangeEvent(name, oldValue, value);
    }
}

From source file:com.cisco.yangide.editor.editors.SemanticHighlightings.java

License:Open Source License

/**
 * Sets the default value and fires a property change event if necessary.
 *///from w  ww  . ja  va  2 s  .com
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
    RGB oldValue = null;
    if (store.isDefault(key)) {
        oldValue = PreferenceConverter.getDefaultColor(store, key);
    }

    PreferenceConverter.setDefault(store, key, newValue);

    if (oldValue != null && !oldValue.equals(newValue)) {
        store.firePropertyChangeEvent(key, oldValue, newValue);
    }
}

From source file:com.dubture.twig.ui.editor.SemanticHighlightingManager.java

License:Open Source License

/**
 * Sets the default value and fires a property change event if necessary.
 * /* w  w w.  ja va  2s .  co  m*/
 * @param store
 *            the preference store
 * @param key
 *            the preference key
 * @param newValue
 *            the new value
 */
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
    RGB oldValue = null;
    if (store.isDefault(key))
        oldValue = PreferenceConverter.getDefaultColor(store, key);

    PreferenceConverter.setDefault(store, key, newValue);
    store.setDefault(key, ColorHelper.toRGBString(newValue));

    if (oldValue != null && !oldValue.equals(newValue))
        store.firePropertyChangeEvent(key, oldValue, newValue);
}

From source file:com.google.dart.tools.ui.PreferenceConstants.java

License:Open Source License

/**
 * Sets the default value and fires a property change event if necessary.
 * /*from ww  w  . ja  va2  s  .c  o m*/
 * @param store the preference store
 * @param key the preference key
 * @param newValue the new value
 */
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
    try {
        RGB oldValue = null;
        if (store.isDefault(key)) {
            oldValue = PreferenceConverter.getDefaultColor(store, key);
        }

        PreferenceConverter.setDefault(store, key, newValue);

        if (oldValue != null && !oldValue.equals(newValue)) {
            store.firePropertyChangeEvent(key, oldValue, newValue);
        }
    } catch (Throwable exception) {
        DartToolsPlugin.log("INFO: Could not get the default value for the color preference named " + key,
                exception);
    }
}

From source file:com.imperial.fiksen.codesimilarity.compare.ParseTreeMergeViewer.java

License:Open Source License

private void handleEndOfDocumentReached(Shell shell, boolean next) {
    IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
    String value = store.getString(ICompareUIConstants.PREF_NAVIGATION_END_ACTION);
    if (!value.equals(ICompareUIConstants.PREF_VALUE_PROMPT)) {
        performEndOfDocumentAction(shell, store, ICompareUIConstants.PREF_NAVIGATION_END_ACTION, next);
    } else {//from   w  w w .j  av a 2 s .c o m
        shell.getDisplay().beep();
        String loopMessage;
        String nextMessage;
        String message;
        String title;
        if (next) {
            title = CompareMessages.TextMergeViewer_0;
            message = CompareMessages.TextMergeViewer_1;
            loopMessage = CompareMessages.TextMergeViewer_2;
            nextMessage = CompareMessages.TextMergeViewer_3;
        } else {
            title = CompareMessages.TextMergeViewer_4;
            message = CompareMessages.TextMergeViewer_5;
            loopMessage = CompareMessages.TextMergeViewer_6;
            nextMessage = CompareMessages.TextMergeViewer_7;
        }
        String[] localLoopOption = new String[] { loopMessage, ICompareUIConstants.PREF_VALUE_LOOP };
        String[] nextElementOption = new String[] { nextMessage, ICompareUIConstants.PREF_VALUE_NEXT };
        String[] doNothingOption = new String[] { CompareMessages.TextMergeViewer_17,
                ICompareUIConstants.PREF_VALUE_DO_NOTHING };
        NavigationEndDialog dialog = new NavigationEndDialog(shell, title, null, message,
                new String[][] { localLoopOption, nextElementOption, doNothingOption });
        int result = dialog.open();
        if (result == Window.OK) {
            performEndOfDocumentAction(shell, store, ICompareUIConstants.PREF_NAVIGATION_END_ACTION_LOCAL,
                    next);
            if (dialog.getToggleState()) {
                String oldValue = store.getString(ICompareUIConstants.PREF_NAVIGATION_END_ACTION);
                store.putValue(ICompareUIConstants.PREF_NAVIGATION_END_ACTION,
                        store.getString(ICompareUIConstants.PREF_NAVIGATION_END_ACTION_LOCAL));
                store.firePropertyChangeEvent(ICompareUIConstants.PREF_NAVIGATION_END_ACTION, oldValue,
                        store.getString(ICompareUIConstants.PREF_NAVIGATION_END_ACTION_LOCAL));
            }
        }
    }
}

From source file:cz.vutbr.fit.xhriba01.bc.jdt.ui.javaeditor.SemanticHighlightings.java

License:Open Source License

/**
 * Sets the default value and fires a property
 * change event if necessary./*from  w  ww .  ja  v  a  2 s. com*/
 *
 * @param store   the preference store
 * @param key the preference key
 * @param newValue the new value
 * @since 3.3
 */
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
    RGB oldValue = null;
    if (store.isDefault(key))
        oldValue = PreferenceConverter.getDefaultColor(store, key);

    PreferenceConverter.setDefault(store, key, newValue);

    if (oldValue != null && !oldValue.equals(newValue))
        store.firePropertyChangeEvent(key, oldValue, newValue);
}

From source file:de.loskutov.eclipseskins.preferences.SkinsPreferencePage.java

License:Open Source License

private void setValue(IPreferenceStore store, String key, int value) {
    boolean hasValue = store.contains(key);
    store.setValue(key, value);/*from w w w . j a  v a2s  .  co  m*/
    if (!hasValue) {
        Integer integer = new Integer(value);
        store.firePropertyChangeEvent(key, null, integer);
        // problems with reading 0 values - they are the same as default
        store.putValue(key, "" + value);
    }
}

From source file:edu.depaul.cdm.madl.tools.ui.PreferenceConstants.java

License:Open Source License

/**
 * Sets the default value and fires a property change event if necessary.
 * //from   w w w .  j a v  a 2  s .  co m
 * @param store the preference store
 * @param key the preference key
 * @param newValue the new value
 */
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
    try {
        RGB oldValue = null;
        if (store.isDefault(key)) {
            oldValue = PreferenceConverter.getDefaultColor(store, key);
        }

        PreferenceConverter.setDefault(store, key, newValue);

        if (oldValue != null && !oldValue.equals(newValue)) {
            store.firePropertyChangeEvent(key, oldValue, newValue);
        }
    } catch (Throwable exception) {
        /*  DartToolsPlugin.log("INFO: Could not get the default value for the color preference named "
              + key, exception);*/
    }
}

From source file:ext.org.eclipse.jdt.internal.ui.JavaUIPreferenceInitializer.java

License:Open Source License

/**
 * Sets the default value and fires a property
 * change event if necessary.//from   w  w  w .j a  v  a2  s . c  om
 *
 * @param store   the preference store
 * @param key the preference key
 * @param newValue the new value
 * @param fireEvent <code>false</code> if no event should be fired
 * @since 3.4
 */
private static void setDefault(IPreferenceStore store, String key, RGB newValue, boolean fireEvent) {
    if (!fireEvent) {
        PreferenceConverter.setDefault(store, key, newValue);
        return;
    }

    RGB oldValue = null;
    if (store.isDefault(key))
        oldValue = PreferenceConverter.getDefaultColor(store, key);

    PreferenceConverter.setDefault(store, key, newValue);

    if (oldValue != null && !oldValue.equals(newValue))
        store.firePropertyChangeEvent(key, oldValue, newValue);
}