Use XBlockViewUtils.getXBlockType.