Source:
<code>protected boolean showMenu(final NatTable natTable) { boolean result = false; createDoubleSeriesMenu = false; String templateString = null; <START> if (null != this.clipboard && null != this.clipboard.getCopiedCells()) { <END> final ILayerCell[][] copiedCells = this.clipboard.getCopiedCells(); result = true; Class<?> type = null; for (int cellsIndex = 0; cellsIndex < copiedCells.length && result; cellsIndex++) { final ILayerCell[] cells = copiedCells[cellsIndex]; for (int cellIndex = 0; cellIndex < cells.length && result; cellIndex++) { final ILayerCell cell = cells[cellIndex]; if (null == cell.getDataValue()) { result = false; } else { if (null == type) { type = cell.getDataValue().getClass(); if (String.class.isAssignableFrom(type)) { final String stringValue = (String) cell.getDataValue(); final String currentTemplateString = PapyrusFillHandleUtils.getTemplateString(stringValue); templateString = currentTemplateString; final String number = stringValue.replace(currentTemplateString, ""); if (!number.isEmpty()) { final boolean isBeginningByNumber = PapyrusFillHandleUtils.isBeginningByNumber(stringValue, templateString); final boolean isEndingByNumber = PapyrusFillHandleUtils.isEndingBNumber(stringValue, templateString); createDoubleSeriesMenu = isBeginningByNumber && isEndingByNumber; } else { result = false; } } else if (!Number.class.isAssignableFrom(type) && !Date.class.isAssignableFrom(type)) { result = false; } } else { if (type != cell.getDataValue().getClass()) { result = false; } else if (String.class.isAssignableFrom(type)) { final String stringValue = (String) cell.getDataValue(); final String currentTemplateString = PapyrusFillHandleUtils.getTemplateString(stringValue); final String number = stringValue.replace(currentTemplateString, ""); if (!templateString.equals(currentTemplateString) || number.isEmpty()) { result = false; } } } } } } } return result; }</code><technical_language>reduce number of level of conditions</technical_language>

Target:
protected boolean showMenu(final NatTable natTable) { boolean result = false; createDoubleSeriesMenu = false; String templateString = null; if (null != this.clipboard && null != this.clipboard.getCopiedCells()) { final ILayerCell[][] copiedCells = this.clipboard.getCopiedCells(); result = true; Class<?> type = null; for (int cellsIndex = 0; cellsIndex < copiedCells.length && result; cellsIndex++) { final ILayerCell[] cells = copiedCells[cellsIndex]; for (int cellIndex = 0; cellIndex < cells.length && result; cellIndex++) { final ILayerCell cell = cells[cellIndex]; if (null == cell.getDataValue()) { result = false; } else if (null == type) { type = cell.getDataValue().getClass(); if (String.class.isAssignableFrom(type)) { final String stringValue = (String) cell.getDataValue(); final String currentTemplateString = PapyrusFillHandleUtils.getTemplateString(stringValue); templateString = currentTemplateString; final String number = stringValue.replace(currentTemplateString, ""); if (!number.isEmpty()) { final boolean isBeginningByNumber = PapyrusFillHandleUtils.isBeginningByNumber(stringValue, templateString); final boolean isEndingByNumber = PapyrusFillHandleUtils.isEndingBNumber(stringValue, templateString); createDoubleSeriesMenu = isBeginningByNumber && isEndingByNumber; } else { result = false; } } else if (!Number.class.isAssignableFrom(type) && !Date.class.isAssignableFrom(type)) { result = false; } } else { if (type != cell.getDataValue().getClass()) { result = false; } else if (String.class.isAssignableFrom(type)) { final String stringValue = (String) cell.getDataValue(); final String currentTemplateString = PapyrusFillHandleUtils.getTemplateString(stringValue); final String number = stringValue.replace(currentTemplateString, ""); result = templateString.equals(currentTemplateString) && !number.isEmpty(); } } } } } return result; }