private List < ConfigCommand > buildCommandList ( final Sheet sheet , final int sheetRightCol , final Cell cell , final List < ConfigCommand > cList , final CellAttributesMap cellAttributesMap ) { Comment comment = cell . getCellComment ( ) ; String text = comment . getString ( ) . getString ( ) ; String [ ] commentLines = text . split ( "\\n" ) ; StringBuilder newComment = new StringBuilder ( ) ; boolean changed = false ; for ( String commentLine : commentLines ) { String line = commentLine . trim ( ) ; if ( ParserUtility . isCommandString ( line ) ) { processCommandLine ( sheet , cell , line , cList , sheetRightCol ) ; changed = true ; } else if ( ParserUtility . isEmptyMethodString ( line ) || ParserUtility . isMethodString ( line ) ) { processMethodLine ( cell , line , cellAttributesMap ) ; changed = true ; } else { if ( newComment . length ( ) > 0 ) { newComment . append ( "\\n" + commentLine ) ; } else { newComment . append ( commentLine ) ; } } } if ( ! changed ) { moveCommentToMap ( cell , text , cellAttributesMap . getTemplateCommentMap ( ) , true ) ; } else { // reset comment string if changed if ( newComment . length ( ) > 0 ) { moveCommentToMap ( cell , newComment . toString ( ) , cellAttributesMap . getTemplateCommentMap ( ) , true ) ; CreationHelper factory = sheet . getWorkbook ( ) . getCreationHelper ( ) ; RichTextString str = factory . createRichTextString ( newComment . toString ( ) ) ; comment . setString ( str ) ; } else { // remove cell comment if new comment become empty. cell . removeCellComment ( ) ; } } return cList ; }
build command list from comment .