PageRenderTime 38ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre3/org/gjt/sp/jedit/jedit.bsh

#
Unknown | 62 lines | 53 code | 9 blank | 0 comment | 0 complexity | b92178890dde7bd4ce69d899740418c7 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /* This script is run on jEdit startup. It should be short and simple for
  2. * performance reasons. */
  3. // We use the '__cruft' scripted object to store various junk.
  4. __cruft = object();
  5. /* By default, BeanShell imports the following packages:
  6. - javax.swing.event
  7. - javax.swing
  8. - java.awt.event
  9. - java.awt
  10. - java.net
  11. - java.util
  12. - java.io
  13. - java.lang
  14. In addition to the above, we import jEdit's packages for convinience. */
  15. import org.gjt.sp.jedit.*;
  16. import org.gjt.sp.jedit.browser.*;
  17. import org.gjt.sp.jedit.gui.*;
  18. import org.gjt.sp.jedit.io.*;
  19. import org.gjt.sp.jedit.msg.*; // not useful in macros?
  20. import org.gjt.sp.jedit.options.*; // ditto?
  21. import org.gjt.sp.jedit.pluginmgr.*;
  22. import org.gjt.sp.jedit.search.*;
  23. import org.gjt.sp.jedit.syntax.*;
  24. import org.gjt.sp.jedit.textarea.*;
  25. import org.gjt.sp.util.*;
  26. /* This function prints the specified object to the current console if one
  27. * exists; otherwise, to the activity log. */
  28. print(arg)
  29. {
  30. if(arg == null)
  31. arg = "null";
  32. if(arg instanceof Object[])
  33. {
  34. len = arg.length;
  35. print("Array: "+arg +" {");
  36. for(int i=0; i< len; i++ )
  37. {
  38. print(arg[i]);
  39. }
  40. print("}");
  41. }
  42. else
  43. {
  44. if(output != null)
  45. output.print(null,String.valueOf(arg));
  46. else
  47. Log.log(Log.WARNING,BeanShell.class,String.valueOf(arg));
  48. }
  49. }
  50. bsh.help.print = "usage: print ( arg )";
  51. // Print a message once BeanShell initialization is complete
  52. Log.log(Log.DEBUG,BeanShell.class,"BeanShell interpreter version "
  53. + this.interpreter.VERSION);