new ServiceTracker(Activator.getBC(),
Activator.getBC().createFilter(dispFilter),
null)
{
public Object addingService(final ServiceReference sr) {
final SwingBundleDisplayer disp =
(SwingBundleDisplayer)super.addingService(sr);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Icon icon = disp.getSmallIcon();
String name =
Util.getStringProp(sr,
SwingBundleDisplayer.PROP_NAME,
disp.getClass().getName());
String desc =
Util.getStringProp(sr,
SwingBundleDisplayer.PROP_DESCRIPTION,
"");
boolean bDetail =
Util.getBooleanProp(sr,
SwingBundleDisplayer.PROP_ISDETAIL,
false);
JComponent comp = disp.createJComponent();
JFloatable wrapper = new JFloatable(comp, name);
// floating windows shouldn't be closed when
// the tabbed pane swaps components
wrapper.setAutoClose(false);
disp.setBundleSelectionModel(bundleSelModel);
if(bDetail) {
detailMap.put(sr, disp);
// JPanel wrapper2 = new JPanel(new BorderLayout());
// wrapper2.add(wrapper, BorderLayout.CENTER);
detailPanel.addTab(name, icon, wrapper, desc);
} else {
displayMap.put(sr, disp);
bundlePanel.addTab(name, wrapper);
makeViewPopupMenu();
viewMenu = makeViewMenu(viewMenu);
}
}
});
return disp;
}
public void removedService(final ServiceReference sr,
final Object service) {
final SwingBundleDisplayer disp = (SwingBundleDisplayer)service;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
String name =
Util.getStringProp(sr,
SwingBundleDisplayer.PROP_NAME,
disp.getClass().getName());
boolean bDetail =
Util.getBooleanProp(sr,
SwingBundleDisplayer.PROP_ISDETAIL,
false);