public boolean removeToNextSeparator ( Issue issue , IXtextDocument document , String separator ) throws BadLocationException { // Skip spaces after the identifier until the separator int index = issue . getOffset ( ) + issue . getLength ( ) ; char c = document . getChar ( index ) ; while ( Character . isWhitespace ( c ) ) { index ++ ; c = document . getChar ( index ) ; } // Test if it next non-space character is the separator final boolean foundSeparator = document . getChar ( index ) == separator . charAt ( 0 ) ; if ( foundSeparator ) { index ++ ; c = document . getChar ( index ) ; // Skip the previous spaces while ( Character . isWhitespace ( c ) ) { index ++ ; c = document . getChar ( index ) ; } final int newLength = index - issue . getOffset ( ) ; document . replace ( issue . getOffset ( ) , newLength , "" ) ; //$NON-NLS-1$ } return foundSeparator ; }
Remove the element related to the issue and the whitespaces after the element until the given separator .