/** * Initializes the bean-shell interpreter by executing the code in the BSHExpressionHeader.txt file. * * @param interpreter * the interpreter that should be initialized. * @throws EvalError * if an BeanShell-Error occured. * @throws IOException * if the beanshell file could not be read. */ protected void initializeInterpreter( final Interpreter interpreter ) throws EvalError, IOException { final InputStream in = ObjectUtilities.getResourceRelativeAsStream( "BSHExpressionHeader.txt", BSHExpression.class ); //$NON-NLS-1$ // read the header, creates a skeleton final Reader r = new InputStreamReader( new BufferedInputStream( in ) ); try { interpreter.eval( r ); } finally { r.close(); } // now add the userdefined expression // the expression is given in form of a function with the signature of: // // Object getValue () // if ( getExpression() != null ) { interpreter.eval( expression ); } }