public Object[] getSelectionCellsForChanges(List<mxUndoableChange> changes)
	{
		List<Object> cells = new ArrayList<Object>();
		Iterator<mxUndoableChange> it = changes.iterator();

		while (it.hasNext())
		{
			Object change = it.next();

			if (change instanceof mxChildChange)
			{
				cells.add(((mxChildChange) change).getChild());
			}
			else if (change instanceof mxTerminalChange)
			{
				cells.add(((mxTerminalChange) change).getCell());
			}
			else if (change instanceof mxValueChange)
			{
				cells.add(((mxValueChange) change).getCell());
			}
			else if (change instanceof mxStyleChange)
			{
				cells.add(((mxStyleChange) change).getCell());
			}
			else if (change instanceof mxGeometryChange)
			{
				cells.add(((mxGeometryChange) change).getCell());
			}
			else if (change instanceof mxCollapseChange)
			{
				cells.add(((mxCollapseChange) change).getCell());
			}
			else if (change instanceof mxVisibleChange)
			{
				mxVisibleChange vc = (mxVisibleChange) change;

				if (vc.isVisible())
				{
					cells.add(((mxVisibleChange) change).getCell());
				}
			}
		}

		return mxGraphModel.getTopmostCells(model, cells.toArray());
	}