Search in sources :

Example 31 with SafeRunnable

use of org.eclipse.jface.util.SafeRunnable in project xtext-eclipse by eclipse.

the class FixedScopedPreferenceStore method firePropertyChangeEvent.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String,
	 *      java.lang.Object, java.lang.Object)
	 */
@Override
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
    // important: create intermediate array to protect against listeners
    // being added/removed during the notification
    final Object[] list = getListeners();
    if (list.length == 0) {
        return;
    }
    final PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue);
    for (int i = 0; i < list.length; i++) {
        final IPropertyChangeListener listener = (IPropertyChangeListener) list[i];
        SafeRunner.run(new SafeRunnable(JFaceResources.getString(// $NON-NLS-1$
        "PreferenceStore.changeError")) {

            @Override
            public void run() {
                listener.propertyChange(event);
            }
        });
    }
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) SafeRunnable(org.eclipse.jface.util.SafeRunnable)

Aggregations

SafeRunnable (org.eclipse.jface.util.SafeRunnable)31 ISafeRunnable (org.eclipse.core.runtime.ISafeRunnable)6 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)5 Point (org.eclipse.swt.graphics.Point)5 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)4 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)3 ILabelProviderListener (org.eclipse.jface.viewers.ILabelProviderListener)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 DropTargetEvent (org.eclipse.swt.dnd.DropTargetEvent)3 Rectangle (org.eclipse.swt.graphics.Rectangle)3 Control (org.eclipse.swt.widgets.Control)3 TableItem (org.eclipse.swt.widgets.TableItem)3 TreeItem (org.eclipse.swt.widgets.TreeItem)3 IHyperlinkDetector (org.eclipse.jface.text.hyperlink.IHyperlinkDetector)2 LocalSelectionTransfer (org.eclipse.jface.util.LocalSelectionTransfer)2 TransferDropTargetListener (org.eclipse.jface.util.TransferDropTargetListener)2 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)2 Transfer (org.eclipse.swt.dnd.Transfer)2 DragNodeCommand (org.eclipse.wst.xml.ui.internal.dnd.DragNodeCommand)2