Bug 303801 IAE thrown when moving a part from one stack to another
1. Start the photo demo. 2. Move the 'Thumbnails' view to the stack of the 'Location' view. 3. An IAE is thrown. java.lang.IllegalArgumentException: Widget has the wrong parent at org.eclipse.swt.SWT.error(SWT.java:4064) at org.eclipse.swt.SWT.error(SWT.java:3998) at org.eclipse.swt.SWT.error(SWT.java:3969) at org.eclipse.swt.custom.CTabItem.setControl(CTabItem.java:283) at org.eclipse.e4.workbench.ui.renderers.swt.StackRenderer.createTab(StackRenderer.java:286) at org.eclipse.e4.workbench.ui.renderers.swt.StackRenderer.childRendered(StackRenderer.java:313) at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine$2.handleEvent(PartRenderingEngine.java:139) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:41) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:188) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:198) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:139) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:73) at org.eclipse.e4.workbench.ui.internal.UIEventPublisher.notifyChanged(UIEventPublisher.java:58) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280) at org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch(NotificationImpl.java:1033) at org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch(NotificationImpl.java:1038) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:305) at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307) at org.eclipse.e4.workbench.ui.renderers.swt.dnd.DragHost.drop(DragHost.java:119) at org.eclipse.e4.workbench.ui.renderers.swt.dnd.DnDManager.endDrag(DnDManager.java:224) at org.eclipse.e4.workbench.ui.renderers.swt.dnd.DnDManager$2.handleEvent(DnDManager.java:73) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/workbench/ui/renderers/swt/dnd/DragHost.java
} else if (dragElement.getWidget() instanceof ToolItem) {
			ToolItem ti = (ToolItem) dragElement.getWidget();
			Rectangle bounds = ti.getBounds();
			size = new Point(bounds.width + 3, bounds.height + 3);
		}
		dragElement.getParent().getChildren().remove(dragElement);
		dragWindow = MApplicationFactory.eINSTANCE.createWindow();
		dragWindow.getTags().add(DragHostId);
		formatModel(dragWindow);
		baseWindow.getChildren().add(dragWindow);
		getShell().setSize(size);
		Point cp = getShell().getDisplay().getCursorLocation();
		getShell().setLocation(cp.x + 20, cp.y + 20);
		getShell().layout(getShell().getChildren(), SWT.CHANGED | SWT.DEFER);
		getShell().setVisible(true);
	}
	private void formatModel(MWindow dragWindow) {
		if (dragElement instanceof MToolItem) {
			MWindowTrim trim = MApplicationFactory.eINSTANCE.createWindowTrim();
			MToolBar mtb = MApplicationFactory.eINSTANCE.createToolBar();
			trim.getChildren().add(mtb);
			mtb.getChildren().add((MToolItem) dragElement);
			dragWindow.getChildren().add(trim);
		} else if (dragElement instanceof MToolBar) {
			MWindowTrim trim = MApplicationFactory.eINSTANCE.createWindowTrim();
			trim.getChildren().add(dragElement);
			dragWindow.getChildren().add(trim);
		} else if (dragElement instanceof MPSCElement) {
			dragWindow.getChildren().add((MPSCElement) dragElement);
		}