Bug 273752 syncExec in org.eclipse.ui.internal.navigator.NavigatorContentService.getSourceOfContribution(Object) causes deadlock in test suite
The Platform UI test suite does not complete anymore - it hangs in the org.eclipse.ui.tests.dynamicplugins.EditorTests.testEditorClosure() test case. The hang is in the following code: final boolean[] flag = new boolean[] { false }; FrameworkListener listener = new FrameworkListener() { public void frameworkEvent(FrameworkEvent event) { if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) synchronized (flag) { flag[0] = true; flag.notifyAll(); } } }; context.addFrameworkListener(listener); packageAdmin.refreshPackages(bundles); synchronized (flag) { while (!flag[0]) { try { flag.wait(); } catch (InterruptedException e) { } } } The flag[0] is never set to true, which probably means that the PACKAGES_REFRESHED event is not fired.
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorContentService.java
* @param anElement
	 *            An element from the tree (any element contributed to the
	 *            tree).
	 * @return The label provider
	 */
	public ILabelProvider[] findRelevantLabelProviders(Object anElement) {
		SortedSet extensions = new TreeSet(ExtensionPriorityComparator.INSTANCE);
		NavigatorContentDescriptor ncd = getSourceOfContribution(anElement);
		if (ncd != null) {
			extensions.add(getExtension(ncd));
		}
		Set possibleChildDescriptors = findContentExtensionsByTriggerPoint(anElement, true, CONSIDER_OVERRIDES);
		for (Iterator iter = possibleChildDescriptors.iterator(); iter.hasNext();) {
			INavigatorContentExtension ext = (INavigatorContentExtension) iter.next();
			extensions.add(ext);
		}
		if (extensions.size() == 0) {
			return NO_LABEL_PROVIDERS;
		}
		List resultProvidersList = new ArrayList();
		for (Iterator itr = extensions.iterator(); itr.hasNext();) {
			resultProvidersList.add(((NavigatorContentExtension) itr.next()).getLabelProvider());
		}
		return (ILabelProvider[]) resultProvidersList.toArray(new ILabelProvider[resultProvidersList.size()]);
	}
	/**
	 * Search for extensions that declare the given element in their
	 * <b>triggerPoints</b> expression.
	 * 
	 * @param anElement