Package org.eclipse.ui
Class AbstractSourceProvider
- java.lang.Object
-
- org.eclipse.ui.AbstractSourceProvider
-
- All Implemented Interfaces:
ISourceProvider
public abstract class AbstractSourceProvider extends Object implements ISourceProvider
An implementation of
ISourceProvider
that provides listener support. Subclasses need only callfireSourceChanged
whenever appropriate.- Since:
- 3.1
-
-
Field Summary
Fields Modifier and Type Field Description protected static boolean
DEBUG
Whether source providers should print out debugging information to the console when events arrive.
-
Constructor Summary
Constructors Constructor Description AbstractSourceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSourceProviderListener(ISourceProviderListener listener)
Adds a listener to this source provider.protected void
fireSourceChanged(int sourcePriority, String sourceName, Object sourceValue)
Notifies all listeners that a single source has changed.protected void
fireSourceChanged(int sourcePriority, Map sourceValuesByName)
Notifies all listeners that multiple sources have changed.void
initialize(IServiceLocator locator)
This method is called when the source provider is instantiated byorg.eclipse.ui.services
.protected void
logDebuggingInfo(String message)
Logs a debugging message in an appropriate manner.void
removeSourceProviderListener(ISourceProviderListener listener)
Removes a listener from this source provider.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.ui.ISourceProvider
dispose, getCurrentState, getProvidedSourceNames
-
-
-
-
Method Detail
-
addSourceProviderListener
public final void addSourceProviderListener(ISourceProviderListener listener)
Description copied from interface:ISourceProvider
Adds a listener to this source provider. This listener will be notified whenever the corresponding source changes.- Specified by:
addSourceProviderListener
in interfaceISourceProvider
- Parameters:
listener
- The listener to add; must not benull
.
-
fireSourceChanged
protected final void fireSourceChanged(int sourcePriority, String sourceName, Object sourceValue)
Notifies all listeners that a single source has changed.- Parameters:
sourcePriority
- The source priority that has changed.sourceName
- The name of the source that has changed; must not benull
.sourceValue
- The new value for the source; may benull
.
-
fireSourceChanged
protected final void fireSourceChanged(int sourcePriority, Map sourceValuesByName)
Notifies all listeners that multiple sources have changed.- Parameters:
sourcePriority
- The source priority that has changed.sourceValuesByName
- The map of source names (String
) to source values (Object
) that have changed; must not benull
. The names must not benull
, but the values may benull
.
-
logDebuggingInfo
protected final void logDebuggingInfo(String message)
Logs a debugging message in an appropriate manner. If the message isnull
or theDEBUG
isfalse
, then this method does nothing.- Parameters:
message
- The debugging message to log; ifnull
, then nothing is logged.- Since:
- 3.2
-
removeSourceProviderListener
public final void removeSourceProviderListener(ISourceProviderListener listener)
Description copied from interface:ISourceProvider
Removes a listener from this source provider. This listener will be notified whenever the corresponding source changes.- Specified by:
removeSourceProviderListener
in interfaceISourceProvider
- Parameters:
listener
- The listener to remove; must not benull
.
-
initialize
public void initialize(IServiceLocator locator)
This method is called when the source provider is instantiated byorg.eclipse.ui.services
. Clients may override this method to perform initialization.- Parameters:
locator
- The global service locator. It can be used to retrieve services like the IContextService- Since:
- 3.4
-
-