home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Freeware 25 / FreelogHS25.iso / Dessin / ArtOfIllusion2.2.1 / ArtOfIllusion.jar / bsh / commands / browseClass.bsh < prev    next >
Text File  |  2005-05-23  |  1KB  |  43 lines

  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.  
  8.     Note: To browse the String class you can't supply a String.
  9.     You'd have to do:  browseClass( String.class );
  10.     <p>
  11.  
  12.  
  13.     @method void browseClass( String | Object | Class )
  14. */
  15. import bsh.ClassIdentifier;
  16.  
  17. browseClass( Object o ) 
  18. {
  19.     String classname;
  20.     if ( o instanceof String)
  21.         classname = o;
  22.     else if ( o instanceof ClassIdentifier )
  23.         classname = this.namespace.identifierToClass(o).getName();
  24.     else if ( o instanceof Class )
  25.         classname = o.getName();
  26.     else 
  27.         classname = o.getClass().getName();
  28.  
  29.     // really need a way to unset and more poweful testing...
  30.     if ( bsh.system.desktop == void 
  31.             || bsh.system.desktop.classbrowser == void 
  32.             || bsh.system.desktop.classbrowser == null ) 
  33.     {
  34.         this.browser = classBrowser();
  35.     } else {
  36.         this.browser = bsh.system.desktop.classbrowser;
  37.         bsh.system.desktop.classbrowser.toFront();
  38.     }
  39.  
  40.     browser.driveToClass( classname );
  41. }
  42.  
  43.