org.eclipse.jface.viewers.BaseLabelProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.eclipse.jface Show documentation
Show all versions of org.eclipse.jface Show documentation
This is org.eclipse.jface jar used by Scout SDK
The newest version!
/*******************************************************************************
* Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.viewers;
import org.eclipse.core.commands.common.EventManager;
import org.eclipse.jface.util.SafeRunnable;
/**
* BaseLabelProvider is a default concrete implementation of
* {@link IBaseLabelProvider}
*
* @since 3.3
*
*/
public class BaseLabelProvider extends EventManager implements IBaseLabelProvider {
@Override
public void addListener(ILabelProviderListener listener) {
addListenerObject(listener);
}
/**
* The BaseLabelProvider
implementation of this
* IBaseLabelProvider
method clears its internal listener list.
* Subclasses may extend but should call the super implementation.
*/
@Override
public void dispose() {
clearListeners();
}
/**
* The BaseLabelProvider
implementation of this
* IBaseLabelProvider
method returns true
. Subclasses may
* override.
*/
@Override
public boolean isLabelProperty(Object element, String property) {
return true;
}
@Override
public void removeListener(ILabelProviderListener listener) {
removeListenerObject(listener);
}
/**
* Fires a label provider changed event to all registered listeners Only
* listeners registered at the time this method is called are notified.
*
* @param event
* a label provider changed event
*
* @see ILabelProviderListener#labelProviderChanged
*/
protected void fireLabelProviderChanged(final LabelProviderChangedEvent event) {
Object[] listeners = getListeners();
for (int i = 0; i < listeners.length; ++i) {
final ILabelProviderListener l = (ILabelProviderListener) listeners[i];
SafeRunnable.run(new SafeRunnable() {
@Override
public void run() {
l.labelProviderChanged(event);
}
});
}
}
}