/jEdit/tags/jedit-4-1-pre5/bsh/commands/which.bsh

# · Unknown · 24 lines · 18 code · 6 blank · 0 comment · 0 complexity · a40a31e3f91fe73461a0e9f15e8c4e4b MD5 · raw file

  1. /**
  2. Use classpath mapping to determine the source of the specified class
  3. file. (Like the Unix which command for executables).
  4. @method which( classIdentifier | string | class )
  5. */
  6. bsh.help.which= "usage: which( classIdentifier | string | class )";
  7. import bsh.Name;
  8. import bsh.BshClassManager;
  9. which( clas ) {
  10. // make the class into a name
  11. if ( clas instanceof Name.ClassIdentifier )
  12. clas = this.namespace.identifierToClass( clas );
  13. if ( clas instanceof Class )
  14. clas = clas.getName();
  15. String className = clas;
  16. cp = BshClassManager.getClassManager().getClassPath();
  17. print ( cp.getClassSource( className ) );
  18. }