use of org.eclipse.jface.util.PropertyChangeEvent in project eclipse.platform.text by eclipse.
the class EditorsPlugin method start.
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
if (PlatformUI.isWorkbenchRunning()) {
fThemeListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty()))
EditorsPluginPreferenceInitializer.setThemeBasedPreferences(getPreferenceStore(), true);
}
};
PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener);
}
}
use of org.eclipse.jface.util.PropertyChangeEvent in project eclipse.platform.text by eclipse.
the class ChainedPreferenceStoreTest method testChainedStore1.
/**
* Assertion failed in ChainedPreferenceStore.handlePropertyChangeEvent(..)
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=52827
*/
@Test
public void testChainedStore1() {
IPreferenceStore store1 = new PreferenceStore();
IPreferenceStore store2 = new PreferenceStore();
IPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
// simulated removal with newValue != null
store1.firePropertyChangeEvent(PROPERTY, VALUE, DEFAULT_DEFAULT_VALUE);
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
assertEquals(1, fEvents.size());
PropertyChangeEvent event = fEvents.get(0);
assertEquals(store1, event.getSource());
assertEquals(PROPERTY, event.getProperty());
assertEquals(VALUE, event.getOldValue());
assertEquals(DEFAULT_DEFAULT_VALUE, event.getNewValue());
}
use of org.eclipse.jface.util.PropertyChangeEvent in project eclipse.platform.text by eclipse.
the class ChainedPreferenceStoreTest method testChainedStore0.
/**
* [implementation] ChainedPreferenceStore
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=69419
*/
@Test
public void testChainedStore0() {
IPreferenceStore store1 = new PreferenceStore();
IPreferenceStore store2 = new PreferenceStore();
IPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
store2.setDefault(PROPERTY, DEFAULT_VALUE);
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
// simulated removal with newValue != null
store1.firePropertyChangeEvent(PROPERTY, VALUE, DEFAULT_DEFAULT_VALUE);
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
assertEquals(1, fEvents.size());
PropertyChangeEvent event = fEvents.get(0);
assertEquals(chainedStore, event.getSource());
assertEquals(PROPERTY, event.getProperty());
assertEquals(VALUE, event.getOldValue());
assertEquals(DEFAULT_VALUE, event.getNewValue());
}
use of org.eclipse.jface.util.PropertyChangeEvent in project eclipse.platform.text by eclipse.
the class TemplateStore method startListeningForPreferenceChanges.
/**
* Starts listening for property changes on the preference store. If the configured preference
* key changes, the template store is {@link #load() reloaded}. Call
* {@link #stopListeningForPreferenceChanges()} to remove any listener and stop the
* auto-updating behavior.
*
* @since 3.2
*/
public final void startListeningForPreferenceChanges() {
if (fPropertyListener == null) {
fPropertyListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
/*
* Don't load if we are in the process of saving ourselves. We are in sync anyway after the
* save operation, and clients may trigger reloading by listening to preference store
* updates.
*/
if (!fIgnorePreferenceStoreChanges && fKey.equals(event.getProperty()))
try {
load();
} catch (IOException x) {
handleException(x);
}
}
};
fPreferenceStore.addPropertyChangeListener(fPropertyListener);
}
}
use of org.eclipse.jface.util.PropertyChangeEvent in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method install.
/**
* Installs this decoration support on the given preference store. It assumes
* that this support has completely been configured.
*
* @param store the preference store
*/
public void install(IPreferenceStore store) {
fPreferenceStore = store;
if (fPreferenceStore != null) {
fPropertyChangeListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
handlePreferenceStoreChanged(event);
}
};
fPreferenceStore.addPropertyChangeListener(fPropertyChangeListener);
}
updateTextDecorations();
updateOverviewDecorations();
}
Aggregations