PageRenderTime 68ms CodeModel.GetById 23ms RepoModel.GetById 4ms app.codeStats 1ms

/jEdit/tags/jedit-4-0-pre5/bsh/commands/browseClass.bsh

#
Unknown | 33 lines | 27 code | 6 blank | 0 comment | 0 complexity | 4462c03dcbfa1382e5f174b6f77faea8 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. Browse the specified class, class name (as String), or the class
  3. of the specified object's type.
  4. Note: To browse the String class you can't supply a String.
  5. You'd have to do: browseClass( String.class );
  6. */
  7. import bsh.Name;
  8. browseClass( Object o ) {
  9. if ( o instanceof String)
  10. classname = o;
  11. else if ( o instanceof Name.ClassIdentifier )
  12. clasname = this.namespace.identifierToClass(o).getName();
  13. else if ( o instanceof Class )
  14. classname = o.getName();
  15. else
  16. classname = o.getClass().getName();
  17. // really need a way to unset and more poweful testing...
  18. if ( bsh.system.desktop == void
  19. || bsh.system.desktop.classbrowser == void
  20. || bsh.system.desktop.classbrowser == null ) {
  21. browser = classBrowser();
  22. } else {
  23. browser = bsh.system.desktop.classbrowser;
  24. bsh.system.desktop.classbrowser.toFront();
  25. }
  26. browser.driveToClass( classname );
  27. }