public String getLastLine ( String backText ) { BufferedReader breader = new BufferedReader ( new StringReader ( backText ) ) ; String last = "" ; String line = null ; try { while ( ( line = breader . readLine ( ) ) != null ) { // only if the line has text do we set last to it if ( line . length ( ) > 0 ) { last = line ; } } } catch ( IOException e ) { DroolsEclipsePlugin . log ( e ) ; } // now that all the conditions for a single object are on the same line // we need to check for the left parenthesis if ( last . indexOf ( "(" ) > - 1 ) { last = last . substring ( last . lastIndexOf ( "(" ) + 1 ) ; } // if the string has a comma "," we get the substring starting from // the index after the last comma if ( last . indexOf ( "," ) > - 1 ) { last = last . substring ( last . lastIndexOf ( "," ) + 1 ) ; } // if the line ends with right parenthesis, we change it to zero length // string if ( last . endsWith ( ")" ) ) { last = "" ; } return last ; }
because of how the backText works we need to get the last line so that we can pass it to the DSLUtility