code: public void onClick(MenuItemClickEvent event) {
  		if (controller.isSnappingActive()) {
  			controller.deactivateSnapping();
  		} else if (layer != null) {
  			controller.activateSnapping(layer.getLayerInfo().getSnappingRules(), SnapMode.ALL_GEOMETRIES_EQUAL);
  		}
  	}
docs: ClickHandler implementation: