Bug 340465 Remove CTabFolder/CTabItem references from the TrimStack
bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
});
			}
		} else if (minimizedElement instanceof MPartStack) {
			MPartStack theStack = (MPartStack) minimizedElement;
			CTabFolder ctf = (CTabFolder) theStack.getWidget();
			if (ctf == null)
				return;
			if (ctf.getItemCount() == 0) {
				restoreStack();
				return;
			}
			
			while (trimStackTB.getItemCount() > 1) {
				trimStackTB.getItem(trimStackTB.getItemCount() - 1).dispose();
			}
			CTabItem[] items = ctf.getItems();
			for (CTabItem item : items) {
				ToolItem newItem = new ToolItem(trimStackTB, SWT.CHECK);
				newItem.setData(item);
				newItem.setImage(item.getImage());
				newItem.setToolTipText(item.getText());
				newItem.addSelectionListener(new SelectionListener() {
					public void widgetSelected(SelectionEvent e) {
						ToolItem item = (ToolItem) e.widget;
						CTabItem cti = (CTabItem) item.getData();
						MUIElement me = (MUIElement) cti.getData(AbstractPartRenderer.OWNING_ME);
						if (me instanceof MPlaceholder)
							me = ((MPlaceholder) me).getRef();
						boolean show = item.getSelection();
						partService.activate((MPart) me);