Bug 337002 EPartService leaks previously active part
A reference is kept to the previously active part. This is unnecessary. We only need it to fire events. After the deactivation events have been fired, we should no longer need to keep it lying around.
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
MPlaceholder partPlaceholder = AdvancedFactoryImpl.eINSTANCE
				.createPlaceholder();
		partPlaceholder.setRef(part);
		part.setCurSharedRef(partPlaceholder);
		area.getChildren().add(partPlaceholder);
		area.setSelectedElement(partPlaceholder);
		initialize(applicationContext, application);
		getEngine().createGui(window);
		EPartService partService = window.getContext().get(EPartService.class);
		partService.hidePart(part, force);
		assertFalse(partPlaceholder.isToBeRendered());
	}
	public void testHidePart_Bug327964_True() {
		testHidePart_Bug327964(true);
	}
	public void testHidePart_Bug327964_False() {
		testHidePart_Bug327964(false);
	}
	private void testHidePart_Bug332163(boolean force) {
		MApplication application = ApplicationFactoryImpl.eINSTANCE
				.createApplication();
		MWindow window = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window);
		application.setSelectedElement(window);
		MPart part = BasicFactoryImpl.eINSTANCE.createPart();
		window.getSharedElements().add(part);
		MPerspectiveStack perspectiveStack = AdvancedFactoryImpl.eINSTANCE
				.createPerspectiveStack();
		window.getChildren().add(perspectiveStack);
		window.setSelectedElement(perspectiveStack);