Search in sources :

Example 11 with PreferenceStore

use of org.eclipse.jface.preference.PreferenceStore in project eclipse.platform.text by eclipse.

the class ChainedPreferenceStoreTest method testChainedStore2.

/**
 * Third case where the initial implementation used to have an assertion which would fail in this case
 */
@Test
public void testChainedStore2() {
    IPreferenceStore store1 = new PreferenceStore();
    IPreferenceStore store2 = new PreferenceStore();
    IPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
    store1.setValue(PROPERTY, VALUE);
    chainedStore.addPropertyChangeListener(fPropertyChangeListener);
    // simulated change with newValue == null
    store1.firePropertyChangeEvent(PROPERTY, DEFAULT_VALUE, null);
    chainedStore.removePropertyChangeListener(fPropertyChangeListener);
    assertEquals(1, fEvents.size());
    PropertyChangeEvent event = fEvents.get(0);
    assertEquals(store1, event.getSource());
    assertEquals(PROPERTY, event.getProperty());
    assertEquals(DEFAULT_VALUE, event.getOldValue());
    assertEquals(null, event.getNewValue());
}
Also used : PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) PreferenceStore(org.eclipse.jface.preference.PreferenceStore) Test(org.junit.Test)

Aggregations

PreferenceStore (org.eclipse.jface.preference.PreferenceStore)11 IOException (java.io.IOException)6 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)5 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)4 ChainedPreferenceStore (org.eclipse.ui.texteditor.ChainedPreferenceStore)4 Test (org.junit.Test)4 File (java.io.File)1 IResource (org.eclipse.core.resources.IResource)1 Dialog (org.eclipse.jface.dialogs.Dialog)1 DialogPage (org.eclipse.jface.dialogs.DialogPage)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Shell (org.eclipse.swt.widgets.Shell)1 IEncodingSupport (org.eclipse.ui.editors.text.IEncodingSupport)1 AbstractEncodingFieldEditor (org.eclipse.ui.ide.dialogs.AbstractEncodingFieldEditor)1