source: trunk/j/src/bsh/commands/browseClass.bsh @ 2

Last change on this file since 2 was 2, checked in by piso, 18 years ago

Initial checkin.

File size: 880 bytes
Line 
1
2/**
3  Browse the specified class, class name (as String), or the class
4  of the specified object's type.
5
6  Note: To browse the String class you can't supply a String.
7  You'd have to do:  browseClass( String.class );
8*/
9import bsh.Name;
10browseClass( Object o ) {
11
12  if ( o instanceof String)
13    classname = o;
14  else if ( o instanceof Name.ClassIdentifier )
15    clasname = this.namespace.identifierToClass(o).getName();
16  else if ( o instanceof Class )
17    classname = o.getName();
18  else
19    classname = o.getClass().getName();
20
21  // really need a way to unset and more poweful testing...
22  if ( bsh.system.desktop == void
23      || bsh.system.desktop.classbrowser == void
24      || bsh.system.desktop.classbrowser == null ) {
25    browser = classBrowser();
26  } else {
27    browser = bsh.system.desktop.classbrowser;
28    bsh.system.desktop.classbrowser.toFront();
29  }
30
31  browser.driveToClass( classname );
32}
33
Note: See TracBrowser for help on using the repository browser.