/jEdit/tags/jedit-4-0-pre3/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/**
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