public void deactivate() { if (fPolygon != null) { fPolygon.smoothPoints(); if (fPolygon.pointCount() < 3 || fPolygon.size().width < 4 || fPolygon.size().height < 4) { getActiveView().drawing().remove(fPolygon); // nothing to undo setUndoActivity(null); } } fPolygon = null; super.deactivate(); }