Bug 319011 NPE when closing editor after closing a perspective
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
eObj = (EObjectImpl) eObj.eContainer();
		if (eObj instanceof MWindow)
			return (MWindow) eObj;
		return null; 
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.e4.ui.workbench.modeling.EModelService#getPerspectiveFor(org.eclipse.e4.ui.model
	 * .application.ui.MUIElement)
	 */
	public MPerspective getPerspectiveFor(MUIElement element) {
		EObjectImpl eObj = (EObjectImpl) element;
		while (!(eObj.eContainer() instanceof MApplication)
				&& !(eObj.eContainer() instanceof MPerspectiveStack))
			eObj = (EObjectImpl) eObj.eContainer();
		if (eObj instanceof MPerspective)
			return (MPerspective) eObj;
		return null; 
	}
	public void removePerspectiveModel(MPerspective persp, MWindow window) {
		if (persp == null)
			return;
		for (MWindow win : persp.getWindows()) {
			win.setToBeRendered(false);
		}
		
		List<MTrimBar> bars = findElements(window, null, MTrimBar.class, null);
		List<MToolControl> toRemove = new ArrayList<MToolControl>();