/jEdit/tags/jedit-4-3-pre5/bsh/commands/importCommands.bsh

# · Unknown · 39 lines · 31 code · 8 blank · 0 comment · 0 complexity · f23de37110f427c79cb0ad0984cb40d8 MD5 · raw file

  1. /**
  2. Import scripted or compiled BeanShell commands in the following package
  3. in the classpath. You may use either "/" path or "." package notation.
  4. e.g.
  5. <pre>
  6. // equivalent
  7. importCommands("/bsh/commands")
  8. importCommands("bsh.commands")
  9. <pre>
  10. When searching for a command each path will be checked for first, a file
  11. named 'command'.bsh and second a class file named 'command'.class.
  12. <p/>
  13. You may add to the BeanShell classpath using the addClassPath() or
  14. setClassPath() commands and then import them as usual.
  15. <pre>
  16. addClassPath("mycommands.jar");
  17. importCommands("/mypackage/commands");
  18. </pre>
  19. <p/>
  20. If a relative path style specifier is used then it is made into an absolute
  21. path by prepending "/". Later imports take precedence over earlier ones.
  22. <p/>
  23. Imported commands are scoped just like imported clases.
  24. <p/>
  25. @method void importCommands( resource path | package name )
  26. */
  27. bsh.help.importCommands = "usage: importCommands( string )";
  28. importCommands( path )
  29. {
  30. this.caller.namespace.importCommands( path );
  31. }