Bug 261852 [context] Separate code into API / SPI / internal
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/renderers/swt/PartRenderer.java
}
        	}
        });
		
		
        ((EObject)element).eAdapters().add(new AdapterImpl() {
        	@Override
        	public void notifyChanged(Notification msg) {
        		if (ApplicationPackage.Literals.PART__CHILDREN.equals(msg.getFeature())
        			 && msg.getEventType() == Notification.REMOVE) {
            			Part<?> parent = (Part<?>) msg.getNotifier();
            			PartFactory parentFactory = getFactoryFor(parent);
            			if (parentFactory == null)
            				return;
            			
        				Part<?> removed = (Part<?>) msg.getOldValue();
        				parentFactory.childRemoved(parent, removed);
        		}
        	}
        });
	}
	protected void setFactoryFor(Part element, PartFactory factory) {
		element.setOwner(factory);
	}
	
	protected PartFactory getFactoryFor(Part element) {
		return (PartFactory) element.getOwner();
	}
}