Moved DebugBuildingContextMenu code into abstract class for reuse.