Bug 309698 Disposing parent context does not cause objects injected by a child context to be destroyed
The test below fails. static class Target { int pc = 0; int pd = 0; @Inject @Named("o") Object o; @PostConstruct void pc() { pc++; } @PreDestroy void pd() { pd++; } } public void testV() { IEclipseContext context = EclipseContextFactory.create(); IEclipseContext child = EclipseContextFactory.create(context, null); child.set("o", new Object()); Target target = (Target) ContextInjectionFactory.make(Target.class, child); assertEquals(1, target.pc); ((IDisposable) context).dispose(); assertEquals(1, target.pd); }
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/workbench/ui/renderers/swt/SWTPartRenderer.java
String cssClassStr = 'M' + eObj.eClass().getName();
		for (String tag : me.getTags())
			cssClassStr += ' ' + tag;
		engine.setClassname(widget, cssClassStr);
		
		engine.setId(widget, me.getElementId()); 
	}
	public void bindWidget(MUIElement me, Object widget) {
		
		me.setWidget(widget);
		((Widget) widget).setData(OWNING_ME, me);
		
		me.setRenderer(this);
		
		setCSSInfo(me, widget);
		
		Widget swtWidget = (Widget) widget;
		swtWidget.addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent e) {
				MUIElement element = (MUIElement) e.widget.getData(OWNING_ME);
				if (element != null)
					unbindWidget(element);
			}
		});
	}
	public Object unbindWidget(MUIElement me) {
		Widget widget = (Widget) me.getWidget();
		if (widget != null) {
			me.setWidget(null);
			if (!widget.isDisposed())