protected void removeContainer(SingleDockableContainer dc) {

		/*
		 * to be improved : this method supposes a direct ancestor link between
		 * DockableContainer and TabbedDockableContainer
		 */
		dc.uninstallDocking(this);

		boolean invalidateDesktop = true; // always, except for floating
											// dockables

		Component parent = ((Component) dc).getParent();
		if (parent != null) {
			try {
				if (parent instanceof SplitContainer) {
					SplitContainer viewParent = (SplitContainer) parent;
					if (viewParent.getLeftComponent() == dc) {
						viewParent.remove((Component) dc);
						Component other = viewParent.getRightComponent();
						// replace viewParent by other in viewParent's hierarchy
						Container viewGParent = (Container) viewParent
								.getParent();
						DockingUtilities.replaceChild(viewGParent, viewParent,
								other);
					} else {
						viewParent.remove((Component) dc);
						Component other = viewParent.getLeftComponent();
						Container viewGParent = (Container) viewParent
								.getParent();
						DockingUtilities.replaceChild(viewGParent, viewParent,
								other);
					}
				} else if (parent instanceof TabbedDockableContainer) {
					TabbedDockableContainer tparent = (TabbedDockableContainer) parent;
					tparent.removeDockable(dc.getDockable());

					if (tparent.getTabCount() == 1) { // no more use for tabs
						Dockable last = tparent.getDockableAt(0);
						remove(last);
						/* tparent.removeDockable(last); //2007/11/14 */
						tparent.uninstallDocking(this);
						((JTabbedPane) tparent)
								.removeChangeListener(focusHandler);

						boolean floating = last.getDockKey().getLocation() == DockableState.Location.FLOATING;
						DockableContainer lastContainer = null;
						if (floating) {
							lastContainer = DockableContainerFactory
									.getFactory()
									.createDockableContainer(
											last,
											DockableContainerFactory.ParentType.PARENT_DETACHED_WINDOW);
						} else {
							lastContainer = DockableContainerFactory
									.getFactory()
									.createDockableContainer(
											last,
											DockableContainerFactory.ParentType.PARENT_SPLIT_CONTAINER);
						}
						lastContainer.installDocking(this);

						DockingUtilities.replaceChild(
								((Component) tparent).getParent(),
								(Component) tparent, (Component) lastContainer);
					}
				} else if (parent == dockingPanel) { // no more views to show
					dockingPanel.remove(0);
				} else if (SwingUtilities.getWindowAncestor(parent) instanceof FloatingDockableContainer) {
					// removing from a FloatingDockableContainer... nothing to
					// do
					invalidateDesktop = false;
				} else {
					((Container) parent).remove((Component) dc);
					// throw new
					// IllegalStateException("View is not contained in desktop hierarchy "
					// + parent);
				}

				if (invalidateDesktop) {
					dockingPanel.invalidate();
					dockingPanel.validate();
					dockingPanel.repaint();
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}