if (newTile == oldTile) return;
if (newTile == oldTile || layer.getLocked()) return;
    private void pour(TileLayer layer, int x, int y,            Tile newTile, Tile oldTile) {        if (newTile == oldTile) return;        Rectangle area = null;        TileLayer before = new TileLayer(layer);        TileLayer after;        if (marqueeSelection == null) {            area = new Rectangle(new Point(x, y));            Stack stack = new Stack();            stack.push(new Point(x, y));            while (!stack.empty()) {                // Remove the next tile from the stack                Point p = (Point)stack.pop();                // If the tile it meets the requirements, set it and push its                // neighbouring tiles on the stack.                if (currentMap.inBounds(p.x, p.y) &&                        layer.getTileAt(p.x, p.y) == oldTile)                {                    layer.setTileAt(p.x, p.y, newTile);                    area.add(p);                    stack.push(new Point(p.x, p.y - 1));                    stack.push(new Point(p.x, p.y + 1));                    stack.push(new Point(p.x + 1, p.y));                    stack.push(new Point(p.x - 1, p.y));                }            }        } else {            if (marqueeSelection.getSelectedArea().contains(x, y)) {                area = marqueeSelection.getSelectedAreaBounds();                for (int i = area.y; i < area.height+area.y; i++) {                    for (int j = area.x;j<area.width+area.x;j++){                        if (marqueeSelection.getSelectedArea().contains(j, i)){                            layer.setTileAt(j, i, newTile);                        }                    }                }            } else {                return;            }        }        Rectangle bounds = new Rectangle(                area.x, area.y, area.width + 1, area.height + 1);        after = new TileLayer(bounds);        after.copyFrom(layer);        MapLayerEdit mle = new MapLayerEdit(layer, before, after);        mle.setPresentationName("Fill");        undoSupport.postEdit(mle);    }