// This callback method is marked as "NotThreadSafe" in the
// javadoc, that implies that the thread calling it may hold
// internal framework locks, thus since we need to call into the
// framework all work must be done on a separate thread to avoid
// dead-locks.
final Bundle bundle = null!=ev ? ev.getBundle() : null;
final String threadName = "Desktop.bundleChanged("
+(null==ev ? "" :
(Util.bundleEventName(ev.getType()) +", "
+(null==bundle ? "*" : String.valueOf(bundle.getBundleId()))))
+")";
final Thread bct = new Thread(threadName) {
public void run()
{
if (null!=ev) {
if (BundleEvent.UPDATED==ev.getType()) {
// An updated bundle may have changed icon...
Util.clearBundleIcon(ev.getBundle());
}
}
if(pm != null) {
pm.refresh();
}
bundleCache = Activator.getBundles();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if (ev!=null && BundleEvent.INSTALLED==ev.getType()) {
// Select bundle when installed
setSelected(bundle);
showBundle(bundle);
} else if (null!=bundle && isSelected(bundle)) {
if (BundleEvent.UNINSTALLED==ev.getType()) {
bundleSelModel.setSelected(bundle.getBundleId(), false);
} else {
// Trigger a selection change notification to tell
// displayers to update their contents
if (bundleSelModel instanceof DefaultBundleSelectionModel) {
final DefaultBundleSelectionModel dbsm
= (DefaultBundleSelectionModel) bundleSelModel;
dbsm.fireChange(bundle.getBundleId());
}
}
}
updateStatusBar();
updateMenus();