PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Unknown | 40 lines | 32 code | 8 blank | 0 comment | 0 complexity | 778e20269eb6e1b45820c44473be720d 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. Open the class browser to view the specified class.
  3. If the argument is a string it is considered to be a class name.
  4. If the argument is an object, the class of the object is used.
  5. If the arg is a class, the class is used.
  6. <p>
  7. Note: To browse the String class you can't supply a String.
  8. You'd have to do: browseClass( String.class );
  9. <p>
  10. @method void browseClass( String | Object | Class )
  11. */
  12. import bsh.Name;
  13. browseClass( Object o ) {
  14. if ( o instanceof String)
  15. classname = o;
  16. else if ( o instanceof Name.ClassIdentifier )
  17. clasname = this.namespace.identifierToClass(o).getName();
  18. else if ( o instanceof Class )
  19. classname = o.getName();
  20. else
  21. classname = o.getClass().getName();
  22. // really need a way to unset and more poweful testing...
  23. if ( bsh.system.desktop == void
  24. || bsh.system.desktop.classbrowser == void
  25. || bsh.system.desktop.classbrowser == null ) {
  26. browser = classBrowser();
  27. } else {
  28. browser = bsh.system.desktop.classbrowser;
  29. bsh.system.desktop.classbrowser.toFront();
  30. }
  31. browser.driveToClass( classname );
  32. }