Bug 295277 Part context is disposed twice when tab item is closed
Thread [main] (Suspended (breakpoint at line 305 in EclipseContext)) EclipseContext.dispose() line: 305 ContributedPartRenderer$2.widgetDisposed(DisposeEvent) line: 129 TypedListener.handleEvent(Event) line: 117 EventTable.sendEvent(Event) line: 84 Composite(Widget).sendEvent(Event) line: 1002 Composite(Widget).sendEvent(int, Event, boolean) line: 1026 Composite(Widget).sendEvent(int) line: 1007 Composite(Widget).release(boolean) line: 803 Composite(Widget).dispose() line: 441 ContributedPartRenderer(SWTPartRenderer).disposeWidget(MUIElement) line: 95 PartRenderingEngine.removeGui(MUIElement) line: 306 PartRenderingEngine$1.handleEvent(Event) line: 83 UIEventHandler$1.run() line: 42 Synchronizer.syncExec(Runnable) line: 179 Display.syncExec(Runnable) line: 4364 UIEventHandler.handleEvent(Event) line: 40 EventHandlerWrapper.handleEvent(Event, Permission) line: 177 EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 198 EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line: 227 ListenerQueue.dispatchEventSynchronous(int, Object) line: 149 EventAdminImpl.dispatchEvent(Event, boolean) line: 139 EventAdminImpl.sendEvent(Event) line: 78 EventComponent.sendEvent(Event) line: 39 EventBroker.send(String, Object) line: 67 UIEventPublisher.notifyChanged(Notification) line: 69 PartImpl(BasicNotifierImpl).eNotify(Notification) line: 280 PartImpl.setVisible(boolean) line: 394 StackRenderer$8.close(CTabFolderEvent) line: 447 ETabFolder(CTabFolder).onMouse(Event) line: 2189 CTabFolder$1.handleEvent(Event) line: 317 EventTable.sendEvent(Event) line: 84 ETabFolder(Widget).sendEvent(Event) line: 1002 Display.runDeferredEvents() line: 3917 Display.readAndDispatch() line: 3510 PartRenderingEngine$4.run() line: 422 Realm.runWithDefault(Realm, Runnable) line: 332 PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 369 Thread [main] (Suspended (breakpoint at line 305 in EclipseContext)) EclipseContext.dispose() line: 305 PartRenderingEngine.removeGui(MUIElement) line: 316 PartRenderingEngine$1.handleEvent(Event) line: 83 UIEventHandler$1.run() line: 42 Synchronizer.syncExec(Runnable) line: 179 Display.syncExec(Runnable) line: 4364 UIEventHandler.handleEvent(Event) line: 40 EventHandlerWrapper.handleEvent(Event, Permission) line: 177 EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 198 EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line: 227 ListenerQueue.dispatchEventSynchronous(int, Object) line: 149 EventAdminImpl.dispatchEvent(Event, boolean) line: 139 EventAdminImpl.sendEvent(Event) line: 78 EventComponent.sendEvent(Event) line: 39 EventBroker.send(String, Object) line: 67 UIEventPublisher.notifyChanged(Notification) line: 69 PartImpl(BasicNotifierImpl).eNotify(Notification) line: 280 PartImpl.setVisible(boolean) line: 394 StackRenderer$8.close(CTabFolderEvent) line: 447 ETabFolder(CTabFolder).onMouse(Event) line: 2189 CTabFolder$1.handleEvent(Event) line: 317 EventTable.sendEvent(Event) line: 84 ETabFolder(Widget).sendEvent(Event) line: 1002 Display.runDeferredEvents() line: 3917 Display.readAndDispatch() line: 3510 PartRenderingEngine$4.run() line: 422 Realm.runWithDefault(Realm, Runnable) line: 332 PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 369
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/workbench/ui/renderers/swt/ContributedPartRenderer.java
newWidget.addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent e) {
				if (eventLclContext instanceof IDisposable)
					((IDisposable) eventLclContext).dispose();
			}
		});
		activate(element);
		return newWidget;
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.e4.workbench.ui.renderers.swt.PartFactory#hookControllerLogic
	 * (org.eclipse.e4.ui.model.application.MPart)
	 */
	@Override
	public void hookControllerLogic(final MUIElement me) {
		super.hookControllerLogic(me);
		Widget widget = (Widget) me.getWidget();
		if (widget instanceof Composite) {
			((Composite) widget).addListener(SWT.Activate, new Listener() {
				public void handleEvent(Event event) {
					activate(me);
				}
			});
		}
	}
}