From b4f2228b0e8a39865a24e27ff4427f94477fb988 Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 18 May 2009 08:03:57 +0000 Subject: Bug 272428 - [aspects] Hangs after Scala plugin update; after force quit and manual restart, it crashes; after second manual restart, it finally runs. --- .../weaving/hooks/SupplementerRegistry.java | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java') diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java index d37a0f973..d089a11dd 100644 --- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java +++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java @@ -238,6 +238,13 @@ public class SupplementerRegistry implements ISupplementerRegistry { */ public void refreshBundles(final Bundle[] bundles) { if (this.packageAdmin != null) { + if (AbstractWeavingHook.verbose) { + for (int i = 0; i < bundles.length; i++) { + System.out.println("refresh bundle: " + + bundles[i].getSymbolicName()); + } + } + this.packageAdmin.refreshPackages(bundles); } } @@ -250,6 +257,8 @@ public class SupplementerRegistry implements ISupplementerRegistry { removeSupplementedBundle(bundle); this.supplementersByBundle.remove(bundle.getBundleId()); + this.adaptorProvider.resetAdaptor(bundle.getBundleId()); + // if this bundle supplements other bundles, remove this supplementer and update the other bundles if (supplementers.containsKey(bundle.getSymbolicName())) { @@ -266,7 +275,19 @@ public class SupplementerRegistry implements ISupplementerRegistry { final Bundle[] supplementedBundles = supplementer .getSupplementedBundles(); if (supplementedBundles != null && supplementedBundles.length > 0) { - refreshBundles(supplementedBundles); + final List bundlesToRefresh = new ArrayList( + supplementedBundles.length); + for (final Bundle bundleToRefresh : supplementedBundles) { + if (this.adaptorProvider.getAdaptor(bundleToRefresh + .getBundleId()) != null) { + bundlesToRefresh.add(bundleToRefresh); + } + } + + if (bundlesToRefresh.size() > 0) { + refreshBundles(bundlesToRefresh + .toArray(new Bundle[bundlesToRefresh.size()])); + } } // remove this supplementer from the list of supplementers per other bundle @@ -391,12 +412,6 @@ public class SupplementerRegistry implements ISupplementerRegistry { final Bundle[] bundles = bundlesToRefresh .toArray(new Bundle[bundlesToRefresh.size()]); - if (AbstractWeavingHook.verbose) { - for (int i = 0; i < bundles.length; i++) { - System.out.println("refresh bundle: " - + bundles[i].getSymbolicName()); - } - } refreshBundles(bundles); } } -- cgit v1.2.3