}
catch (Throwable e)
{
if (plugin != null)
{
IStatus status = new OperationStatus(IStatus.ERROR, plugin
.getBundle().getSymbolicName(), -1, "Resource disposal failed.",
e);
plugin.getLog().log(status);
}
}
}
resources.clear();
for (ListenerPair p : listeners)
{
try
{
if (p.registrar instanceof IPreferenceStore)
{
((IPreferenceStore) p.registrar)
.removePropertyChangeListener((IPropertyChangeListener) p.listener);
}
else if (p.registrar instanceof IAttributeEventProvider)
{
((IAttributeEventProvider) p.registrar)
.removeAttributeListener((IAttributeListener) p.listener);
}
else if (p.registrar instanceof IPostSelectionProvider)
{
((IPostSelectionProvider) p.registrar)
.removePostSelectionChangedListener((ISelectionChangedListener) p.listener);
}
else
{
throw new RuntimeException("Unhandled registrar: " + p.registrar);
}
}
catch (Throwable t)
{
if (plugin != null)
{
IStatus status = new OperationStatus(IStatus.ERROR, plugin
.getBundle().getSymbolicName(), -1, "Listener disposal failed.",
t);
plugin.getLog().log(status);
}