Bug 330864 Add ability to find context for a UI element
bundles/org.eclipse.e4.core.contexts.debug/src/org/eclipse/e4/core/internal/contexts/debug/ui/ContextTreeProvider.java
public Object[] getElements(Object inputElement) {
		for (Iterator<WeakReference<EclipseContext>> i = activeContexts.iterator(); i.hasNext();) {
			WeakReference<EclipseContext> ref = i.next();
			EclipseContext storedRoot = ref.get();
			if (storedRoot == null)
				i.remove();
		}
		return activeContexts.toArray();
	}
	public Object[] getChildren(Object parentElement) {
		if (!(parentElement instanceof WeakReference<?>))
			return null;
		@SuppressWarnings("unchecked")
		WeakReference<EclipseContext> ref = (WeakReference<EclipseContext>) parentElement;
		EclipseContext parentContext = ref.get();
		if (parentContext == null)
			return null;
		Set<EclipseContext> children = parentContext.getChildren();
		if (children == null)
			return null;
		Set<WeakReference<EclipseContext>> childrenRef = new HashSet<WeakReference<EclipseContext>>(children.size());
		for (EclipseContext child : children) {
			childrenRef.add(new WeakReference<EclipseContext>(child));
		}
		return childrenRef.toArray();
	}
	public Object getParent(Object element) {
		return null;
	}
	public boolean hasChildren(Object element) {