PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/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
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. /**
  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. }